fix: update pipelines
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m43s
Publish / Check GoReleaser config (push) Failing after 1m19s
Publish / Publish provider (push) Has been skipped
CI Workflow / Prepare GO cache (pull_request) Successful in 6m55s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 28m45s
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m43s
Publish / Check GoReleaser config (push) Failing after 1m19s
Publish / Publish provider (push) Has been skipped
CI Workflow / Prepare GO cache (pull_request) Successful in 6m55s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 28m45s
fix: implement sql server 200 error
This commit is contained in:
parent
aaabadde1a
commit
1fd2df5c76
11 changed files with 196 additions and 15 deletions
1
.github/actions/clean_up/README.md
vendored
Normal file
1
.github/actions/clean_up/README.md
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# acceptance test action
|
||||
148
.github/actions/clean_up/action.yaml
vendored
Normal file
148
.github/actions/clean_up/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
name: CleanUp Project Resources
|
||||
description: "Acceptance Testing CleanUp"
|
||||
|
||||
inputs:
|
||||
project_id:
|
||||
description: "STACKIT project ID for tests"
|
||||
required: true
|
||||
|
||||
region:
|
||||
description: "STACKIT region for tests"
|
||||
default: 'eu01'
|
||||
required: true
|
||||
|
||||
tf_resource_prefix:
|
||||
description: "prefix in resource names"
|
||||
default: 'tf-acc-'
|
||||
required: true
|
||||
|
||||
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: ""
|
||||
|
||||
list_only:
|
||||
description: "only list resources, DO NOT delete"
|
||||
required: true
|
||||
default: 'true'
|
||||
|
||||
outputs:
|
||||
resources:
|
||||
description: "resource list"
|
||||
value: ${{ steps.resource_lister.outputs.resources }}
|
||||
|
||||
cli-version:
|
||||
description: "stackit cli version"
|
||||
value: ${{ steps.stackit_version.outputs.version }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install needed tools
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::apt install"
|
||||
set -e
|
||||
apt-get -y -qq update >apt_update.log 2>apt_update_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_update.log apt_update_err.log
|
||||
fi
|
||||
apt-get -y -qq install curl gnupg jq >apt_get.log 2>apt_get_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_get.log apt_get_err.log
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::apt add source"
|
||||
curl https://packages.stackit.cloud/keys/key.gpg | gpg --dearmor -o /usr/share/keyrings/stackit.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/stackit.gpg] https://packages.stackit.cloud/apt/cli stackit main" | tee -a /etc/apt/sources.list.d/stackit.list
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::apt install stackit cli"
|
||||
apt-get -y -qq update >apt_update.log 2>apt_update_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_update.log apt_update_err.log
|
||||
fi
|
||||
apt-get -y -qq install stackit >apt_get.log 2>apt_get_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_get.log apt_get_err.log
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Check stackit cli version
|
||||
id: stackit_version
|
||||
run: |
|
||||
set -e
|
||||
VERSION=$(stackit --version | grep "Version:" | cut -d " " -f 2)
|
||||
echo "stackit cli version: ${VERSION}"
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Creating service_account file from json input
|
||||
if: inputs.service_account_json_content != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::create service account file"
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo "${{ inputs.service_account_json_content }}" > .svc_acc.json
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Creating service_account file from base64 json input
|
||||
if: inputs.service_account_json_content_b64 != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::create service account file"
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo "${{ inputs.service_account_json_content_b64 }}" | base64 -d > .svc_acc.json
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Check service account file exists
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
if [[ ! -s .svc_acc.json ]]; then
|
||||
echo "ERROR: service account file missing or empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Retrieve resources
|
||||
id: resource_lister
|
||||
run: |
|
||||
set -e
|
||||
STACKIT_SERVICE_ACCOUNT_KEY_PATH="${PWD}/.svc_acc.json"
|
||||
export STACKIT_SERVICE_ACCOUNT_KEY_PATH
|
||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
RES_JSON=$(stackit --project-id "${{ inputs.project_id }}" beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
|
||||
echo "resources=$(echo $RES_JSON)" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: List resources
|
||||
run: |
|
||||
set -e
|
||||
echo "${{ steps.resource_lister.outputs.resources }} | jq -r "
|
||||
shell: bash
|
||||
|
||||
- name: Delete SQL Server Flex resources
|
||||
if: ${{ inputs.list_only != 'true' }}
|
||||
run: |
|
||||
set -e
|
||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
for s in $(stackit --project-id ${{ inputs.project_id }} beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("tf-acc-")) | .id'); do stackit -y --project-id ${{ inputs.project_id }} beta sqlserverflex instance delete $s; done
|
||||
shell: bash
|
||||
|
||||
- name: Delete PostgreSQL Flex resources
|
||||
if: ${{ inputs.list_only != 'true' }}
|
||||
run: |
|
||||
set -e
|
||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
for s in $(stackit --project-id ${{ inputs.project_id }} postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("tf-acc-")) | .id'); do stackit -y --project-id ${{ inputs.project_id }} postgresflex instance delete $s; done
|
||||
shell: bash
|
||||
Loading…
Add table
Add a link
Reference in a new issue