-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.sds.master-release.yml
161 lines (146 loc) · 7.19 KB
/
azure-pipelines.sds.master-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: $(Date:yyyyMMddHHmm)-$(Rev:r)
trigger:
- master
pr: none
resources:
repositories:
- repository: azTemplates
type: github
name: hmcts/azure-devops-templates
ref: master
endpoint: hmcts
parameters:
- name: stages
type: object
default:
- env: 'dev'
buildPushImage: true
pushHelmChart: true
- env: 'demo'
requireApproval: true
buildPushImage: true
pushHelmChart: false
- env: 'test'
requireApproval: true
buildPushImage: true
pushHelmChart: false
pool:
vmImage: ubuntu-22.04
stages:
#####################################################
# CI Build Tasks. ###################################
- stage: CI_Build
dependsOn: []
variables:
- template: variables/shared.yaml
displayName: Test & Sonar
jobs:
- job: UnitAndIntegrationTests
displayName: 'Unit and Integration Tests'
steps:
- checkout: self
- template: templates/dotnet/build-test-analyse.yml@azTemplates
parameters:
dotnetVersion: ${{ variables.dotnetVersion }}
nugetConfigPath: nuget.config
appName: ${{ variables.appName }}
dockerComposeTestFile: docker-compose.tests.yml
publishNodeTests: true
nodeTestResultFolder: $(System.DefaultWorkingDirectory)/VideoWeb/VideoWeb/ClientApp
sonarExtraProperties: |
sonar.exclusions=**/node_modules/**, **/*.spec.ts, *.spec.ts, **/ClientApp/src/*, **/ClientApp/coverage/**/**, **/ConfigureServicesExtensions.cs, **/Startup.cs, **/Program.cs, **/ClientApp/src/scripts/*.js, **/VideoWeb/VideoWeb.AcceptanceTests/Videos/**.y4m, **/ClientApp/src/scripts/**, **/ClientApp/src/app/testing/**, **/ClientApp/src/app/sass/**,
sonar.typescript.exclusions=**/node_modules/**, **/typings.d.ts, **/main.ts,**/environments/environment*.ts, **/*routing.module.ts, **/api-client.ts, **/app-insights-logger.service.ts
sonar.coverage.exclusions=**/Testing.Common/**, VideoWeb/Views/*, VideoWeb/Pages/*, VideoWeb.AcceptanceTests/*, **/VideoWeb.UnitTests/**, **/VideoWeb.Common/**, **/VideoWeb/Swagger/**, **/VideoWeb/Extensions/**, **/ClientApp/src/scripts/**, **/ClientApp/src/app/testing/**, **/ClientApp/src/app/vh-officer/helper.ts, **/ClientApp/src/app/services/events.service.ts, **/ClientApp/src/app/services/api/video-web.service.ts, **/ClientApp/src/app/waiting-space/analogue-clock/analogue-clock.component.ts, **/app-insights-logger.service.ts,**/video-filter.service.ts, **/video-filter.service.ts, **/audio-only-image.service.ts
sonar.cs.opencover.reportsPaths=$(System.DefaultWorkingDirectory)/coverage.opencover.xml
sonar.javascript.lcov.reportPaths=**/ClientApp/coverage/lcov.info
sonar.cpd.exclusions=**/tests/WRTestComponent.ts, **/joh-waiting-room/**, **/ClientApp/src/scripts/**
sonar.issue.ignore.multicriteria=e1, e2, e3, e4, e5, e6
sonar.issue.ignore.multicriteria.e1.ruleKey=typescript:S107
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.ts
sonar.issue.ignore.multicriteria.e2.ruleKey=typescript:S1874
sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.ts
sonar.issue.ignore.multicriteria.e3.ruleKey=typescript:S6544
sonar.issue.ignore.multicriteria.e3.resourceKey=**/*.ts
sonar.issue.ignore.multicriteria.e4.ruleKey=csharpsquid:S107
sonar.issue.ignore.multicriteria.e4.resourceKey=**/*.cs
sonar.issue.ignore.multicriteria.e5.ruleKey=typescript:S6861
sonar.issue.ignore.multicriteria.e5.resourceKey=**/tests/**/*.ts
sonar.issue.ignore.multicriteria.e6.ruleKey=typescript:S2933
sonar.issue.ignore.multicriteria.e6.resourceKey=**/*.ts
#####################################################
# Manual Approval ###################################
- ${{ each stage in parameters.stages }}:
- stage: Manual_Approval_${{ stage.env }}
displayName: Approval ${{ stage.env }}
condition: eq('${{ stage.requireApproval }}', true)
jobs:
- job: Approve
displayName: 'Approve to ${{ stage.env }}'
pool: server
timeoutInMinutes: 10080 # 7 Days
steps:
- task: ManualValidation@0
timeoutInMinutes: 10080 # 7 Days
inputs:
instructions: 'Please Approve run to ${{ stage.env }}'
onTimeout: 'reject'
#####################################################
# Build Docker Image & Push. ########################
- ${{ if eq(stage.buildPushImage, true) }}:
- stage: Docker_Build_Push_${{ stage.env }}
displayName: Build & Push ${{ stage.env }}
dependsOn:
- ${{ if stage.requireApproval }}:
- Manual_Approval_${{ stage.env }}
variables:
- template: variables/${{ stage.env }}.yaml
- template: variables/shared.yaml
jobs:
- job: Docker_Build_${{ stage.env }}
displayName: Docker Build and Push ${{ stage.env }}
steps:
- checkout: self
- bash: |
sed -i "s|</configuration>|<packageSourceCredentials><vh-packages><add key=\"Username\" value=\"PAT\" /><add key=\"ClearTextPassword\" value=\"$(System.AccessToken)\" /></vh-packages></packageSourceCredentials></configuration>|" nuget.config
displayName: Add NuGet Feed Authentication
workingDirectory: $(app_path)
- template: templates\Containerisation\docker\docker-compose.yaml@azTemplates
parameters:
azureSubscription: ${{ variables.acrSubscription }}
acrName: ${{ variables.acrName }}
repositoryName: ${{ variables.repositoryName }}
- template: templates\Containerisation\docker\docker-push-azure.yaml@azTemplates
parameters:
azureSubscription: ${{ variables.acrSubscription }}
acrName: ${{ variables.acrName }}
repositoryName: ${{ variables.repositoryName }}
imageName: "${{ variables.imageName }}"
imageTags:
- '${{ variables.imageTagName }}'
#########################################
# Push Helm Charts to Repo. #############
- ${{ if eq(stage.pushHelmChart, true) }}:
- stage: Helm_${{ stage.env }}
displayName: Push Helm Charts ${{ stage.env }}
dependsOn: Docker_Build_Push_${{ stage.env }}
variables:
- template: variables/dev.yaml
- template: variables/shared.yaml
- group: vh-github-app-credentials
jobs:
- job: Helm_${{ stage.env }}
displayName: Helm Push ${{ stage.env }}
steps:
- checkout: self
- template: templates\Github\get-app-token.yaml@azTemplates
parameters:
privateKeyFileName: ${{ variables.gh_app_private_key_file_name }}
appId: $(gh_app_app_id)
- template: templates\Github\push-to-helm-chart-repo.yaml@azTemplates
parameters:
chartName: ${{ variables.chartName }}
chartPath: ${{ variables.chartPath }}
githubToken: $(githubappinstall.token)
githubUsername: $(gh_app_name)
githubEmail: "$(gh_app_app_id)+$(gh_app_name)[bot]@users.noreply.github.com"
subDirectory: ${{ variables.subDirectory }}