Skip to content

Commit

Permalink
Update the format of the deployment comment into a table
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitemaeric committed Jan 29, 2024
1 parent 2d140d0 commit 76620c6
Showing 1 changed file with 73 additions and 66 deletions.
139 changes: 73 additions & 66 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ name: Build and deploy to AKS cluster
on:
push:
branches:
- main
- main
pull_request:
branches:
- main

- main

concurrency: deploy-${{ github.ref }}

Expand All @@ -23,65 +22,69 @@ jobs:
docker-image-tag: ${{ steps.build-image.outputs.tag }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build and push docker image
id: build-image
uses: DFE-Digital/github-actions/build-docker-image@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
context: .

deploy_review :
name: Deploy to review environment
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }}
needs: [build]
environment:
name: review
url: ${{ steps.get-app-url.outputs.url1 }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: ./.github/actions/deploy-environment
id: deploy
with:
environment: review
docker-image: ${{ needs.build.outputs.docker-image-tag }}
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
pull-request-number: ${{ github.event.number }}

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Seed Review App
shell: bash
if: github.event.number != ''
run: |
az aks get-credentials -g s189t01-tsc-ts-rg -n s189t01-tsc-test-aks
kubectl exec -n bat-qa deployment/itt-mentor-services-${{ github.event.number }} -- sh -c "export GIAS_CSV_BASE_URL=https://ea-edubase-api-prod.azurewebsites.net/edubase/downloads/public && export PUBLISH_BASE_URL=https://qa.api.publish-teacher-training-courses.service.gov.uk// && cd /app && /usr/local/bin/rake db:seed"
- name: Get application URL
id: get-app-url
shell: bash
run: |
url1="https://track-and-pay-${{ github.event.number }}.test.teacherservices.cloud"
echo "url1=${url1}" >> $GITHUB_OUTPUT
url2="https://manage-school-placements-${{ github.event.number }}.test.teacherservices.cloud"
echo "url2=${url2}" >> $GITHUB_OUTPUT
- name: Post comment to Pull Request ${{ github.event.number }}
if: ${{ github.event_name == 'pull_request' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: aks
message: |
Review app track and pay deployed to <https://track-and-pay-${{ github.event.number }}.test.teacherservices.cloud>
Review app school placements deployed to <https://manage-school-placements-${{ github.event.number }}.test.teacherservices.cloud>
- name: Checkout
uses: actions/checkout@v4

- name: Build and push docker image
id: build-image
uses: DFE-Digital/github-actions/build-docker-image@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
context: .

deploy_review:
name: Deploy to review environment
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }}
needs: [build]
environment:
name: review
url: ${{ steps.get-app-url.outputs.url1 }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: ./.github/actions/deploy-environment
id: deploy
with:
environment: review
docker-image: ${{ needs.build.outputs.docker-image-tag }}
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
pull-request-number: ${{ github.event.number }}

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Seed Review App
shell: bash
if: github.event.number != ''
run: |
az aks get-credentials -g s189t01-tsc-ts-rg -n s189t01-tsc-test-aks
kubectl exec -n bat-qa deployment/itt-mentor-services-${{ github.event.number }} -- sh -c "export GIAS_CSV_BASE_URL=https://ea-edubase-api-prod.azurewebsites.net/edubase/downloads/public && export PUBLISH_BASE_URL=https://qa.api.publish-teacher-training-courses.service.gov.uk// && cd /app && /usr/local/bin/rake db:seed"
- name: Get application URL
id: get-app-url
shell: bash
run: |
url1="https://track-and-pay-${{ github.event.number }}.test.teacherservices.cloud"
echo "url1=${url1}" >> $GITHUB_OUTPUT
url2="https://manage-school-placements-${{ github.event.number }}.test.teacherservices.cloud"
echo "url2=${url2}" >> $GITHUB_OUTPUT
- name: Post comment to Pull Request ${{ github.event.number }}
if: ${{ github.event_name == 'pull_request' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: aks
message: |
### Deployments
| App | URL |
| ----------------- | ---------------------------------------------------------------------------------------- |
| Track & Pay | <https://track-and-pay-${{ github.event.number }}.test.teacherservices.cloud> |
| School Placements | <https://manage-school-placements-${{ github.event.number }}.test.teacherservices.cloud> |
deploy_nonprod:
name: Deploy to ${{ matrix.environment }} environment
Expand Down Expand Up @@ -117,8 +120,8 @@ jobs:
- name: Seed ${{ matrix.environment }}
shell: bash
run: |
az aks get-credentials -g s189t01-tsc-ts-rg -n s189t01-tsc-test-aks
kubectl exec -n bat-qa deployment/itt-mentor-services-${{ matrix.environment }} -- sh -c "export GIAS_CSV_BASE_URL=https://ea-edubase-api-prod.azurewebsites.net/edubase/downloads/public && export PUBLISH_BASE_URL=https://qa.api.publish-teacher-training-courses.service.gov.uk// && cd /app && /usr/local/bin/rake db:seed"
az aks get-credentials -g s189t01-tsc-ts-rg -n s189t01-tsc-test-aks
kubectl exec -n bat-qa deployment/itt-mentor-services-${{ matrix.environment }} -- sh -c "export GIAS_CSV_BASE_URL=https://ea-edubase-api-prod.azurewebsites.net/edubase/downloads/public && export PUBLISH_BASE_URL=https://qa.api.publish-teacher-training-courses.service.gov.uk// && cd /app && /usr/local/bin/rake db:seed"
- name: Get application URL
id: get-app-url
Expand All @@ -135,5 +138,9 @@ jobs:
with:
header: aks
message: |
Review app track and pay deployed to <https://track-and-pay-${{ matrix.environment }}.test.teacherservices.cloud>
Review app school placements deployed to <https://manage-school-placements-${{ matrix.environment }}.test.teacherservices.cloud>
### Deployments
| App | URL |
| ----------------- | ---------------------------------------------------------------------------------------- |
| Track & Pay | <https://track-and-pay-${{ github.event.number }}.test.teacherservices.cloud> |
| School Placements | <https://manage-school-placements-${{ github.event.number }}.test.teacherservices.cloud> |

0 comments on commit 76620c6

Please sign in to comment.