This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines-infra.yml
75 lines (65 loc) · 2.27 KB
/
azure-pipelines-infra.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
trigger:
branches:
include:
- refs/tags/*
- master
pr:
- none
resources:
repositories:
- repository: azTemplates
type: github
name: hmcts/azure-devops-templates
ref: refs/heads/master
endpoint: hmcts
parameters:
- name: release
displayName: "Release To"
type: string
default: pull-request
values:
- pull-request
- sbox
- dev
- test
- ithc
- demo
- release
- name: environments
type: object
default:
- sbox
- dev
- test
- ithc
- demo
- stg
- prod
variables:
- group: HMI-APIM-Common
stages:
- template: pipeline/stages/validate.yaml
- ${{ each environment in parameters.environments }}:
- ${{ if or(and(eq(environment, 'sbox'), eq(parameters.release, 'sbox')),and(eq(environment, 'dev'), eq(parameters.release, 'dev')),and(eq(environment, 'test'), eq(parameters.release, 'test')),and(eq(environment, 'ithc'), eq(parameters.release, 'ithc')),and(eq(environment, 'demo'), eq(parameters.release, 'demo')),and(or(eq(environment, 'stg'),eq(environment, 'prod')), eq(parameters.release, 'release'))) }}:
- ${{ if or(and(ne(environment, 'stg'), ne(environment, 'prod'), ne(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), True)), and(or(eq(environment, 'stg'), eq(environment, 'prod')), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) ) }}:
- template: pipeline/stages/plan.yaml
parameters:
environment: ${{ environment }}
subscription: DTS-SHAREDSERVICES-${{ upper(environment) }}
${{ if eq(environment, 'prod') }}:
dependsOn: Buildstg
${{ else }}:
dependsOn: Validate
- ${{ if eq(environment, 'prod') }}:
- template: pipeline/stages/wait.yaml
parameters:
environment: ${{ environment }}
dependsOn: Plan${{ environment }}
- template: pipeline/stages/apply.yaml
parameters:
environment: ${{ environment }}
subscription: DTS-SHAREDSERVICES-${{ upper(environment) }}
${{ if eq(environment, 'prod') }}:
dependsOn: Wait${{ environment }}
${{ else }}:
dependsOn: Plan${{ environment }}