From 0be4f00b5a95a45e12193e752a300aed6d05c087 Mon Sep 17 00:00:00 2001 From: Andrew Newton Date: Fri, 25 Oct 2024 11:16:50 +0100 Subject: [PATCH] ci: Make deployment status explicit for test step trigger debug --- .github/workflows/cd.yaml | 1 + .github/workflows/deploy-environment.yaml | 19 +++++++++++++++++++ app/internal/.gitignore | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 444de5fa4b..f08dfc9f3c 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -297,6 +297,7 @@ jobs: test_dev: name: Run Tests on DEV + if: ${{ needs.terraform_env_dev.outputs.deploy_success == 'true' }} needs: - terraform_env_dev uses: dvsa/vol-functional-tests/.github/workflows/e2eSmoke.yaml@main diff --git a/.github/workflows/deploy-environment.yaml b/.github/workflows/deploy-environment.yaml index 650c976ea7..7874fb057d 100644 --- a/.github/workflows/deploy-environment.yaml +++ b/.github/workflows/deploy-environment.yaml @@ -84,6 +84,9 @@ on: terraform-output: description: "Terraform output" value: ${{ jobs.deploy.outputs.terraform-output }} + deploy_success: + description: "Whether the deployment succeeded" + value: ${{ jobs.deploy.outputs.deploy_success }} previous_api_image_tag: description: "Previous API image tag" value: ${{ jobs.deploy.outputs.previous_api_image_tag }} @@ -118,6 +121,7 @@ jobs: environment: name: ${{ (inputs.apply && !inputs.destroy) && (inputs.workspace || inputs.environment) || null }} outputs: + deploy_success: ${{ steps.deployment-status.outputs.success }} terraform-output: ${{ steps.terraform-output.outputs.json }} previous_api_image_tag: ${{ steps.get_current_versions.outputs.api_image_tag }} previous_cli_image_tag: ${{ steps.get_current_versions.outputs.cli_image_tag }} @@ -293,6 +297,21 @@ jobs: TF_VAR_assets_version: ${{ inputs.assets-version }} run: terraform apply ${{ inputs.destroy && '-destroy ' || '' }} -no-color -input=false -auto-approve ${{ inputs.terraform-args || '' }} + - name: Record Deployment Status + id: deployment-status + if: ${{ always() }} + run: | + if [[ "${{ inputs.apply }}" == "true" ]]; then + if [[ "${{ steps.apply.outcome }}" == "success" ]]; then + echo "success=true" >> $GITHUB_OUTPUT + else + echo "success=false" >> $GITHUB_OUTPUT + fi + else + # If this was just a plan, consider it successful + echo "success=true" >> $GITHUB_OUTPUT + fi + - name: Delete workspace if: ${{ inputs.apply && inputs.destroy && inputs.workspace }} run: terraform workspace select default && terraform workspace delete ${{ inputs.workspace }} diff --git a/app/internal/.gitignore b/app/internal/.gitignore index feda3ae399..81886e022f 100644 --- a/app/internal/.gitignore +++ b/app/internal/.gitignore @@ -27,5 +27,5 @@ phpcs.xml phpstan.neon phpunit.xml psalm.xml -# Trigger CD - 2024-10-25-1020 +# Trigger CD - 2024-10-25-1115