|
| 1 | +--- |
| 2 | + |
| 3 | +name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r) |
| 4 | +trigger: none |
| 5 | +pr: none |
| 6 | + |
| 7 | +pool: |
| 8 | + #vmImage: ubuntu-latest |
| 9 | + name: private-pool-dev-uks |
| 10 | + |
| 11 | +resources: |
| 12 | + repositories: |
| 13 | + - repository: dtos-devops-templates |
| 14 | + type: github |
| 15 | + name: NHSDigital/dtos-devops-templates |
| 16 | + ref: 8d9323116e7e0442e3f89750df39af27a2e1a4a7 |
| 17 | + endpoint: NHSDigital |
| 18 | + |
| 19 | +parameters: |
| 20 | + - name: terraformActionsAudit |
| 21 | + # This parameter allows the user to run only the plan for testing purposes |
| 22 | + displayName: 'Audit: Apply Terraform Plan' |
| 23 | + type: string |
| 24 | + values: |
| 25 | + - 'PlanOnly' |
| 26 | + - 'Apply' |
| 27 | + default: 'Apply' |
| 28 | + |
| 29 | + - name: dockerImageTag |
| 30 | + # Used to set the Docker image tag via Terraform in the Continuous Deployment settings of function and container apps |
| 31 | + displayName: 'Core: Docker Image Tag' |
| 32 | + type: string |
| 33 | + default: sbrk |
| 34 | + |
| 35 | + - name: retagImages |
| 36 | + # Only required until commit hashes are passed in by calling pipeline, except for the |
| 37 | + # PreProd pipeline which needs to retag images to move them from the Dev ACR to the Prod ACR |
| 38 | + displayName: 'Core: Re-tag Images' |
| 39 | + type: boolean |
| 40 | + default: false |
| 41 | + |
| 42 | + - name: dockerImageReTagFrom |
| 43 | + # Only required until commit hashes are passed in by calling pipeline |
| 44 | + displayName: 'Core: Docker Image Retag from value' |
| 45 | + type: string |
| 46 | + default: development |
| 47 | + |
| 48 | + - name: dockerImageReTagTo |
| 49 | + # Only required until commit hashes are passed in by calling pipeline |
| 50 | + displayName: 'Core: Docker Image Retag to value' |
| 51 | + type: string |
| 52 | + default: sbrk |
| 53 | + |
| 54 | + - name: terraformActionsCore |
| 55 | + # This parameter allows the user to run only the plan for testing purposes |
| 56 | + displayName: 'Core: Apply Terraform Plan' |
| 57 | + type: string |
| 58 | + values: |
| 59 | + - 'PlanOnly' |
| 60 | + - 'Apply' |
| 61 | + default: 'Apply' |
| 62 | + |
| 63 | + - name: testTypes |
| 64 | + type: object |
| 65 | + default: |
| 66 | + - smoke_e2e |
| 67 | + |
| 68 | +variables: |
| 69 | + - name: hostPoolName |
| 70 | + value: private-pool-dev-uks |
| 71 | + - group: SBRK_backend |
| 72 | + - group: SBRK_audit_backend_remote_state |
| 73 | + - group: SBRK_image_pipelines |
| 74 | + - group: SBRK_automation_testing_pipeline |
| 75 | + - group: DEV_hub_backend_remote_state |
| 76 | + - name: TF_VERSION |
| 77 | + value: 1.14.4 |
| 78 | + - name: TF_PLAN_ARTIFACT |
| 79 | + value: tf_plan_core_SANDBOX |
| 80 | + - name: TF_DIRECTORY_CORE |
| 81 | + value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-core |
| 82 | + - name: TF_DIRECTORY_AUDIT |
| 83 | + value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-audit |
| 84 | + - name: ENVIRONMENT |
| 85 | + value: sandbox |
| 86 | + |
| 87 | + |
| 88 | +stages: |
| 89 | + # STAGE 1: AUDIT DEPLOYMENT |
| 90 | + - template: ../templates/cd-infrastructure-audit-common.yaml |
| 91 | + parameters: |
| 92 | + terraformActions: ${{ parameters.terraformActionsAudit }} |
| 93 | + environment: $(ENVIRONMENT) |
| 94 | + |
| 95 | + # STAGE 2: CORE DEPLOYMENT |
| 96 | + - template: ../templates/cd-infrastructure-core-common.yaml |
| 97 | + parameters: |
| 98 | + hostPoolName: $(hostPoolName) |
| 99 | + serviceConnection: $(SERVICE_CONNECTION) |
| 100 | + targetSubscriptionId: $(TF_VAR_TARGET_SUBSCRIPTION_ID_CORE) |
| 101 | + terraformActions: ${{ parameters.terraformActionsCore }} |
| 102 | + tfVarsFile: environments/$(ENVIRONMENT).tfvars |
| 103 | + environment: $(ENVIRONMENT) |
| 104 | + resourceGroupNameSql: $(RESOURCE_GROUP_NAME_SQL) |
| 105 | + databaseManagementJobName: $(DATABASE_MANAGEMENT_JOB_NAME) |
| 106 | + dockerImageTag: ${{ parameters.dockerImageTag }} |
| 107 | + retagImages: ${{ parameters.retagImages }} |
| 108 | + retagImagesFrom: ${{ parameters.dockerImageReTagFrom }} |
| 109 | + retagImagesTo: ${{ parameters.dockerImageReTagTo }} |
| 110 | + slackWebHook: $(SLACK_WEBHOOK_URL_WORKFLOWS) |
| 111 | + |
| 112 | + - ${{ each testType in parameters.testTypes }}: |
| 113 | + - stage: ${{ testType }}_stage |
| 114 | + displayName: "Core: Run ${{ testType }} Tests" |
| 115 | + condition: always() |
| 116 | + jobs: |
| 117 | + - job: ${{ testType }}_job |
| 118 | + pool: |
| 119 | + name: $(hostPoolName) |
| 120 | + steps: |
| 121 | + - template: .azuredevops/templates/steps/run-post-deployment-pw-tests.yaml@dtos-devops-templates |
| 122 | + parameters: |
| 123 | + serviceConnection: $(SERVICE_CONNECTION) |
| 124 | + testProjectDirectory: "tests/playwright-tests" |
| 125 | + testfileDirectory: "src/tests/e2e/testFiles" |
| 126 | + testProjectName: "tests" |
| 127 | + testType: ${{ testType }} |
0 commit comments