Skip to content

Commit 535de40

Browse files
Merge pull request #111 from communitiesuk/feature/FSPT-220-slack-notification-on-failed-deploys
FSPT-220: Enable Slack notification on failed deploys
2 parents 13b48f7 + a4240ee commit 535de40

File tree

1 file changed

+72
-119
lines changed

1 file changed

+72
-119
lines changed

.github/workflows/copilot_deploy.yml

Lines changed: 72 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -326,40 +326,27 @@ jobs:
326326
fi
327327
328328
dev_deploy:
329-
strategy:
330-
matrix:
331-
include:
332-
- deployment: fsd-form-runner-adapter
333-
command: svc
334-
appname: "form-runner-adapter"
335-
- deployment: fsd-form-designer-adapter
336-
command: svc
337-
appname: "form-designer-adapter"
329+
needs: [ setup, docker-designer-build, docker-runner-build ]
330+
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'dev') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
338331
permissions:
339332
id-token: write # This is required for requesting the JWT
340333
contents: read # This is required for actions/checkout
341-
needs: [ setup, docker-designer-build, docker-runner-build ]
342-
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'dev') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
343-
runs-on: ubuntu-latest
344-
environment: dev
345-
steps:
346-
- name: Git clone the repository
347-
uses: actions/checkout@v4
348-
349-
- name: Setup Copilot
350-
uses: communitiesuk/funding-service-design-workflows/.github/actions/copilot_setup@main
351-
with:
352-
environment: dev
353-
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
354-
355-
- name: Inject env specific values into manifest
356-
run: |
357-
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
358-
yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-${{ matrix.appname }}:sha-${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
359-
360-
- name: Copilot deploy ${{ matrix.deployment }}
361-
run: |
362-
copilot ${{ matrix.command }} deploy --name ${{ matrix.deployment }}
334+
strategy:
335+
matrix:
336+
include:
337+
- appname: "form-runner-adapter"
338+
image_location: ghcr.io/communitiesuk/funding-service-design-form-runner-adapter:sha-${{ github.sha }}
339+
- appname: "form-designer-adapter"
340+
image_location: ghcr.io/communitiesuk/funding-service-design-form-designer-adapter:sha-${{ github.sha }}
341+
uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
342+
secrets:
343+
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
344+
with:
345+
environment: dev
346+
app_name: ${{ matrix.appname }}
347+
run_db_migrations: false
348+
image_location: ${{ matrix.image_location }}
349+
notify_slack: false
363350

364351
post_dev_deploy_tests:
365352
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy ]
@@ -381,42 +368,32 @@ jobs:
381368
run_zap_scan: true
382369
app_name: forms
383370
environment: dev
371+
notify_slack: false
384372

385373
test_deploy:
386-
strategy:
387-
matrix:
388-
include:
389-
- deployment: fsd-form-runner-adapter
390-
command: svc
391-
appname: "form-runner-adapter"
392-
- deployment: fsd-form-designer-adapter
393-
command: svc
394-
appname: "form-designer-adapter"
374+
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, post_dev_deploy_tests ]
375+
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'test') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
395376
permissions:
396377
id-token: write # This is required for requesting the JWT
397378
contents: read # This is required for actions/checkout
398-
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, post_dev_deploy_tests ]
399-
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'test') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
400-
runs-on: ubuntu-latest
401-
environment: test
402-
steps:
403-
- name: Git clone the repository
404-
uses: actions/checkout@v4
405-
406-
- name: Setup Copilot
407-
uses: communitiesuk/funding-service-design-workflows/.github/actions/copilot_setup@main
408-
with:
409-
environment: test
410-
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
411-
412-
- name: Inject env specific values into manifest
413-
run: |
414-
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
415-
yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-${{ matrix.appname }}:sha-${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
416-
417-
- name: Copilot deploy ${{ matrix.deployment }}
418-
run: |
419-
copilot ${{ matrix.command }} deploy --name ${{ matrix.deployment }}
379+
strategy:
380+
matrix:
381+
include:
382+
- appname: "form-runner-adapter"
383+
image_location: ghcr.io/communitiesuk/funding-service-design-form-runner-adapter:sha-${{ github.sha }}
384+
- appname: "form-designer-adapter"
385+
image_location: ghcr.io/communitiesuk/funding-service-design-form-designer-adapter:sha-${{ github.sha }}
386+
uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
387+
secrets:
388+
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
389+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
390+
SLACK_NOTIFICATION_CHANNEL_ID: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}
391+
with:
392+
environment: test
393+
app_name: ${{ matrix.appname }}
394+
run_db_migrations: false
395+
image_location: ${{ matrix.image_location }}
396+
notify_slack: true
420397

