-
Notifications
You must be signed in to change notification settings - Fork 7
189 lines (184 loc) · 6.24 KB
/
policy-documentation.yml
File metadata and controls
189 lines (184 loc) · 6.24 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: policy-documentation
on:
schedule:
- cron: '30 5,21 * * *' # everyday at 05:30 & 21:30 UTC (AEST offset handled by users)
workflow_dispatch:
# allows a manual run from the UI
inputs:
debug:
description: "Enable debug logging"
type: boolean
default: false
env:
ACTIONS_STEP_DEBUG: ${{ inputs.debug }}
variablesPath: 'settings.yml'
generateWikiScriptPath: 'scripts/pipelines/policy-documentation/generate-wiki-pages.ps1'
environmentDiscoveryFileName: 'EnvironmentDiscovery.zip'
jobs:
job_call_initiation:
name: Initiation
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: 'Initiation'
uses: ./.github/actions/templates/initiation
with:
variablesPath: '${{ env.variablesPath }}'
job_discovery_dev:
name: Environment Discovery - Dev
runs-on: ubuntu-latest
needs:
- job_call_initiation
env:
EncryptionKey: ${{ secrets.ENCRYPTIONKEY }}
EncryptionIV: ${{ secrets.ENCRYPTIONIV }}
AZURE_CREDENTIALS: ${{ secrets.MG_DEV_READER }}
steps:
- name: 'Checkout'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Discovery
uses: ./.github/actions/templates/policyDocDiscovery
with:
topLevelManagementGroupName: 'contoso-dev'
environment: 'dev'
buildArtifactName: 'policy_doc_dev'
job_discovery_prod:
name: Environment Discovery - Prod
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- job_call_initiation
env:
EncryptionKey: ${{ secrets.ENCRYPTIONKEY }}
EncryptionIV: ${{ secrets.ENCRYPTIONIV }}
AZURE_CREDENTIALS: ${{ secrets.MG_PROD_READER }}
steps:
- name: 'Checkout'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Discovery
uses: ./.github/actions/templates/policyDocDiscovery
with:
topLevelManagementGroupName: 'contoso'
environment: 'prod'
buildArtifactName: 'policy_doc_prod'
job_parse_config_dev:
name: Parse Config - Dev
runs-on: ubuntu-latest
outputs:
wikiCount: ${{ steps.parse-config.outputs.wikiCount }}
wikis: ${{ steps.parse-config.outputs.wikis }}
needs:
- job_call_initiation
- job_discovery_dev
steps:
- id: checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- id: parse-config
uses: ./.github/actions/templates/policyDocParseConfig
with:
environment: 'dev'
job_parse_config_prod:
name: Parse Config - Prod
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
wikiCount: ${{ steps.parse-config.outputs.wikiCount }}
wikis: ${{ steps.parse-config.outputs.wikis }}
needs:
- job_call_initiation
- job_discovery_prod
steps:
- id: checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- id: parse-config
uses: ./.github/actions/templates/policyDocParseConfig
with:
environment: 'prod'
job_generate_wiki_dev:
name: 'Generate Wiki - Dev [${{ matrix.wiki.wikiAlias }}]'
runs-on: ubuntu-latest
needs:
- job_call_initiation
- job_discovery_dev
- job_parse_config_dev
strategy:
matrix:
wiki: ${{ fromJSON(needs.job_parse_config_dev.outputs.wikis) }}
env:
EncryptionKey: ${{ secrets.ENCRYPTIONKEY }}
EncryptionIV: ${{ secrets.ENCRYPTIONIV }}
GithubUserId: ${{ secrets.GITHUBUSERID_DEV }}
GithubToken: ${{ secrets.GITHUBTOKEN_DEV }}
steps:
- name: 'Checkout'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate Wiki
uses: ./.github/actions/templates/policyDocGenerateWiki
with:
title: ${{ matrix.wiki.title }}
wikiAlias: ${{ matrix.wiki.wikiAlias }}
pageStyle: ${{ matrix.wiki.pageStyle }}
gitBranch: ${{ matrix.wiki.gitBranch }}
gitRepository: ${{ matrix.wiki.gitRepository }}
gitUserName: ${{ matrix.wiki.gitUserName }}
gitUserEmail: ${{ matrix.wiki.gitUserEmail }}
gitCommitMessage: 'Policy Documentation from commit ${{ github.sha }}'
subscriptionIds: ${{ matrix.wiki.subscriptionIds }}
childManagementGroupId: ${{ matrix.wiki.childManagementGroupId }}
buildArtifactName: 'policy_doc_dev'
aesEncryptionKey: ${{ secrets.ENCRYPTIONKEY }}
aesEncryptionIV: ${{ secrets.ENCRYPTIONIV }}
githubUserId: ${{ env.GithubUserId }}
githubToken: ${{ env.GithubToken }}
job_generate_wiki_prod:
name: 'Generate Wiki - Prod [${{ matrix.wiki.wikiAlias }}]'
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- job_call_initiation
- job_discovery_prod
- job_parse_config_prod
strategy:
matrix:
wiki: ${{ fromJSON(needs.job_parse_config_prod.outputs.wikis) }}
env:
EncryptionKey: ${{ secrets.ENCRYPTIONKEY }}
EncryptionIV: ${{ secrets.ENCRYPTIONIV }}
GithubUserId: ${{ secrets.GITHUBUSERID_PROD }}
GithubToken: ${{ secrets.GITHUBTOKEN_PROD }}
steps:
- name: 'Checkout'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate Wiki
uses: ./.github/actions/templates/policyDocGenerateWiki
with:
title: ${{ matrix.wiki.title }}
wikiAlias: ${{ matrix.wiki.wikiAlias }}
pageStyle: ${{ matrix.wiki.pageStyle }}
gitBranch: ${{ matrix.wiki.gitBranch }}
gitRepository: ${{ matrix.wiki.gitRepository }}
gitUserName: ${{ matrix.wiki.gitUserName }}
gitUserEmail: ${{ matrix.wiki.gitUserEmail }}
gitCommitMessage: 'Policy Documentation from commit ${{ github.sha }}'
subscriptionIds: ${{ matrix.wiki.subscriptionIds }}
childManagementGroupId: ${{ matrix.wiki.childManagementGroupId }}
buildArtifactName: 'policy_doc_prod'
aesEncryptionKey: ${{ secrets.ENCRYPTIONKEY }}
aesEncryptionIV: ${{ secrets.ENCRYPTIONIV }}
githubUserId: ${{ env.GithubUserId }}
githubToken: ${{ env.GithubToken }}