ci: ensure --tags flag is only set if the CLI supports it (#3044)

* Use github.run_id to correctly tag resources with the run id
* Ensure `--tags` flag is only set if CLI supports it

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2024-04-26 09:34:21 +02:00 committed by GitHub
parent 0df26c0e9b
commit 680d3318af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -52,8 +52,14 @@ runs:
kubernetesFlag="--kubernetes=${{ inputs.kubernetesVersion }}"
fi
# TODO(v2.17): Remove this fallback and always use --tags flag
tagsFlag=""
if constellation config generate --help | grep -q -- --tags; then
tagsFlag="--tags=\"${{ inputs.additionalTags }}\""
fi
echo "flag=--update-config" | tee -a "$GITHUB_OUTPUT"
constellation config generate ${{ inputs.cloudProvider }} ${kubernetesFlag} --attestation ${{ inputs.attestationVariant }} --tags ${{ inputs.additionalTags }}
constellation config generate ${{ inputs.cloudProvider }} ${kubernetesFlag} --attestation ${{ inputs.attestationVariant }} ${tagsFlag}
- name: Constellation iam create aws
shell: bash

View File

@ -258,7 +258,7 @@ runs:
gcpProjectID: ${{ inputs.gcpProject }}
gcpZone: ${{ inputs.regionZone || 'europe-west3-b' }}
kubernetesVersion: ${{ inputs.kubernetesVersion }}
additionalTags: "workflow=${{ github.workflow }}"
additionalTags: "workflow=${{ github.run_id }}"
- name: Login to GCP (Cluster service account)
if: inputs.cloudProvider == 'gcp'

View File

@ -84,7 +84,7 @@ jobs:
run: |
$uid = Get-Random -Minimum 1000 -Maximum 9999
$rgName = "e2e-win-${{ github.run_id }}-${{ github.run_attempt }}-$uid"
.\constellation.exe config generate azure -t "workflow=${{ github.workflow }}"
.\constellation.exe config generate azure -t "workflow=${{ github.run_id }}"
.\constellation.exe iam create azure --region=westus --resourceGroup=$rgName-rg --servicePrincipal=$rgName-sp --update-config --debug -y
- name: Login to Azure (Cluster service principal)