From eecf98f4b1c1f89eb958633d20c9f67e7d0662fb Mon Sep 17 00:00:00 2001 From: "Marcel S. Henselin" Date: Tue, 10 Mar 2026 16:36:35 +0100 Subject: [PATCH] fix: tf acc test pipeline [skip ci] --- .github/actions/acc_test/action.yaml | 38 +++++++++++++++++++++------- .github/workflows/tf-acc-test.yaml | 2 +- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/actions/acc_test/action.yaml b/.github/actions/acc_test/action.yaml index 611c1583..26aaf210 100644 --- a/.github/actions/acc_test/action.yaml +++ b/.github/actions/acc_test/action.yaml @@ -39,6 +39,12 @@ inputs: service_account_json_content: description: "STACKIT service account JSON file contents" required: true + default: "" + + service_account_json_content_b64: + description: "STACKIT service account JSON file contents" + required: true + default: "" service_account_json_file_path: description: "STACKIT service account JSON file contents" @@ -126,13 +132,12 @@ runs: ${{ steps.goenv.outputs.gomodcache }} key: ${{ runner.os }}-gopkg - - name: Ensure service account file exists + - name: Creating service_account file from json input + if: inputs.service_account_json_content != '' shell: bash run: | set -e set -x - - export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' jsonFile="${{ inputs.service_account_json_file_path }}" jsonFile="${jsonFile:-x}" @@ -142,16 +147,31 @@ runs: fi if [ ! -f "${jsonFile}" ]; then - echo "unable to find service account file '${{ inputs.service_account_json_file_path }}'" - #if [ "${jsonFileContent:-x}" == "x" ]; then - # echo "ERROR: service_account_json_file_content MUST NOT be empty if account file is missing" - # exit 1 - #fi - #echo "creating service account file '${{ inputs.service_account_json_file_path }}'" + echo "creating service account file '${{ inputs.service_account_json_file_path }}'" echo "${{ inputs.service_account_json_content }}" > stackit/"${{ inputs.service_account_json_file_path }}" fi ls -l stackit/"${{ inputs.service_account_json_file_path }}" + - name: Creating service_account file from base64 json input + if: inputs.service_account_json_content_b64 != '' + shell: bash + run: | + set -e + set -x + + jsonFile="${{ inputs.service_account_json_file_path }}" + jsonFile="${jsonFile:-x}" + if [ "${jsonFile}" == "x" ]; then + echo "no service account file path provided" + exit 1 + fi + + if [ ! -f "${jsonFile}" ]; then + echo "creating service account file '${{ inputs.service_account_json_file_path }}'" + echo "${{ inputs.service_account_json_content_b64 }}" | base64 -d > stackit/"${{ inputs.service_account_json_file_path }}" + fi + ls -l stackit/"${{ inputs.service_account_json_file_path }}" + - name: Run acceptance test file if: ${{ inputs.test_file != '' }} shell: bash diff --git a/.github/workflows/tf-acc-test.yaml b/.github/workflows/tf-acc-test.yaml index 4e3de3e2..890c085a 100644 --- a/.github/workflows/tf-acc-test.yaml +++ b/.github/workflows/tf-acc-test.yaml @@ -20,7 +20,7 @@ jobs: go-version: ${{ env.GO_VERSION }} project_id: ${{ vars.TEST_PROJECT_ID }} region: 'eu01' - service_account_json_content: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON }}" + service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}" project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }} tf_acc_kek_key_id: ${{ vars.TEST_KEK_KEY_ID }} tf_acc_kek_key_ring_id: ${{ vars.TEST_KEK_KEY_RING_ID }}