fix: tf acc test pipeline

[skip ci]
This commit is contained in:
Marcel S. Henselin 2026-03-10 16:36:35 +01:00
parent 30e4ce6b2d
commit eecf98f4b1
2 changed files with 30 additions and 10 deletions

View file

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

View file

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