Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Copy codegen package locally so it can be compiled
Browse files Browse the repository at this point in the history
The k8s.io/code-generator package version needed to produce code
compatible with client-go@v11 is old enough that it won't work with
`go mod`. To be able to use it, we have to copy it locally and let it
be compiled there.
  • Loading branch information
squaremo committed Jul 31, 2019
1 parent 523f56b commit cd51685
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
19 changes: 15 additions & 4 deletions bin/helm/update_codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@ set -o errexit
set -o nounset
set -o pipefail

# This corresponds to the tag kubernetes-1.14.4, and to the pinned version in go.mod
CODEGEN_VERSION="[email protected]"
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../..
CODEGEN_PKG=${CODEGEN_PKG:-$(echo `go env GOPATH`'/pkg/mod/k8s.io/[email protected]')}

go mod download # make sure the code-generator is downloaded
env GOPATH=`go env GOPATH` bash ${CODEGEN_PKG}/generate-groups.sh all github.com/weaveworks/flux/integrations/client \
# Chosen to line up with the ./build directory used in the Makefile
CODEGEN_ROOT=./build/codegen
rm -rf ${CODEGEN_ROOT}
mkdir -p ${CODEGEN_ROOT}
echo Using codegen in ${CODEGEN_ROOT}

export GO111MODULE=on
# make sure the codegen module has been fetched
go mod download
cp -R $(echo `go env GOPATH`)'/pkg/mod/k8s.io/'${CODEGEN_VERSION} ${CODEGEN_ROOT}
chmod -R u+w ${CODEGEN_ROOT}

bash "${CODEGEN_ROOT}/generate-groups.sh" all github.com/weaveworks/flux/integrations/client \
github.com/weaveworks/flux/integrations/apis \
"flux.weave.works:v1beta1 helm.integrations.flux.weave.works:v1alpha2" \
--go-header-file "${SCRIPT_ROOT}/bin/helm/custom-boilerplate.go.txt"

2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ require (
k8s.io/apiextensions-apiserver v0.0.0-20190315093550-53c4693659ed
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
k8s.io/client-go v11.0.0+incompatible
k8s.io/code-generator v0.0.0-00010101000000-000000000000
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a
k8s.io/helm v2.13.1+incompatible
k8s.io/klog v0.3.1
)
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d/go.mod h1:ccL7Eh7zubPUSh9
k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwnJo9o=
k8s.io/client-go v11.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/code-generator v0.0.0-20190311093542-50b561225d70 h1:lgPp615xLHxN84RBd+viA/oHzJfI0miFYFH4T9wpPQ4=
k8s.io/code-generator v0.0.0-20190311093542-50b561225d70/go.mod h1:MYiN+ZJZ9HkETbgVZdWw2AsuAi9PZ4V80cwfuf2axe8=
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a h1:QoHVuRquf80YZ+/bovwxoMO3Q/A3nt3yTgS0/0nejuk=
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/helm v2.13.1+incompatible h1:qt0LBsHQ7uxCtS3F2r3XI0DNm8ml0xQeSJixUorDyn0=
k8s.io/helm v2.13.1+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
k8s.io/klog v0.3.0 h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE=
Expand Down

0 comments on commit cd51685

Please sign in to comment.