forked from Azure/ResourceModules
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (133 loc) · 4.7 KB
/
ms.authorization.policyexemptions.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
name: 'Authorization: PolicyExemptions'
on:
workflow_dispatch:
inputs:
removeDeployment:
type: boolean
description: 'Remove deployed module'
required: false
default: 'true'
prerelease:
type: boolean
description: 'Publish prerelease module'
required: false
default: 'false'
push:
branches:
- main
paths:
- '.github/actions/templates/**'
- '.github/workflows/ms.authorization.policyexemptions.yml'
- 'arm/Microsoft.Authorization/policyExemptions/**'
- '!*/**/readme.md'
- 'utilities/pipelines/**'
- '!utilities/pipelines/dependencies/**'
env:
modulePath: 'arm/Microsoft.Authorization/policyExemptions'
workflowPath: '.github/workflows/ms.authorization.policyexemptions.yml'
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
ARM_SUBSCRIPTION_ID: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
ARM_MGMTGROUP_ID: '${{ secrets.ARM_MGMTGROUP_ID }}'
ARM_TENANT_ID: '${{ secrets.ARM_TENANT_ID }}'
DEPLOYMENT_SP_ID: '${{ secrets.DEPLOYMENT_SP_ID }}'
jobs:
############################
# SET INPUT PARAMETERS #
############################
job_set_workflow_param:
runs-on: ubuntu-20.04
name: 'Set input parameters to output variables'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Set input parameters'
id: get-workflow-param
uses: ./.github/actions/templates/getWorkflowInput
with:
workflowPath: '${{ env.workflowPath}}'
outputs:
removeDeployment: ${{ steps.get-workflow-param.outputs.removeDeployment }}
####################
# Pester Tests #
####################
job_module_pester_validation:
runs-on: ubuntu-20.04
name: 'Pester tests'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Run tests'
uses: ./.github/actions/templates/validateModulePester
with:
modulePath: '${{ env.modulePath }}'
####################
# Deployment tests #
####################
job_module_deploy_validation:
runs-on: ubuntu-20.04
name: 'Deployment tests'
needs:
- job_set_workflow_param
- job_module_pester_validation
strategy:
fail-fast: false
matrix:
parameterFilePaths: ['parameters.json', 'min.parameters.json']
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set environment variables
uses: deep-mm/[email protected]
with:
# Name of variable file
variableFileName: 'global.variables' # Don't write .json here
# ------------------- #
## Deploy & Remove ##
# ------------------- #
- name: 'Using parameter file [${{ matrix.parameterFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/.bicep/nested_policyExemptions_sub.bicep'
parameterFilePath: '${{ env.modulePath }}/.parameters/${{ matrix.parameterFilePaths }}'
location: '${{ env.defaultLocation }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
removeDeployment: '${{ needs.job_set_workflow_param.outputs.removeDeployment }}'
###############
# PUBLISH #
###############
job_publish_module:
name: 'Publish module'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event.inputs.prerelease == 'true'
runs-on: ubuntu-20.04
needs:
- job_set_workflow_param
- job_module_deploy_validation
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set environment variables
uses: deep-mm/[email protected]
with:
variableFileName: 'global.variables'
- name: 'Publish module'
uses: ./.github/actions/templates/publishModule
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
templateSpecsRGName: '${{ env.templateSpecsRGName }}'
templateSpecsRGLocation: '${{ env.templateSpecsRGLocation }}'
templateSpecsDescription: '${{ env.templateSpecsDescription }}'
templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}'
bicepRegistryName: '${{ env.bicepRegistryName }}'
bicepRegistryRGName: '${{ env.bicepRegistryRGName }}'
bicepRegistryRgLocation: '${{ env.bicepRegistryRgLocation }}'
bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}'