This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.sds.release.yml
110 lines (94 loc) · 4 KB
/
azure-pipelines.sds.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
name: $(Date:yyyyMMddHHmm)-$(Rev:r)
trigger: none
pr: none
resources:
repositories:
- repository: azTemplates
type: github
name: hmcts/azure-devops-templates
ref: master
endpoint: hmcts
pool:
vmImage: ubuntu-22.04
stages:
#####################################################
# Approval Gate for Test Web Release. ###############
- ${{ if contains(variables['Build.SourceBranch'], 'refs/heads/release') }}:
- stage: Approve_Helm_Release
displayName: "Approve Helm Release"
jobs:
- job: waitForValidation
displayName: "Approve Helm Release"
pool: server
timeoutInMinutes: 4320 # job times out in 3 days
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
instructions: "Please Approve for Helm Release..."
onTimeout: "reject"
#####################################################
# Build Docker Image & Push. ########################
- stage: Docker_Build_Push
displayName: Docker Build & Push Image
variables:
- ? ${{ if contains(variables['Build.SourceBranch'], 'refs/heads/release') }}
: - template: variables/production.yaml
- ${{ else }}:
- template: variables/staging.yaml
- template: variables/shared.yaml
jobs:
- job: Docker_Build
displayName: "Docker Build and Push"
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.sds.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:
- ${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
- "${{ variables.stagingTagName }}"
- ? ${{ if contains(variables['Build.SourceBranch'], 'refs/heads/release') }}
: - "latest"
- "${{ variables.releaseTagName }}"
#########################################
# Push Helm Charts to Repo. #############
- stage: Helm
displayName: Push Helm Charts
dependsOn: Docker_Build_Push
variables:
- ? ${{ if contains(variables['Build.SourceBranch'], 'refs/heads/release') }}
: - template: variables/production.yaml
- ${{ else }}:
- template: variables/staging.yaml
- template: variables/shared.yaml
- group: vh-github-app-credentials
jobs:
- job: Helm
displayName: "Helm Push"
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 }}