-
Notifications
You must be signed in to change notification settings - Fork 251
/
Copy pathepac-dev-pipeline.yml
94 lines (85 loc) · 3.16 KB
/
epac-dev-pipeline.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
parameters:
- name: additionalPacEnvironmentsToPlan
type: object
default:
- nonprod
- prod
variables:
# This pipeline is used to deploy Policies, Initiative definitions and Assignments into Azure.
PAC_OUTPUT_FOLDER: ./Output
PAC_DEFINITIONS_FOLDER: ./Definitions
# Use the plain text name of each service connection as a reference
planServiceConnection: "sc-epac-plan"
devServiceConnection: "sc-epac-dev"
# set the environment selector
pacEnvironmentSelector: epac-dev
# what to build trigger
trigger:
branches:
include:
- feature/*
paths:
include:
- Definitions
- Pipelines
pr: none
pool:
vmImage: "ubuntu-latest"
stages:
- stage: Plan
displayName: "Plan ${{ variables.pacEnvironmentSelector }}"
jobs:
- job: Plan
steps:
- template: templates/plan.yml
parameters:
serviceConnection: $(planServiceConnection)
pacEnvironmentSelector: ${{ variables.pacEnvironmentSelector }}
- stage: Deploy
displayName: "Deploy ${{ variables.pacEnvironmentSelector }}"
dependsOn: Plan
condition: and(not(failed()), not(canceled()), or(eq(dependencies.Plan.outputs['Plan.Plan.deployPolicyChanges'], 'yes'), eq(dependencies.Plan.outputs['Plan.Plan.deployRoleChanges'], 'yes')))
variables:
PAC_INPUT_FOLDER: "$(Pipeline.Workspace)/plans-${{ variables.pacEnvironmentSelector }}"
localDeployPolicyChanges: $[stageDependencies.Plan.Plan.outputs['Plan.deployPolicyChanges']]
localDeployRoleChanges: $[stageDependencies.Plan.Plan.outputs['Plan.deployRoleChanges']]
jobs:
- deployment: DeployPolicy
displayName: "Deploy Policy Changes"
environment: PAC-DEV
condition: and(not(failed()), not(canceled()), eq(variables.localDeployPolicyChanges, 'yes'))
strategy:
runOnce:
deploy:
steps:
- template: templates/deploy-policy.yml
parameters:
serviceConnection: $(devServiceConnection)
pacEnvironmentSelector: ${{ variables.pacEnvironmentSelector }}
- deployment: DeployRoles
displayName: "Deploy Role Changes"
dependsOn: DeployPolicy
environment: PAC-DEV
condition: and(not(failed()), not(canceled()), eq(variables.localDeployRoleChanges, 'yes'))
strategy:
runOnce:
deploy:
steps:
- template: templates/deploy-roles.yml
parameters:
serviceConnection: $(devServiceConnection)
pacEnvironmentSelector: ${{ variables.pacEnvironmentSelector }}
- stage: PlanStageTenant
displayName: "Plan Tenant"
dependsOn:
- Deploy
condition: and(not(failed()), not(canceled()))
jobs:
- ${{ each pacEnvironment in parameters.additionalPacEnvironmentsToPlan }}:
- job: Plan${{ pacEnvironment }}
displayName: "Plan ${{ pacEnvironment }}"
steps:
- template: templates/plan.yml
parameters:
serviceConnection: $(planServiceConnection)
pacEnvironmentSelector: ${{ pacEnvironment }}