421398
post_test_deploy_tests:
422399
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, test_deploy ]
@@ -431,6 +408,8 @@ jobs:
431408
FS_BASIC_AUTH_USERNAME: ${{ secrets.FS_BASIC_AUTH_USERNAME }}
432409
FS_BASIC_AUTH_PASSWORD: ${{ secrets.FS_BASIC_AUTH_PASSWORD }}
433410
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
411+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
412+
SLACK_NOTIFICATION_CHANNEL_ID: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}
434413
uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main
435414
with:
436415
run_performance_tests: ${{ inputs.run_performance_tests || true }}
@@ -440,39 +419,25 @@ jobs:
440419
run_zap_scan: true
441420
app_name: forms
442421
environment: test
443-
422+
notify_slack: true
423+
444424
uat_deploy:
445-
strategy:
446-
matrix:
447-
include:
448-
- deployment: fsd-form-runner-adapter
449-
command: svc
450-
appname: "form-runner-adapter"
425+
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, test_deploy, post_test_deploy_tests ]
426+
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'uat') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
451427
permissions:
452428
id-token: write # This is required for requesting the JWT
453429
contents: read # This is required for actions/checkout
454-
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, test_deploy, post_test_deploy_tests ]
455-
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'uat') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
456-
runs-on: ubuntu-latest
457-
environment: uat
458-
steps:
459-
- name: Git clone the repository
460-
uses: actions/checkout@v4
461-
462-
- name: Setup Copilot
463-
uses: communitiesuk/funding-service-design-workflows/.github/actions/copilot_setup@main
464-
with:
465-
environment: uat
466-
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
467-
468-
- name: Inject env specific values into manifest
469-
run: |
470-
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
471-
yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-${{ matrix.appname }}:sha-${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
472-
473-
- name: Copilot deploy ${{ matrix.deployment }}
474-
run: |
475-
copilot ${{ matrix.command }} deploy --name ${{ matrix.deployment }}
430+
uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
431+
secrets:
432+
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
433+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
434+
SLACK_NOTIFICATION_CHANNEL_ID: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}
435+
with:
436+
environment: uat
437+
app_name: form-runner-adapter
438+
run_db_migrations: false
439+
image_location: ghcr.io/communitiesuk/funding-service-design-form-runner-adapter:sha-${{ github.sha }}
440+
notify_slack: true
476441

477442
post_uat_deploy_tests:
478443
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, test_deploy, uat_deploy ]
@@ -486,6 +451,8 @@ jobs:
486451
FS_BASIC_AUTH_USERNAME: ${{ secrets.FS_BASIC_AUTH_USERNAME }}
487452
FS_BASIC_AUTH_PASSWORD: ${{ secrets.FS_BASIC_AUTH_PASSWORD }}
488453
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
454+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
455+
SLACK_NOTIFICATION_CHANNEL_ID: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}
489456
uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main
490457
with:
491458
run_performance_tests: ${{ inputs.run_performance_tests || true }}
@@ -495,37 +462,23 @@ jobs:
495462
run_zap_scan: true
496463
app_name: forms
497464
environment: uat
465+
notify_slack: true
498466

499467
prod_deploy:
500-
strategy:
501-
matrix:
502-
include:
503-
- deployment: fsd-form-runner-adapter
504-
command: svc
505-
appname: "form-runner-adapter"
468+
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, test_deploy, uat_deploy, post_uat_deploy_tests ]
469+
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'prod') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
506470
permissions:
507471
id-token: write # This is required for requesting the JWT
508472
contents: read # This is required for actions/checkout
509-
needs: [ setup, docker-designer-build, docker-runner-build, dev_deploy, test_deploy, uat_deploy, post_uat_deploy_tests ]
510-
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'prod') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') ) }}
511-
runs-on: ubuntu-latest
512-
environment: prod
513-
steps:
514-
- name: Git clone the repository
515-
uses: actions/checkout@v4
516-
517-
- name: Setup Copilot
518-
uses: communitiesuk/funding-service-design-workflows/.github/actions/copilot_setup@main
519-
with:
520-
environment: prod
521-
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
522-
523-
- name: Inject env specific values into manifest
524-
run: |
525-
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
526-
yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-${{ matrix.appname }}:sha-${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml
527-
528-
- name: Copilot deploy ${{ matrix.deployment }}
529-
run: |
530-
copilot ${{ matrix.command }} deploy --name ${{ matrix.deployment }}
473+
uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
474+
secrets:
475+
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
476+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
477+
SLACK_NOTIFICATION_CHANNEL_ID: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}
478+
with:
479+
environment: prod
480+
app_name: form-runner-adapter
481+
run_db_migrations: false
482+
image_location: ghcr.io/communitiesuk/funding-service-design-form-runner-adapter:sha-${{ github.sha }}
483+
notify_slack: true
531484

0 commit comments

Comments
 (0)