|
| 1 | +name: Deployment stage |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + environments: |
| 7 | + description: List of environments to deploy to (String array) |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + commit_sha: |
| 11 | + description: Commit SHA used to fetch ADO pipeline and docker image |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + pr_number: |
| 15 | + description: Pull request number when used in a pull request |
| 16 | + required: false |
| 17 | + type: string |
| 18 | + |
| 19 | + workflow_dispatch: |
| 20 | + inputs: |
| 21 | + environments: |
| 22 | + description: List of environments to deploy to (String array) |
| 23 | + required: true |
| 24 | + type: string |
| 25 | + commit_sha: |
| 26 | + description: Commit SHA used to fetch ADO pipeline and docker image |
| 27 | + required: true |
| 28 | + type: string |
| 29 | + pr_number: |
| 30 | + description: Pull request number when used in a pull request |
| 31 | + required: false |
| 32 | + type: string |
| 33 | + |
| 34 | +jobs: |
| 35 | + deploy: |
| 36 | + name: Deploy |
| 37 | + runs-on: ubuntu-latest |
| 38 | + strategy: |
| 39 | + matrix: |
| 40 | + environment: ${{ fromJson(inputs.environments) }} |
| 41 | + max-parallel: 1 |
| 42 | + environment: ${{ matrix.environment }} |
| 43 | + concurrency: deploy-${{ matrix.environment }}-${{ github.ref }} |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout code |
| 47 | + uses: actions/checkout@v5 |
| 48 | + |
| 49 | + - uses: azure/login@bbcc074a232a35d7283353c18aabf0de1d557775 |
| 50 | + with: |
| 51 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 52 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 53 | + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 54 | + |
| 55 | + - name: Call deployment pipeline |
| 56 | + run: | |
| 57 | + # Define common variables |
| 58 | + organisation='https://dev.azure.com/nhse-dtos/' |
| 59 | + project_name='dtos-cohort-manager' |
| 60 | +
|
| 61 | + # Define which tests to run based on the environment |
| 62 | + declare -A test_types=( |
| 63 | + ["dev"]="smoke_e2e,regression_api,regression_e2e_epic1,regression_e2e_epic2,regression_e2e_epic3" |
| 64 | + ["nft"]="smoke_e2e,regression_api,regression_e2e_epic1,regression_e2e_epic2,regression_e2e_epic3" |
| 65 | + ["int"]="" |
| 66 | + ["sandbox"]="smoke_e2e,regression_api" |
| 67 | + ["pre"]="" |
| 68 | + ["prod"]="" |
| 69 | + ) |
| 70 | +
|
| 71 | + parameters='dockerImageTag=${{inputs.commit_sha}} retagImages=false testTypes=[${test_types[matrix.environment]}]' |
| 72 | +
|
| 73 | + echo "Starting Azure devops pipeline \"Deploy to Azure - Core ${{ matrix.environment }}\"..." |
| 74 | + # RUN_ID=$(az pipelines run \ |
| 75 | + # --commit-id ${{inputs.commit_sha}} \ |
| 76 | + # --name "Deploy to Azure - Core ${{ matrix.environment }}" \ |
| 77 | + # --org "${organisation}" \ |
| 78 | + # --project "${project_name}" \ |
| 79 | + # --parameters $parameters \ |
| 80 | + # --output tsv --query id) |
| 81 | +
|
| 82 | + # scripts/bash/wait_ado_pipeline.sh "$RUN_ID" https://dev.azure.com/nhse-dtos "${project_name}" |
0 commit comments