Skip to content

Commit

Permalink
Merge pull request #2990 from DFE-Digital/feature/19057-remove-prod-f…
Browse files Browse the repository at this point in the history
…rom-workflow

Removed production PAAS from workflow
  • Loading branch information
temitope777 authored Oct 10, 2023
2 parents 6716d68 + 059b225 commit d329610
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 318 deletions.
131 changes: 12 additions & 119 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,22 +342,18 @@ jobs:

runs-on: ubuntu-latest
outputs:
matrix_environments: ${{ env.MATRIX_ENVIRONMENTS }}
matrix_aks_environments: ${{ env.MATRIX_AKS_ENVIRONMENTS }}
release_tag: ${{steps.tag_version.outputs.pr_number}}
steps:
- name: Set matrix environments (Push to master)
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
echo "MATRIX_ENVIRONMENTS={\"environment\":[\"Production\"]}" >> $GITHUB_ENV
echo "MATRIX_AKS_ENVIRONMENTS={\"environment\":[\"development\",\"staging\",\"production\"]}" >> $GITHUB_ENV
- name: Set matrix environments ( Review)
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
run: |
echo "MATRIX_ENVIRONMENTS={\"environment\":[\"Review\"]}" >> $GITHUB_ENV
echo "MATRIX_AKS_ENVIRONMENTS={\"environment\":[\"review\"]}" >> $GITHUB_ENV
- name: Generate Tag from PR Number
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: tag_version
Expand Down Expand Up @@ -386,89 +382,34 @@ jobs:
RELEASE_ID: ${{ steps.release.outputs.id }}
TOKEN: ${{secrets.GITHUB_TOKEN}}

deployments:
name: Deployments
deployments_aks:
name: Deployments aks
strategy:
max-parallel: 1
matrix: ${{fromJSON(needs.prepare.outputs.matrix_environments)}}
matrix: ${{fromJSON(needs.prepare.outputs.matrix_aks_environments)}}
environment:
name: ${{matrix.environment}}
concurrency: ${{matrix.environment}}_${{github.event.number}}
name: ${{matrix.environment}}_aks
concurrency: ${{matrix.environment}}_${{github.event.number}}_aks
needs: [ prepare ]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
uses: actions/checkout@v3

- name: set-up-environment
uses: DFE-Digital/github-actions/set-up-environment@master

- name: Set environment variable
run: |
REFERENCE=${{github.ref}}
echo "REFERENCE=${REFERENCE}" >> $GITHUB_ENV
- name: Install Cloud Foundry
if: matrix.environment == 'Review'
run: |
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf7-cli
- name: Set Review specific variables
if: matrix.environment == 'Review'
run: |
REFERENCE=${{github.event.pull_request.head.ref}}
echo "REFERENCE=${REFERENCE}" >> $GITHUB_ENV
- uses: Azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: DfE-Digital/keyvault-yaml-secret@v1
id: keyvault-yaml-secret
with:
keyvault: ${{ secrets.KEY_VAULT}}
secret: SE-INFRA-SECRETS
key: SLACK-WEBHOOK , SLACK-RELEASE-NOTE-WEBHOOK , PAAS-USERNAME , PAAS-PASSWORD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Cloud Foundry
if: matrix.environment == 'Review'
run: cf login -a api.london.cloud.service.gov.uk -u ${{steps.keyvault-yaml-secret.outputs.PAAS-USERNAME}} -p "${{steps.keyvault-yaml-secret.outputs.PAAS-PASSWORD}}" -s get-into-teaching

