diff --git a/.github/actions/build_micro_service_ko/action.yml b/.github/actions/build_micro_service_ko/action.yml index 4cbfe171e..e16a39afc 100644 --- a/.github/actions/build_micro_service_ko/action.yml +++ b/.github/actions/build_micro_service_ko/action.yml @@ -8,6 +8,10 @@ inputs: description: "Path to the .ko.yaml config file" default: ".ko.yaml" required: false + constellationPath: + description: "Path to the root of the Constellation repo" + #default: "TEST_MICRO_SERVICE_" + required: true koTarget: description: "Go package to build with ko" required: true @@ -38,6 +42,8 @@ runs: - name: Determine pseudo version id: pseudo-version uses: ./.github/actions/pseudo_version + with: + constellationPath: ${{ inputs.constellationPath }} - name: Build and upload container image id: build-and-upload diff --git a/.github/actions/pseudo_version/action.yml b/.github/actions/pseudo_version/action.yml index 38a04fcb3..ae2db64ea 100644 --- a/.github/actions/pseudo_version/action.yml +++ b/.github/actions/pseudo_version/action.yml @@ -1,5 +1,10 @@ name: Determine pseudo version description: "Determine go-like pseudo version to use as container image tag." +inputs: + constellationPath: + description: "Path to Constellation repository root" + #default: "." + required: true outputs: pseudoVersion: @@ -25,24 +30,30 @@ runs: - name: get pseudo version id: pseudo-version run: | + ln -s ${{ inputs.constellationPath }}/.git .git if $(git rev-parse --is-shallow-repository); then git fetch --prune --unshallow --tags -v else git fetch --tags -v fi + rm .git + + pseudoVersionPath=${{ inputs.constellationPath }}/hack/pseudo-version homedir="$(getent passwd $(id -u) | cut -d ":" -f 6)" + export GOCACHE=${homedir}/.cache/go-build export GOPATH=${homedir}/go export GOMODCACHE=${homedir}/.cache/go-mod - pseudoVersion=$(go run .) - semanticVersion=$(go run . -semantic-version) - timestamp=$(go run . -print-timestamp) - branchName=$(go run . -print-branch) - releaseVersion=$(go run . -print-release-branch) + + pseudoVersion=$(go run $pseudoVersionPath) + semanticVersion=$(go run $pseudoVersionPath -semantic-version) + timestamp=$(go run $pseudoVersionPath -print-timestamp) + branchName=$(go run $pseudoVersionPath -print-branch) + releaseVersion=$(go run $pseudoVersionPath -print-release-branch) + echo "pseudoVersion=${pseudoVersion}" >> $GITHUB_OUTPUT echo "semanticVersion=${semanticVersion}" >> $GITHUB_OUTPUT echo "timestamp=${timestamp}" >> $GITHUB_OUTPUT echo "branchName=${branchName}" >> $GITHUB_OUTPUT echo "releaseVersion=${releaseVersion}" >> $GITHUB_OUTPUT - working-directory: hack/pseudo-version shell: bash diff --git a/.github/workflows/build-gcp-guest-agent-ko.yml b/.github/workflows/build-gcp-guest-agent-ko.yml index 8629a92ed..65ba8b5cd 100644 --- a/.github/workflows/build-gcp-guest-agent-ko.yml +++ b/.github/workflows/build-gcp-guest-agent-ko.yml @@ -14,9 +14,6 @@ on: jobs: build-gcp-guest-agent: runs-on: ubuntu-22.04 - defaults: - run: - working-directory: ./constellation permissions: contents: read packages: write @@ -47,10 +44,14 @@ jobs: koData="./guest-agent/kodata" mkdir -p $koData cp ./constellation/3rdparty/gcp-guest-agent/instance_configs.cfg $koData - cd ${{ github.workspace }}/ - ls -lah + cd ${GITHUB_WORKSPACE}/ ln -s ./constellation/.github/ .github + echo ${{ github.workspace }}/constellation + ls -alh ${{ github.workspace }}/constellation + #echo $GITHUB_WORKSPACE/constellation + #ls -alh $GITHUB_WORKSPACE/constellation + - name: Build and upload gcp guest service container image id: build-and-upload # assumes that we are currently in the root of the repo @@ -59,6 +60,7 @@ jobs: name: gcp-guest-agent koTarget: ./guest-agent/google-guest-agent/ githubToken: ${{ secrets.GITHUB_TOKEN }} + constellationPath: ${{ github.workspace }}/constellation cosignPublicKey: ${{ startsWith(github.ref, 'refs/heads/release/v') && secrets.COSIGN_PUBLIC_KEY || secrets.COSIGN_DEV_PUBLIC_KEY }} cosignPrivateKey: ${{ startsWith(github.ref, 'refs/heads/release/v') && secrets.COSIGN_PRIVATE_KEY || secrets.COSIGN_DEV_PRIVATE_KEY }} cosignPassword: ${{ startsWith(github.ref, 'refs/heads/release/v') && secrets.COSIGN_PASSWORD || secrets.COSIGN_DEV_PASSWORD }}