-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipelines.yaml
64 lines (54 loc) · 2.17 KB
/
azure-pipelines.yaml
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
trigger:
- master
pr:
- master
schedules:
- cron: "0 17 * * 1"
displayName: Weekly Pipeline Schedule
branches:
include:
- master
always: true
resources:
repositories:
- repository: azTemplates
type: github
name: hmcts/azure-devops-templates
ref: master
endpoint: hmcts
parameters:
- name: envs
displayName: Environments
type: object
values: ['sbox','stg','prod']
default: ['sbox']
variables:
- template: ./pipeline/variables/variables-common.yaml
stages:
- template: pipeline/stages/build.yaml
- ${{each env in parameters.envs}}:
- template: pipeline/stages/plan.yaml
parameters:
env: ${{env}}
${{ if and(ne(env, 'prod') , contains(lower(variables['Build.SourceBranch']), lower(variables.release_branch_prefix))) }}:
runStage: 'false'
${{ if and(eq(env, 'stg'), eq(contains(lower(variables['Build.SourceBranch']), lower(variables.release_branch_prefix)), False )) }}: # stg env + not release
runStage: 'true'
dependsOnEnv: 'sbox'
${{ if and(eq(env, 'prod'), eq(contains(lower(variables['Build.SourceBranch']), lower(variables.release_branch_prefix)), False )) }}: # prod env + not release
runStage: 'true'
dependsOnEnv: 'stg'
- template: pipeline/stages/deploy.yaml
parameters:
env: ${{env}}
${{ if and(eq(env, 'prod'), contains(lower(variables['Build.SourceBranch']), lower(variables.release_branch_prefix))) }}: # prod + not release
runStage: 'true'
${{ if and(ne(env, 'prod'), eq(contains(lower(variables['Build.SourceBranch']), lower(variables.release_branch_prefix)), False )) }}: # not prod + not release
runStage: 'true'
- template: pipeline/stages/test.yaml
parameters:
env: ${{env}}
${{ if and(eq(env, 'prod'), contains(lower(variables['Build.SourceBranch']), lower(variables.release_branch_prefix))) }}: # prod + release
runStage: 'true'
${{ if and(ne(env, 'prod'), eq(contains(lower(variables['Build.SourceBranch']), lower(variables.release_branch_prefix)), False )) }}: # not prod + not release
runStage: 'true'