Skip to content

Commit 9222b6f

Browse files
ci(api): pre-fetch k8s.io/code-generator in codegen drift job
hack/update-codegen.sh sources kube_codegen.sh from the Go module cache at ~/go/pkg/mod/k8s.io/[email protected]/, but the module is not declared in go.mod so a fresh runner has nothing to source from. Add a workflow step that parses the pinned version out of the script and pulls the module into the cache before running make generate. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 860f431 commit 9222b6f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎.github/workflows/codegen-drift.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ jobs:
3030
go-version-file: go.mod
3131
cache: true
3232

33+
- name: Pre-fetch k8s.io/code-generator module
34+
# hack/update-codegen.sh sources kube_codegen.sh from the Go module cache.
35+
# The module is not declared in go.mod, so fetch it explicitly at the
36+
# version pinned in the script.
37+
run: |
38+
version=$(grep -oP 'code-generator@\Kv[0-9.]+' hack/update-codegen.sh)
39+
tmpdir=$(mktemp -d)
40+
cd "$tmpdir"
41+
go mod init codegen-fetch
42+
go get "k8s.io/code-generator@${version}"
43+
3344
- name: Run make generate
3445
run: make generate
3546

0 commit comments

Comments
 (0)