fix: pipeline_fix (#99)
## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #99
This commit is contained in:
parent
d16b97a8e9
commit
aac1a2ba17
6 changed files with 86 additions and 34 deletions
15
.github/actions/acc_test/action.yaml
vendored
15
.github/actions/acc_test/action.yaml
vendored
|
|
@ -67,11 +67,11 @@ inputs:
|
|||
|
||||
outputs:
|
||||
result:
|
||||
value: "${{ steps.testrun.result }}"
|
||||
value: ${{ steps.testrun.outputs.result }}
|
||||
description: "the output of the tests"
|
||||
|
||||
status:
|
||||
value: "${{ steps.status.status }}"
|
||||
value: ${{ steps.status.outputs.status }}
|
||||
description: "the status of the tests"
|
||||
|
||||
runs:
|
||||
|
|
@ -207,7 +207,7 @@ runs:
|
|||
id: testrun
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::go test file"
|
||||
echo "::group::go test"
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
|
|
@ -233,18 +233,19 @@ runs:
|
|||
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
|
||||
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
|
||||
go test -v ${testfile} -timeout=${{ inputs.test_timeout_string }} | tee -a acc_test_run.log
|
||||
echo "::endgroup::"
|
||||
set -e
|
||||
echo "::group::go test result"
|
||||
|
||||
if [[ $(cat acc_test_run.log | grep "FAIL") ]]; then
|
||||
echo "::endgroup::"
|
||||
echo "::group::go test result"
|
||||
echo "Test failed, see acc_test_run.log for details"
|
||||
res=$(cat acc_test_run.log | grep -v "=== RUN" | grep -v "\-\-\- PASS" | grep -v "=== CONT" | grep -v "=== PAUSE")
|
||||
echo "result=FAIL: ${res}" >> "$GITHUB_OUTPUT"
|
||||
echo "::endgroup::"
|
||||
exit 1
|
||||
else
|
||||
echo "result=no FAIL detected" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
echo "result=no FAIL detected" >> "$GITHUB_OUTPUT"
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
|
||||
|
|
|
|||
31
.github/actions/clean_up/action.yaml
vendored
31
.github/actions/clean_up/action.yaml
vendored
|
|
@ -49,6 +49,10 @@ outputs:
|
|||
description: "number of resources found"
|
||||
value: ${{ steps.retrieve_post.outputs.count }}
|
||||
|
||||
status:
|
||||
description: "status of the test"
|
||||
value: ${{ steps.status.outputs.status }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
|
@ -148,11 +152,14 @@ runs:
|
|||
|
||||
- name: Delete SQL Server Flex resources
|
||||
if: ${{ inputs.list_only != 'true' }}
|
||||
id: del_sql
|
||||
run: |
|
||||
echo "::group::delete SQL Server Flex resources"
|
||||
set -e
|
||||
stackit --verbosity ${{ inputs.log_level }} auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id'); do stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} beta sqlserverflex instance delete $s; done
|
||||
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id');
|
||||
do
|
||||
stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} beta sqlserverflex instance delete $s || echo "status=FAILURE" >> ${GITHUB_OUTPUT};
|
||||
done
|
||||
echo "::endgroup::"
|
||||
shell: bash
|
||||
|
||||
|
|
@ -165,11 +172,14 @@ runs:
|
|||
|
||||
- name: Delete PostgreSQL Flex resources
|
||||
if: ${{ inputs.list_only != 'true' }}
|
||||
id: del_pg
|
||||
run: |
|
||||
echo "::group::delete PostgreSQL Flex resources"
|
||||
set -e
|
||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id'); do stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} postgresflex instance delete "$s" --force; done
|
||||
for s in $(stackit --verbosity ${{ inputs.log_level }} --project-id ${{ inputs.project_id }} postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}")) | .id');
|
||||
do
|
||||
stackit --verbosity ${{ inputs.log_level }} -y --project-id ${{ inputs.project_id }} postgresflex instance delete "$s" --force || echo "status=FAILURE" >> ${GITHUB_OUTPUT};
|
||||
done
|
||||
echo "::endgroup::"
|
||||
shell: bash
|
||||
|
||||
|
|
@ -202,3 +212,16 @@ runs:
|
|||
echo "count=$(( ${pg_count} + ${sql_count} ))" >> $GITHUB_OUTPUT
|
||||
echo "::endgroup::"
|
||||
shell: bash
|
||||
|
||||
- name: Set status
|
||||
if: always()
|
||||
id: status
|
||||
run: |
|
||||
status="SUCCESS"
|
||||
if [[ "${{ steps.del_pg.outputs.status }}" == "FAILURE" ]]; then
|
||||
status=FAILURE"
|
||||
elif [[ "${{ steps.del_sql.outputs.status }}" == "FAILURE" ]]; then
|
||||
status=FAILURE"
|
||||
fi
|
||||
echo "status=$status" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue