From 32f5bfd6bfe4f866ffc21a026cf64507afa4c2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 28 Jan 2021 17:07:25 +0100 Subject: [PATCH] ci: fix code generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the recent bump to Golang 1.15, the code generation was broken. Changing the output-base to the main repo and not the vendor solves the issue and feel more natural too. The command "go mod vendor" only cherry-picks certain files for inclusion in the vendor folder. I suspect the upgrade to Golang 1.15 introduced that behavior. Previously our vendir dir was full and now it has nothing (from rook) that's why the code generator was removing all our interfaces. Signed-off-by: Sébastien Han --- build/codegen/codegen.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/codegen/codegen.sh b/build/codegen/codegen.sh index 7033f551b..eb844069a 100755 --- a/build/codegen/codegen.sh +++ b/build/codegen/codegen.sh @@ -19,11 +19,14 @@ GROUP_VERSIONS="rook.io:v1 rook.io:v1alpha2 ceph.rook.io:v1 nfs.rook.io:v1alpha1 scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" codegendir="${scriptdir}/../../vendor/k8s.io/code-generator" +# ensures the vendor dir has the right deps, e,g. code-generator +go mod vendor + +# run code generation bash ${codegendir}/generate-groups.sh \ all \ github.com/rook/rook/pkg/client \ github.com/rook/rook/pkg/apis \ "${GROUP_VERSIONS}" \ - --output-base "${scriptdir}/../../vendor" \ + --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ --go-header-file "${scriptdir}/boilerplate.go.txt" -cp -r "${scriptdir}/../../vendor/github.com/rook/rook/pkg" "${scriptdir}/../../"