Skip to content

Commit

Permalink
fix(codegen): use kube_codegen.sh deepcopy and client gen correctly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
crenshaw-dev authored Nov 4, 2024
1 parent b187fbb commit 438e01b
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 520 deletions.
19 changes: 13 additions & 6 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PATH="${PROJECT_ROOT}/dist:${PATH}"
GOPATH=$(go env GOPATH)
GOPATH_PROJECT_ROOT="${GOPATH}/src/github.com/argoproj/argo-cd"

TARGET_SCRIPT=/tmp/kube_codegen.sh
TARGET_SCRIPT=kube_codegen.sh

# codegen utilities are installed outside of kube_codegen.sh so remove the `go install` step in the script.
sed -e '/go install/d' ${PROJECT_ROOT}/vendor/k8s.io/code-generator/kube_codegen.sh >${TARGET_SCRIPT}
Expand All @@ -39,11 +39,18 @@ sed -i.bak -e 's#${gobin}/##g' ${TARGET_SCRIPT}
[ -e ./v2 ] || ln -s . v2
[ -e "${GOPATH_PROJECT_ROOT}" ] || (mkdir -p "$(dirname "${GOPATH_PROJECT_ROOT}")" && ln -s "${PROJECT_ROOT}" "${GOPATH_PROJECT_ROOT}")

bash -x ${TARGET_SCRIPT} "deepcopy,client,informer,lister" \
github.com/argoproj/argo-cd/v2/pkg/client github.com/argoproj/argo-cd/v2/pkg/apis \
"application:v1alpha1" \
--go-header-file "${PROJECT_ROOT}/hack/custom-boilerplate.go.txt" \
--output-base "${GOPATH}/src"
# shellcheck source=pkg/apis/application/v1alpha1/kube_codegen.sh
. ${TARGET_SCRIPT}

kube::codegen::gen_helpers pkg/apis/application/v1alpha1
kube::codegen::gen_client pkg/apis \
--output-dir pkg/client \
--output-pkg github.com/argoproj/argo-cd/v2/pkg/client \
--boilerplate "${PROJECT_ROOT}/hack/custom-boilerplate.go.txt" \
--with-watch

rm ${TARGET_SCRIPT}
rm ${TARGET_SCRIPT}.bak

[ -L "${GOPATH_PROJECT_ROOT}" ] && rm -rf "${GOPATH_PROJECT_ROOT}"
[ -L ./v2 ] && rm -rf v2
90 changes: 90 additions & 0 deletions pkg/apis/application/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions pkg/client/clientset/versioned/doc.go

This file was deleted.

6 changes: 5 additions & 1 deletion pkg/client/clientset/versioned/fake/clientset_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 438e01b

Please sign in to comment.