Skip to content

Commit

Permalink
Reorder code generation script to download dependencies before settin…
Browse files Browse the repository at this point in the history
…g `CODE_GEN_DIR`
  • Loading branch information
sujeet01 committed Oct 28, 2024
1 parent a8989ac commit ab4ac47
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ THIS_PKG="github.com/ironcore-dev/ironcore"
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT_ROOT="$SCRIPT_DIR/.."

VGOPATH="$VGOPATH"
MODELS_SCHEMA="$MODELS_SCHEMA"
OPENAPI_GEN="$OPENAPI_GEN"

VIRTUAL_GOPATH="$(mktemp -d)"
trap 'rm -rf "$VIRTUAL_GOPATH"' EXIT

# Setup virtual GOPATH so the codegen tools work as expected.
(cd "$PROJECT_ROOT"; go mod download && "$VGOPATH" -o "$VIRTUAL_GOPATH")

export GOROOT="${GOROOT:-"$(go env GOROOT)"}"
export GOPATH="$VIRTUAL_GOPATH"

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

Expand Down Expand Up @@ -35,19 +48,6 @@ function qualify-gvs() {
echo "$res"
}

VGOPATH="$VGOPATH"
MODELS_SCHEMA="$MODELS_SCHEMA"
OPENAPI_GEN="$OPENAPI_GEN"

VIRTUAL_GOPATH="$(mktemp -d)"
trap 'rm -rf "$VIRTUAL_GOPATH"' EXIT

# Setup virtual GOPATH so the codegen tools work as expected.
(cd "$PROJECT_ROOT"; go mod download && "$VGOPATH" -o "$VIRTUAL_GOPATH")

export GOROOT="${GOROOT:-"$(go env GOROOT)"}"
export GOPATH="$VIRTUAL_GOPATH"

CLIENT_GROUPS="core compute ipam networking storage"
CLIENT_VERSION_GROUPS="core:v1alpha1 compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1"
ALL_VERSION_GROUPS="common:v1alpha1 $CLIENT_VERSION_GROUPS"
Expand Down

0 comments on commit ab4ac47

Please sign in to comment.