add option constellationPath to constellation source depending action pseudo_version

This commit is contained in:
leongross 2022-12-08 13:39:29 +01:00
parent 89cdb56183
commit b899759b16
No known key found for this signature in database
GPG Key ID: 8684D89F6BF9B743
3 changed files with 30 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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 }}