Browse Source

CLDC-4236: Deploy review apps manually using PR labels (#3238)

* CLDC-4263: implement minimal label-based approach

* CLDC-4263: add descriptive comment

* CLDC-4263: separate comment workflow

* CLDC-4263: add label check to code workflow

* CLDC-4263: always hint initially

* CLDC-4263: copy change test

* Revert "CLDC-4263: copy change test"

This reverts commit 09df8ab28f.

* CLDC-4263: rename review app workflows for clarity

* CLDC-4263: remove broken workflow_dispatches

* CLDC-4263: rename label

* CLDC-4236: renaming and commenting
CLDC-4246-re-apply-starter-tenancy-type-copy-updates^2
Nat Dean-Lewis 3 days ago committed by GitHub
parent
commit
d87aba906b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      .github/workflows/production_pipeline.yml
  2. 23
      .github/workflows/review_app_hint.yml
  3. 30
      .github/workflows/review_deploy.yml
  4. 3
      .github/workflows/review_deploy_image_only.yml
  5. 3
      .github/workflows/review_teardown_pipeline.yml

1
.github/workflows/production_pipeline.yml

@ -3,7 +3,6 @@ name: Production CI/CD Pipeline
on: on:
release: release:
types: [released] types: [released]
workflow_dispatch:
defaults: defaults:
run: run:

23
.github/workflows/review_app_hint.yml

@ -0,0 +1,23 @@
name: "Review App: PR Hint Comment"
on:
pull_request:
types: [opened]
jobs:
hint:
name: Add review app hint
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: 'To deploy a review app for this PR, add the `review-app` label.',
});

30
.github/workflows/review_pipeline.yml → .github/workflows/review_deploy.yml

@ -1,4 +1,4 @@
name: Review app pipeline name: "Review App: Deploy"
concurrency: concurrency:
group: review-${{ github.event.pull_request.number }} group: review-${{ github.event.pull_request.number }}
@ -6,9 +6,9 @@ concurrency:
on: on:
pull_request: pull_request:
types: types:
- opened
- synchronize - synchronize
- reopened - reopened
- labeled
workflow_dispatch: workflow_dispatch:
defaults: defaults:
@ -18,6 +18,7 @@ defaults:
jobs: jobs:
infra: infra:
name: Deploy review app infrastructure name: Deploy review app infrastructure
if: contains(github.event.pull_request.labels.*.name, 'review-app')
uses: communitiesuk/submit-social-housing-lettings-and-sales-data-infrastructure/.github/workflows/create_review_app_infra.yml@main uses: communitiesuk/submit-social-housing-lettings-and-sales-data-infrastructure/.github/workflows/create_review_app_infra.yml@main
with: with:
key: ${{ github.event.pull_request.number }} key: ${{ github.event.pull_request.number }}
@ -27,6 +28,7 @@ jobs:
code: code:
name: Deploy review app code name: Deploy review app code
if: contains(github.event.pull_request.labels.*.name, 'review-app')
needs: [infra] needs: [infra]
uses: ./.github/workflows/aws_deploy.yml uses: ./.github/workflows/aws_deploy.yml
with: with:
@ -40,6 +42,7 @@ jobs:
comment: comment:
name: Add link to PR name: Add link to PR
if: contains(github.event.pull_request.labels.*.name, 'review-app')
needs: [code] needs: [code]
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
@ -48,10 +51,21 @@ jobs:
steps: steps:
- name: Comment on PR with URL - name: Comment on PR with URL
uses: unsplash/comment-on-pr@v1.3.0 uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
msg: "Created review app at https://review.submit-social-housing-data.communities.gov.uk/${{ github.event.pull_request.number }}. Note that the review app will be automatically deprovisioned after 30 days and will need the review app pipeline running again." script: |
check_for_duplicate_msg: true const prNumber = context.issue.number;
duplicate_msg_pattern: Created review app at* 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 { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
if (!comments.find(c => c.body.startsWith('Created review app at'))) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: msg,
});
}

3
.github/workflows/manual_review_code_pipeline.yml → .github/workflows/review_deploy_image_only.yml

@ -1,4 +1,5 @@
name: Manual review app code pipeline # Pushes the Docker image to a review app, for use when the ECS image has expired.
name: "Review App: Deploy (ECS Image only)"
concurrency: concurrency:
group: review-${{ inputs.review_app_key }} group: review-${{ inputs.review_app_key }}

3
.github/workflows/review_teardown_pipeline.yml

@ -1,4 +1,4 @@
name: Review app teardown pipeline name: "Review App: Teardown"
concurrency: concurrency:
group: review-${{ github.event.pull_request.number }} group: review-${{ github.event.pull_request.number }}
@ -7,7 +7,6 @@ on:
pull_request: pull_request:
types: types:
- closed - closed
workflow_dispatch:
env: env:
app_repo_role: arn:aws:iam::815624722760:role/core-application-repo app_repo_role: arn:aws:iam::815624722760:role/core-application-repo

Loading…
Cancel
Save