- name: Get Static Route
if: matrix.environment == 'Review'
run: |
cf delete-orphaned-routes -f
STATIC_ROUTE=$( ${GITHUB_WORKSPACE}/script/get_next_mapping.sh ${{env.REVIEW_APPLICATION}}-${{github.event.number}} )
echo "STATIC_ROUTE=${STATIC_ROUTE}" >> $GITHUB_ENV
- name: Trigger Deployment to ${{matrix.environment}}
if: matrix.environment == 'Review'
uses: ./.github/workflows/actions/deploy
uses: ./.github/workflows/actions/deploy_v2
with:
environment: ${{matrix.environment}}
sha: ${{ github.sha }}
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
pr: ${{github.event.number}}
static: ${{env.STATIC_ROUTE}}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
KEY_VAULT: ${{ secrets.KEY_VAULT }}
ARM_ACCESS_KEY: ${{ secrets.ARM_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Trigger Deployment to ${{matrix.environment}}
if: matrix.environment != 'Review'
uses: ./.github/workflows/actions/deploy
with:
environment: ${{matrix.environment}}
sha: ${{ github.sha }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
KEY_VAULT: ${{ secrets.KEY_VAULT }}
ARM_ACCESS_KEY: ${{ secrets.ARM_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Determine DfE Sign In Message
uses: haya14busa/action-cond@v1
Expand All @@ -481,13 +422,13 @@ jobs:
- name: Post sticky pull request comment
if: matrix.environment == 'Review'
uses: marocchino/sticky-pull-request-comment@v2

with:
recreate: true
header: PAAS
header: AKS
message: |
Review app deployed to https://${{env.REVIEW_APPLICATION}}-${{github.event.number}}.${{env.DOMAIN}}
Review app deployed to https://${{env.AKS_REVIEW_APPLICATION}}-${{github.event.number}}.${{env.REVIEW_AKS_DOMAIN}}
${{ steps.dsiMessage.outputs.value }}
- name: Add Review Label
if: matrix.environment == 'Review' && contains(github.event.pull_request.user.login, 'dependabot') == false
uses: actions-ecosystem/action-add-labels@v1
Expand Down Expand Up @@ -529,58 +470,10 @@ jobs:
SLACK_MESSAGE: Failure with initialising ${{matrix.environment}} deployment for ${{env.APPLICATION}}
SLACK_WEBHOOK: ${{ steps.keyvault-yaml-secret.outputs.SLACK-WEBHOOK }}

deployments_aks:
name: Deployments aks
strategy:
max-parallel: 1
matrix: ${{fromJSON(needs.prepare.outputs.matrix_aks_environments)}}
environment:
name: ${{matrix.environment}}_aks
concurrency: ${{matrix.environment}}_${{github.event.number}}_aks
needs: [ prepare ]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: set-up-environment
uses: DFE-Digital/github-actions/set-up-environment@master

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

- name: Trigger Deployment to ${{matrix.environment}}
uses: ./.github/workflows/actions/deploy_v2
with:
environment: ${{matrix.environment}}
sha: ${{ github.sha }}
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
pr: ${{github.event.number}}

- name: Determine DfE Sign In Message
uses: haya14busa/action-cond@v1
id: dsiMessage
with:
cond: ${{ env.STATIC_ROUTE != '' }}
if_true: ':white_check_mark: DfE sign in route obtained: https://${{env.STATIC_ROUTE}}.london.cloudapps.digital'
if_false: ':warning: **DfE sign in route pool exhausted (close some open PRs!)**'

- name: Post sticky pull request comment
if: matrix.environment == 'Review'
uses: marocchino/sticky-pull-request-comment@v2

with:
recreate: true
header: AKS
message: |
Review app deployed to https://${{env.AKS_REVIEW_APPLICATION}}-${{github.event.number}}.${{env.REVIEW_AKS_DOMAIN}}
${{ steps.dsiMessage.outputs.value }}
owasp:
name: 'OWASP Test'
runs-on: ubuntu-latest
needs: [ deployments ]
needs: [ deployments_aks ]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/database-copy.yml

This file was deleted.

175 changes: 0 additions & 175 deletions .github/workflows/paas_to_aks_db_backup_and_restore_manual.yml

This file was deleted.

Loading

0 comments on commit d329610

Please sign in to comment.