From f21252c57dab089d9d132f5e16ecf987a5e0cf1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= <66256922+daniel-weisse@users.noreply.github.com> Date: Mon, 5 Feb 2024 13:29:03 +0100 Subject: [PATCH] ci: fix workspace related errors when setting up k8s version for test (#2891) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fail workflow on error in subshell * Remove relative paths from workflow * Set up MMA only for SEV-SNP, not for Azure TDX --------- Signed-off-by: Daniel Weiße --- .../workflows/e2e-test-provider-example.yml | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/e2e-test-provider-example.yml b/.github/workflows/e2e-test-provider-example.yml index 4eb7fd2d6..89c6a63b3 100644 --- a/.github/workflows/e2e-test-provider-example.yml +++ b/.github/workflows/e2e-test-provider-example.yml @@ -143,8 +143,8 @@ jobs: id: build shell: bash run: | - mkdir build - cd build + mkdir -p ${{ github.workspace }}/build + cd ${{ github.workspace }}/build bazel run //:devbuild --cli_edition=enterprise bazel build //bazel/settings:tag @@ -189,19 +189,22 @@ jobs: - name: Set Kubernetes version id: kubernetes run: | + set -e + # take the middle (2nd) supported Kubernetes version (default) if [[ "${{ inputs.providerVersion }}" != "" ]]; then - echo "VERSION=$(../release/constellation config kubernetes-versions | awk 'NR==3{print $1}')" | tee -a "$GITHUB_OUTPUT" + cli_output=$(${{ github.workspace }}/release/constellation config kubernetes-versions) else - echo "VERSION=$(../build/constellation config kubernetes-versions | awk 'NR==3{print $1}')" | tee -a "$GITHUB_OUTPUT" + cli_output=$(${{ github.workspace }}/build/constellation config kubernetes-versions) fi + echo "version=$(echo "${cli_output}" | awk 'NR==3{print $1}')" | tee -a "${GITHUB_OUTPUT}" - name: Common CSP Terraform overrides working-directory: ${{ github.workspace }} shell: bash run: | - mkdir cluster - cd cluster + mkdir -p ${{ github.workspace }}/cluster + cd ${{ github.workspace }}/cluster if [[ "${{ inputs.providerVersion }}" == "" ]]; then prefixed_version=${{ steps.build.outputs.build_version }} else @@ -210,8 +213,8 @@ jobs: version=${prefixed_version#v} # remove v prefix if [[ "${{ inputs.providerVersion }}" == "" ]]; then - iam_src="../terraform-module/iam/${{ steps.determine.outputs.cloudProvider }}" - infra_src="../terraform-module/${{ steps.determine.outputs.cloudProvider }}" + iam_src="${{ github.workspace }}/terraform-module/iam/${{ steps.determine.outputs.cloudProvider }}" + infra_src="${{ github.workspace }}/terraform-module/${{ steps.determine.outputs.cloudProvider }}" else iam_src="https://github.com/edgelesssys/constellation/releases/download/${{ inputs.providerVersion }}/terraform-module.zip//terraform-module/iam/${{ steps.determine.outputs.cloudProvider }}" infra_src="https://github.com/edgelesssys/constellation/releases/download/${{ inputs.providerVersion }}/terraform-module.zip//terraform-module/${{ steps.determine.outputs.cloudProvider }}" @@ -310,10 +313,10 @@ jobs: shell: bash run: | terraform init - if [[ "${{ steps.determine.outputs.cloudProvider }}" == "azure" ]]; then + if [[ "${{ inputs.attestationVariant }}" == "azure-sev-snp" ]]; then terraform apply -target module.azure_iam -auto-approve terraform apply -target module.azure_infrastructure -auto-approve - ../build/constellation maa-patch "$(terraform output -raw maa_url)" + ${{ github.workspace }}/build/constellation maa-patch "$(terraform output -raw maa_url)" terraform apply -target constellation_cluster.azure_example -auto-approve else terraform apply -auto-approve @@ -405,7 +408,7 @@ jobs: fi # cfg must be in same dir as KUBECONFIG - ../build/constellation config generate "${{ steps.determine.outputs.cloudProvider }}" + ${{ github.workspace }}/build/constellation config generate "${{ steps.determine.outputs.cloudProvider }}" # make cfg valid with fake data # IMPORTANT: zone needs to be correct because it is used to resolve the CSP image ref if [[ "${{ steps.determine.outputs.cloudProvider }}" == "azure" ]]; then