Skip to content

Commit

Permalink
[NWSDE #12] Update GitHub Actions to disable (1) automatic deploy on …
Browse files Browse the repository at this point in the history
…schedule & push (2) add action to skip e2e tests
  • Loading branch information
jonnyry committed Dec 20, 2024
1 parent 6632ed0 commit 7e454a5
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 10 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/deploy_tre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ name: Deploy Azure TRE
# It also runs on a schedule, serving as the nightly build

on: # yamllint disable-line rule:truthy
schedule:
# midnight every day https://crontab.guru/#0_0_*_*_*
- cron: "0 0 * * *"
push:
branches: [main]
# JR 29-11-2023 Disable push to repo and scheduled deployments (for now)
# schedule:
# # midnight every day https://crontab.guru/#0_0_*_*_*
# - cron: "0 0 * * *"
# push:
# branches: [main]
workflow_dispatch:
inputs:
environment:
Expand All @@ -23,8 +24,9 @@ concurrency: "${{ github.workflow }}-${{ github.ref }}"

jobs:
run-deploy-tre-main:
name: "Deploy main"
if: github.ref == 'refs/heads/main'
name: "Deploy"
# JR 29-11-2023 Disable main branch check - this is now controlled via GitHub environment protection rules (see Settings > Environments)
# if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/deploy_tre_reusable.yml
permissions:
checks: write
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/deploy_tre_no_e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Deploy Azure TRE - skip e2e tests
# This workflow is the integration build run for pushes to the main branch
# It also runs on a schedule, serving as the nightly build

on: # yamllint disable-line rule:truthy
# JR 29-11-2023 Disable push to repo and scheduled deployments (for now)
# schedule:
# # midnight every day https://crontab.guru/#0_0_*_*_*
# - cron: "0 0 * * *"
# push:
# branches: [main]
workflow_dispatch:
inputs:
environment:
description: The environment to run this workflow in
type: environment
default: CICD
required: true

# This will prevent multiple runs of this entire workflow.
# We should NOT cancel in progress runs as that can destabilize the environment.
concurrency: "${{ github.workflow }}-${{ github.ref }}"

jobs:
run-deploy-tre-main:
name: "Deploy"
# JR 29-11-2023 Disable main branch check - this is now controlled via GitHub environment protection rules (see Settings > Environments)
# if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/deploy_tre_reusable.yml
permissions:
checks: write
contents: read
pull-requests: write
with:
ciGitRef: ${{ github.ref }}
e2eTestsCustomSelector: >-
${{ (github.event_name == 'push' && 'extended or extended_aad')
|| 'extended or extended_aad or shared_services or airlock' }}
environmentName: ${{ github.event.inputs.environment || 'CICD' }}
E2E_TESTS_NUMBER_PROCESSES: 1
DEVCONTAINER_TAG: 'latest'
ENABLE_E2E_TESTS: false
secrets:
AAD_TENANT_ID: ${{ secrets.AAD_TENANT_ID }}
ACR_NAME: ${{ secrets.ACR_NAME }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
API_CLIENT_ID: ${{ secrets.API_CLIENT_ID }}
API_CLIENT_SECRET: ${{ secrets.API_CLIENT_SECRET }}
APPLICATION_ADMIN_CLIENT_ID: ${{ secrets.APPLICATION_ADMIN_CLIENT_ID }}
APPLICATION_ADMIN_CLIENT_SECRET: ${{ secrets.APPLICATION_ADMIN_CLIENT_SECRET }}
MGMT_RESOURCE_GROUP_NAME: ${{ secrets.MGMT_RESOURCE_GROUP_NAME }}
MS_TEAMS_WEBHOOK_URI: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
MGMT_STORAGE_ACCOUNT_NAME: ${{ secrets.MGMT_STORAGE_ACCOUNT_NAME }}
SWAGGER_UI_CLIENT_ID: ${{ secrets.SWAGGER_UI_CLIENT_ID }}
TEST_APP_ID: ${{ secrets.TEST_APP_ID }}
TEST_WORKSPACE_APP_ID: ${{ secrets.TEST_WORKSPACE_APP_ID }}
TEST_WORKSPACE_APP_SECRET: "${{ secrets.TEST_WORKSPACE_APP_SECRET }}"
TEST_ACCOUNT_CLIENT_ID: "${{ secrets.TEST_ACCOUNT_CLIENT_ID }}"
TEST_ACCOUNT_CLIENT_SECRET: "${{ secrets.TEST_ACCOUNT_CLIENT_SECRET }}"
TRE_ID: ${{ secrets.TRE_ID }}
CI_CACHE_ACR_NAME: ${{ secrets.ACR_NAME }}
12 changes: 9 additions & 3 deletions .github/workflows/deploy_tre_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ on: # yamllint disable-line rule:truthy
description: ""
type: string
required: true
ENABLE_E2E_TESTS:
description: Flag to enable/disable end-to-end tests. Enabled by default
type: boolean
default: true
required: false
secrets:
AAD_TENANT_ID:
description: ""
Expand Down Expand Up @@ -175,7 +180,7 @@ jobs:
fi
- name: Report check status start
if: inputs.prHeadSha != ''
if: ${{ inputs.ENABLE_E2E_TESTS && (inputs.prHeadSha != '') }}
uses: LouisBrunner/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -723,6 +728,7 @@ jobs:

e2e_tests_smoke:
name: "Run E2E Tests (Smoke)"
if: ${{ inputs.ENABLE_E2E_TESTS }}
runs-on: ubuntu-latest
environment: ${{ inputs.environmentName }}
needs: [deploy_shared_services, register_bundles, deploy_ui]
Expand Down Expand Up @@ -765,7 +771,7 @@ jobs:

e2e_tests_custom:
name: "Run E2E Tests"
if: ${{ inputs.e2eTestsCustomSelector != '' }}
if: ${{ inputs.ENABLE_E2E_TESTS && (inputs.e2eTestsCustomSelector != '') }}
runs-on: ubuntu-latest
environment: ${{ inputs.environmentName }}
needs: [deploy_shared_services, register_bundles, register_user_resource_bundles]
Expand Down Expand Up @@ -814,7 +820,7 @@ jobs:
permissions:
checks: write
contents: read
if: always()
if: ${{ inputs.ENABLE_E2E_TESTS && always() }}
environment: ${{ inputs.environmentName }}
steps:
# - uses: technote-space/workflow-conclusion-action@v3 (removed due to archived repo and deprecated node.js version)
Expand Down

0 comments on commit 7e454a5

Please sign in to comment.