fix: tf acc test pipeline
[skip ci]
This commit is contained in:
parent
30e4ce6b2d
commit
eecf98f4b1
2 changed files with 30 additions and 10 deletions
38
.github/actions/acc_test/action.yaml
vendored
38
.github/actions/acc_test/action.yaml
vendored
|
|
@ -39,6 +39,12 @@ inputs:
|
||||||
service_account_json_content:
|
service_account_json_content:
|
||||||
description: "STACKIT service account JSON file contents"
|
description: "STACKIT service account JSON file contents"
|
||||||
required: true
|
required: true
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
service_account_json_content_b64:
|
||||||
|
description: "STACKIT service account JSON file contents"
|
||||||
|
required: true
|
||||||
|
default: ""
|
||||||
|
|
||||||
service_account_json_file_path:
|
service_account_json_file_path:
|
||||||
description: "STACKIT service account JSON file contents"
|
description: "STACKIT service account JSON file contents"
|
||||||
|
|
@ -126,13 +132,12 @@ runs:
|
||||||
${{ steps.goenv.outputs.gomodcache }}
|
${{ steps.goenv.outputs.gomodcache }}
|
||||||
key: ${{ runner.os }}-gopkg
|
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
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
|
||||||
|
|
||||||
jsonFile="${{ inputs.service_account_json_file_path }}"
|
jsonFile="${{ inputs.service_account_json_file_path }}"
|
||||||
jsonFile="${jsonFile:-x}"
|
jsonFile="${jsonFile:-x}"
|
||||||
|
|
@ -142,16 +147,31 @@ runs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "${jsonFile}" ]; then
|
if [ ! -f "${jsonFile}" ]; then
|
||||||
echo "unable to find service account file '${{ inputs.service_account_json_file_path }}'"
|
echo "creating 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 "${{ inputs.service_account_json_content }}" > stackit/"${{ inputs.service_account_json_file_path }}"
|
echo "${{ inputs.service_account_json_content }}" > stackit/"${{ inputs.service_account_json_file_path }}"
|
||||||
fi
|
fi
|
||||||
ls -l stackit/"${{ inputs.service_account_json_file_path }}"
|
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
|
- name: Run acceptance test file
|
||||||
if: ${{ inputs.test_file != '' }}
|
if: ${{ inputs.test_file != '' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
2
.github/workflows/tf-acc-test.yaml
vendored
2
.github/workflows/tf-acc-test.yaml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
project_id: ${{ vars.TEST_PROJECT_ID }}
|
project_id: ${{ vars.TEST_PROJECT_ID }}
|
||||||
region: 'eu01'
|
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 }}
|
project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
|
||||||
tf_acc_kek_key_id: ${{ vars.TEST_KEK_KEY_ID }}
|
tf_acc_kek_key_id: ${{ vars.TEST_KEK_KEY_ID }}
|
||||||
tf_acc_kek_key_ring_id: ${{ vars.TEST_KEK_KEY_RING_ID }}
|
tf_acc_kek_key_ring_id: ${{ vars.TEST_KEK_KEY_RING_ID }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue