Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAT-18204: fix concurrent runs #156

Merged
merged 17 commits into from
Jul 29, 2024
21 changes: 19 additions & 2 deletions .github/workflows/lth.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: Liquibase Test Harness

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

# static value to the workflow group to ensure only one run of the workflow can be in progress at a time.
concurrency:
group: liquibase-test-harness
cancel-in-progress: false

jobs:
liquibase-test-harness:
name: Liquibase Test Harness
Expand Down Expand Up @@ -72,4 +77,16 @@ jobs:
- name: Stop test database
if: always() # Always destroy, even if the previous steps fail
working-directory: src/test/terraform
run: terraform destroy -auto-approve
run: |
set -e
TERRAFORM_OUTPUT=$(terraform show -json)
if [ -z "$TERRAFORM_OUTPUT" ]; then
echo "Terraform output is empty. Skipping removal."
else
SCHEMA_EXISTS=$(echo $TERRAFORM_OUTPUT | jq -r '.values.root_module.resources[] | select(.address == "databricks_schema.test_harness") | .values.name')
if [ "$SCHEMA_EXISTS" == "liquibase_harness_test_ds" ]; then
terraform destroy -auto-approve
else
echo "Schema does not exist. Skipping removal."
fi
fi
Loading