Skip to content

doc: add workaround for hack/update-generated-code.sh #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion hack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,35 @@ This is the script to update clientset/informers/listers and API deepcopy code u

Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go.

To run this script, simply run: ./hack/update-generated-code.sh from the project root directory.
To run this script, you have to patch it:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some words here to explain why we have to go thru these steps to generate code and reference this issue #239.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merged this PR.
@alex1989hu can you submit a followup PR to address this comment.

```patch
diff --git a/hack/update-generated-code.sh b/hack/update-generated-code.sh
--- a/hack/update-generated-code.sh
+++ b/hack/update-generated-code.sh
@@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
bash ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
- github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
+ github.com/kubernetes-csi/external-snapshotter/v2/pkg/client github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis \
volumesnapshot:v1beta1 \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
```

Once you are done with patching, continue:
```bash
rm -fr v2/
ln -sfvn $(pwd) v2
rm -fr pkg/client
```

Run: ./hack/update-generated-code.sh from the project root directory.

Do not forget to revert previously applied workaround:
```bash
git checkout -- v2/
git checkout -- hack/update-generated-code.sh
```

## update-crd.sh

Expand Down