From 98a41508f2c4e5e9928aac53f5b1f11605bffd22 Mon Sep 17 00:00:00 2001 From: Aaron Williams Date: Tue, 7 Nov 2023 15:55:54 +0000 Subject: [PATCH 1/2] Update tag version generation to be unified * Making the tagging version match with the image version referenced +ref: FS-3718 +semver: minor --- .github/workflows/copilot_deploy.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/copilot_deploy.yml b/.github/workflows/copilot_deploy.yml index 7ab9e0f3..96128945 100644 --- a/.github/workflows/copilot_deploy.yml +++ b/.github/workflows/copilot_deploy.yml @@ -35,6 +35,15 @@ on: - '.github/workflows/copilot_deploy.yml' jobs: + tag_version: + runs-on: ubuntu-latest + outputs: + version_to_tag: ${{ steps.notification_tagging.outputs.tag_value }} + steps: + - id: notification_tagging + run: | + echo "tag_value=$(echo '${{ github.ref }}' | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_OUTPUT + pre_deploy_tests: secrets: E2E_PAT: ${{ secrets.E2E_PAT }} @@ -44,12 +53,13 @@ jobs: postgres_unit_testing: false paketo_build: + needs: [ tag_version ] concurrency: build-notification-pack permissions: packages: write uses: communitiesuk/funding-service-design-workflows/.github/workflows/package.yml@main with: - version_to_build: $(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + version_to_build: ${{ needs.tag_version.outputs.version_to_tag }} owner: ${{ github.repository_owner }} application: funding-service-design-notification @@ -73,7 +83,7 @@ jobs: permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout - needs: [ pre_deploy_tests, paketo_build, copilot_environments_workflow_setup ] + needs: [ tag_version, pre_deploy_tests, paketo_build, copilot_environments_workflow_setup ] runs-on: ubuntu-latest strategy: matrix: @@ -106,7 +116,7 @@ jobs: - name: Inject replacement image into manifest run: | - yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-notification:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}"' copilot/fsd-notification/manifest.yml + yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-notification:${{ github.ref_name == 'main' && 'latest' || needs.tag_version.outputs.version_to_tag }}"' copilot/fsd-notification/manifest.yml - name: Copilot ${{ matrix.value }} deploy id: deploy_build @@ -114,7 +124,7 @@ jobs: copilot svc deploy --env ${{ matrix.value }} --app pre-award post_deploy_tests: - if: inputs.environment == 'test' || inputs.environment == '' + if: inputs.environment == 'test' || inputs.environment == 'dev' || inputs.environment == '' needs: copilot_environments_deploy secrets: E2E_PAT: ${{secrets.E2E_PAT}} @@ -123,3 +133,4 @@ jobs: run_performance_tests: ${{ inputs.run_performance_tests }} run_e2e_tests: ${{ inputs.run_e2e_tests }} app_name: notification + environment: ${{ inputs.environment == '' && 'test' || inputs.environment }} From 4910de290c6f758527b232dba8f8b53ede478618 Mon Sep 17 00:00:00 2001 From: Aaron Williams Date: Wed, 8 Nov 2023 09:57:49 +0000 Subject: [PATCH 2/2] Adding extra parameters to job * The matrix job treats parallelisation weird - to resolve, run one step of the matrix job at a time * Make sure that if a previous environment fails it doesn't cascade * Added in concurrency group +ref: FS-3718 +semver: minor --- .github/workflows/copilot_deploy.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/copilot_deploy.yml b/.github/workflows/copilot_deploy.yml index 96128945..c0d4d026 100644 --- a/.github/workflows/copilot_deploy.yml +++ b/.github/workflows/copilot_deploy.yml @@ -70,7 +70,7 @@ jobs: steps: - id: copilot_env_matrix run: | - if [ "${{ inputs.environment }}" != '' ]; then + if [ "${{ inputs.environment }}" != "" ]; then echo "env_list=[\"${{ inputs.environment }}\"]" >> $GITHUB_OUTPUT elif [ "${{ github.ref }}" == 'refs/heads/main' ]; then echo "env_list=[\"dev\", \"test\", \"uat\", \"production\"]" >> $GITHUB_OUTPUT @@ -78,16 +78,21 @@ jobs: echo "env_list=[\"dev\", \"test\"]" >> $GITHUB_OUTPUT fi - copilot_environments_deploy: - concurrency: notification-environment-deploy + copilot_env_deploy: + concurrency: + group: '${{ github.workflow }} @ ${{ github.ref }}' + cancel-in-progress: false permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout needs: [ tag_version, pre_deploy_tests, paketo_build, copilot_environments_workflow_setup ] runs-on: ubuntu-latest + continue-on-error: true strategy: + max-parallel: 1 matrix: value: ${{ fromJSON(needs.copilot_environments_workflow_setup.outputs.matrix) }} + fail-fast: false environment: ${{ matrix.value }} steps: - name: Git clone the repository @@ -125,12 +130,12 @@ jobs: post_deploy_tests: if: inputs.environment == 'test' || inputs.environment == 'dev' || inputs.environment == '' - needs: copilot_environments_deploy + needs: copilot_env_deploy secrets: E2E_PAT: ${{secrets.E2E_PAT}} uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main with: - run_performance_tests: ${{ inputs.run_performance_tests }} - run_e2e_tests: ${{ inputs.run_e2e_tests }} + run_performance_tests: ${{ inputs.run_performance_tests || false }} + run_e2e_tests: ${{ inputs.run_e2e_tests || true }} app_name: notification environment: ${{ inputs.environment == '' && 'test' || inputs.environment }}