Skip to content

Commit

Permalink
Add step to download k8s.io/code-generator in GitHub Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
sujeet01 committed Oct 22, 2024
1 parent 1fe1e95 commit 8286466
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/check-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Download k8s.io/code-generator
run: |
CODE_GEN_VERSION=$(go list -m -f '{{.Version}}' k8s.io/code-generator)
go get k8s.io/code-generator@$CODE_GEN_VERSION
echo "CODE_GEN_DIR=$(go list -m -f '{{.Dir}}' k8s.io/code-generator)" >> $GITHUB_ENV
- name: Run make generate
run: make generate
- name: Compare the expected and actual generated/* directories
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: make test
- name: Download k8s.io/code-generator
run: |
CODE_GEN_VERSION=$(go list -m -f '{{.Version}}' k8s.io/code-generator)
go get k8s.io/code-generator@$CODE_GEN_VERSION
echo "CODE_GEN_DIR=$(go list -m -f '{{.Dir}}' k8s.io/code-generator)" >> $GITHUB_ENV
- name: Run make test
run: make test
6 changes: 3 additions & 3 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ set -o pipefail
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT_ROOT="$SCRIPT_DIR/.."

CODE_GEN_DIR="${CODE_GEN_DIR:-$(go list -m -f '{{.Dir}}' k8s.io/code-generator)}"
source "${CODE_GEN_DIR}/kube_codegen.sh"

export TERM="xterm-256color"

bold="$(tput bold)"
blue="$(tput setaf 4)"
normal="$(tput sgr0)"

CODE_GEN_DIR=$(go list -m -f '{{.Dir}}' k8s.io/code-generator)
source "${CODE_GEN_DIR}/kube_codegen.sh"

function qualify-gvs() {
APIS_PKG="$1"
GROUPS_WITH_VERSIONS="$2"
Expand Down

0 comments on commit 8286466

Please sign in to comment.