chore: modify test action
[skip ci]
This commit is contained in:
parent
5828ce3a77
commit
a92d0febcd
2 changed files with 40 additions and 4 deletions
42
.github/actions/clean_up/action.yaml
vendored
42
.github/actions/clean_up/action.yaml
vendored
|
|
@ -41,6 +41,14 @@ outputs:
|
|||
description: "stackit cli version"
|
||||
value: ${{ steps.stackit_version.outputs.version }}
|
||||
|
||||
pre_count:
|
||||
description: "number of resources found"
|
||||
value: ${{ steps.retrieve_pre.outputs.count }}
|
||||
|
||||
post_count:
|
||||
description: "number of resources found"
|
||||
value: ${{ steps.retrieve_post.outputs.count }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
|
@ -115,7 +123,8 @@ runs:
|
|||
exit 1
|
||||
fi
|
||||
|
||||
- name: Retrieve resources
|
||||
- name: Retrieve resources before
|
||||
id: retrieve_pre
|
||||
run: |
|
||||
echo "::group::retrieve resources"
|
||||
set -e
|
||||
|
|
@ -125,11 +134,15 @@ runs:
|
|||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
|
||||
echo "SQL Server Flex resources:"
|
||||
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 }}"))'
|
||||
sql_res=$(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 }}"))')
|
||||
sql_count=$(echo "$sql_res" | jq -r '.id' | wc -l)
|
||||
|
||||
echo "PostgreSQL Flex resources:"
|
||||
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 }}"))'
|
||||
pg_res=$(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 }}"))')
|
||||
pg_count=$(echo "$pg_res" | jq -r '.id' | wc -l)
|
||||
|
||||
echo "Number of resources found: ${sql_count} SQL Server Flex, ${pg_count} PostgreSQL Flex"
|
||||
echo "count=$(( ${pg_count} + ${sql_count} ))" >> $GITHUB_OUTPUT
|
||||
echo "::endgroup::"
|
||||
shell: bash
|
||||
|
||||
|
|
@ -166,3 +179,26 @@ runs:
|
|||
set -e
|
||||
echo "Skip deleting: list only mode"
|
||||
shell: bash
|
||||
|
||||
- name: Retrieve resources after
|
||||
id: retrieve_post
|
||||
run: |
|
||||
echo "::group::retrieve resources"
|
||||
set -e
|
||||
echo "authenticating api"
|
||||
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
|
||||
|
||||
echo "SQL Server Flex resources:"
|
||||
sql_res=$(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 }}"))')
|
||||
sql_count=$(echo "$sql_res" | jq -r '.id' | wc -l)
|
||||
|
||||
echo "PostgreSQL Flex resources:"
|
||||
pg_res=$(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 }}"))')
|
||||
pg_count=$(echo "$pg_res" | jq -r '.id' | wc -l)
|
||||
|
||||
echo "Number of resources found: ${sql_count} SQL Server Flex, ${pg_count} PostgreSQL Flex"
|
||||
echo "count=$(( ${pg_count} + ${sql_count} ))" >> $GITHUB_OUTPUT
|
||||
echo "::endgroup::"
|
||||
shell: bash
|
||||
|
|
|
|||
2
.github/workflows/clean_up.yaml
vendored
2
.github/workflows/clean_up.yaml
vendored
|
|
@ -66,7 +66,7 @@ jobs:
|
|||
subtitle: "${{ forgejo.repository }}"
|
||||
event_title: ${{ forgejo.event_name }}
|
||||
event_author: ${{ forgejo.actor }}
|
||||
event_body: "try to remove all resources with prefix ${{ inputs.res_prefix }}"
|
||||
event_body: "count before cleaning: ${{ steps.clean.outputs.pre_count }} <br /> count after cleaning: ${{ steps.clean.outputs.post_count }}"
|
||||
event_number: ${{ forgejo.run_number }}
|
||||
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ forgejo.run_number }}"
|
||||
status: ${{ steps.clean.outcome == 'success' && 'SUCCESS' || 'FAILURE' }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue