Deployment stage #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deployment stage | |
| on: | |
| workflow_call: | |
| inputs: | |
| environments: | |
| description: List of environments to deploy to (String array) | |
| required: true | |
| type: string | |
| commit_sha: | |
| description: Commit SHA used to fetch ADO pipeline and docker image | |
| required: true | |
| type: string | |
| pr_number: | |
| description: Pull request number when used in a pull request | |
| required: false | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| environments: | |
| description: List of environments to deploy to (String array) | |
| required: true | |
| type: string | |
| commit_sha: | |
| description: Commit SHA used to fetch ADO pipeline and docker image | |
| required: true | |
| type: string | |
| pr_number: | |
| description: Pull request number when used in a pull request | |
| required: false | |
| type: string | |
| jobs: | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| environment: ${{ fromJson(inputs.environments) }} | |
| max-parallel: 1 | |
| environment: ${{ matrix.environment }} | |
| concurrency: deploy-${{ matrix.environment }}-${{ github.ref }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - uses: azure/login@bbcc074a232a35d7283353c18aabf0de1d557775 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Call deployment pipeline | |
| run: | | |
| # Define common variables | |
| organisation='https://dev.azure.com/nhse-dtos/' | |
| project_name='dtos-cohort-manager' | |
| # Define which tests to run based on the environment | |
| declare -A test_types=( | |
| ["dev"]="smoke_e2e,regression_api,regression_e2e_epic1,regression_e2e_epic2,regression_e2e_epic3" | |
| ["nft"]="smoke_e2e,regression_api,regression_e2e_epic1,regression_e2e_epic2,regression_e2e_epic3" | |
| ["int"]="" | |
| ["sandbox"]="smoke_e2e,regression_api" | |
| ["pre"]="" | |
| ["prod"]="" | |
| ) | |
| parameters='dockerImageTag=${{inputs.commit_sha}} retagImages=false testTypes=[${test_types[matrix.environment]}]' | |
| echo "Starting Azure devops pipeline \"Deploy to Azure - Core ${{ matrix.environment }}\"..." | |
| # RUN_ID=$(az pipelines run \ | |
| # --commit-id ${{inputs.commit_sha}} \ | |
| # --name "Deploy to Azure - Core ${{ matrix.environment }}" \ | |
| # --org "${organisation}" \ | |
| # --project "${project_name}" \ | |
| # --parameters $parameters \ | |
| # --output tsv --query id) | |
| # scripts/bash/wait_ado_pipeline.sh "$RUN_ID" https://dev.azure.com/nhse-dtos "${project_name}" |