Browse Source

CLDC-4351: only teardown review apps for prs with review apps (#3293)

* CLDC-4351: tear down review apps on label removal OR on pr close for labelled prs

* CLDC-4351: add teardown success comment on unlabel

* CLDC-4351: update deploy comment with teardown process

* CLDC-4351: typo fix

* CLDC-4351: typo fix

* CLDC-4351: typo fix
main
Nat Dean-Lewis 2 days ago committed by GitHub
parent
commit
ff1f306c7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/review_deploy.yml
  2. 27
      .github/workflows/review_teardown_pipeline.yml

2
.github/workflows/review_deploy.yml

@ -55,7 +55,7 @@ jobs:
with:
script: |
const prNumber = context.issue.number;
const msg = `Created review app at https://review.submit-social-housing-data.communities.gov.uk/${prNumber}. Note that the review app will be automatically deprovisioned after 30 days and will need the review app pipeline running again.`;
const msg = `Created review app at https://review.submit-social-housing-data.communities.gov.uk/${prNumber}. Note that the review app will be automatically deprovisioned after 30 days and will need the review app pipeline running again. To tear down the review app entirely, remove the \`review-app\` label or merge/close the PR.`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,

27
.github/workflows/review_teardown_pipeline.yml

@ -7,6 +7,7 @@ on:
pull_request:
types:
- closed
- unlabeled
env:
app_repo_role: arn:aws:iam::815624722760:role/core-application-repo
@ -18,6 +19,9 @@ env:
jobs:
database:
name: Drop database
if: >
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'review-app'))
|| (github.event.action == 'unlabeled' && github.event.label.name == 'review-app')
runs-on: ubuntu-latest
permissions:
id-token: write
@ -54,6 +58,9 @@ jobs:
infra:
name: Teardown review app
if: >
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'review-app'))
|| (github.event.action == 'unlabeled' && github.event.label.name == 'review-app')
needs: [database]
uses: communitiesuk/submit-social-housing-lettings-and-sales-data-infrastructure/.github/workflows/destroy_review_app_infra.yml@main
with:
@ -61,3 +68,23 @@ jobs:
app_repo_role: arn:aws:iam::815624722760:role/core-application-repo
permissions:
id-token: write
comment:
name: Comment on PR
if: github.event.action == 'unlabeled' && github.event.label.name == 'review-app'
needs: [infra]
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'Review app has been torn down. To redeploy, reapply the `review-app` label.',
});

Loading…
Cancel
Save