forked from MSEndpointMgr/IntuneAppFactory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.yml
285 lines (279 loc) · 9.57 KB
/
publish.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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
name: IntuneAppFactory
trigger: none
schedules:
- cron: "0 */6 * * *"
displayName: Every 6 hours
branches:
include:
- main
always: true
pool:
name: '<<POOLNAME>>'
parameters:
- name: operationalMode
displayName: Select operational mode
type: string
default: 'Publish'
values:
- 'Verify'
- 'Package'
- 'Publish'
- name: archiveMode
displayName: Archive published apps
type: string
default: 'No'
values:
- 'Yes'
- 'No'
variables:
- group: IntuneAppFactory
- group: KeyVault
# Stage: 1
# - Description: Test environment for required files
# - Input file required: None
# - Output file created: None
stages:
- stage: test_environment
jobs:
- job: test_environment
timeoutInMinutes: 5
steps:
- task: PowerShell@2
name: write_variables
displayName: Write-Variable
inputs:
filePath: 'Scripts/Write-Variable.ps1'
- task: PowerShell@2
name: check_template_files
displayName: Test-TemplatesFolder
inputs:
filePath: 'Scripts/Test-TemplatesFolder.ps1'
# Stage: 2
# - Description: Install all required modules and remove files from previous pipeline executions
# - Input file required: None
# - Output file created: None
- stage: prepare_environment
dependsOn:
- test_environment
condition: and(succeeded(), eq(dependencies.test_environment.outputs['test_environment.check_template_files.shouldrun'], 'true'))
jobs:
- job: prepare_environment
timeoutInMinutes: 15
steps:
- task: PowerShell@2
name: install_modules
displayName: Install-Modules
inputs:
filePath: 'Scripts/Install-Modules.ps1'
- task: PowerShell@2
name: cleanup_folders
displayName: Remove-Files
inputs:
filePath: 'Scripts/Remove-Files.ps1'
# Stage: 3
# - Description: Check that all onboarded apps are properly configured, have the required files necessary for the pipeline to successfully publish the app in Intune
# - Input file required: None
# - Output file created: AppsProcessList.json
- stage: check_app_files
dependsOn:
- test_environment
- prepare_environment
condition: and(succeeded(), or(eq('${{ parameters.operationalMode }}', 'Verify'), eq('${{ parameters.operationalMode }}', 'Package'), eq('${{ parameters.operationalMode }}', 'Publish')))
jobs:
- job: check_app_files
timeoutInMinutes: 15
steps:
- task: PowerShell@2
name: test_app_files
displayName: Test-AppFiles
inputs:
filePath: 'Scripts/Test-AppFiles.ps1'
arguments: -ConnectionString $(SA-IntuneAppFactory-AccessKey)
- task: PublishBuildArtifacts@1
name: publish_artifacts
inputs:
pathToPublish: $(Build.BinariesDirectory)
artifactName: AppsProcessList
- task: DeleteFiles@1
name: cleanup_artifacts
inputs:
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '**'
# Stage: 4
# - Description: Check for new apps eligible to be processed by pipeline
# - Input file required: AppsProcessList.json
# - Output file created: AppsDownloadList.json
- stage: check_new_app_version
dependsOn:
- test_environment
- prepare_environment
- check_app_files
condition: and(succeeded(), eq(dependencies.check_app_files.outputs['check_app_files.test_app_files.shouldrun'], 'true'), or(eq('${{ parameters.operationalMode }}', 'Package'), eq('${{ parameters.operationalMode }}', 'Publish')))
jobs:
- job: check_new_app_version
timeoutInMinutes: 30
steps:
- task: DownloadBuildArtifacts@0
name: download_artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: AppsProcessList
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
name: test_app_list
displayName: Test-AppList
inputs:
filePath: 'Scripts/Test-AppList.ps1'
arguments: -TenantID $(TenantID) -ClientID $(ClientID) -ClientSecret $(SP-IntuneAppFactory-ClientSecret) -StorageAccountAccessKey $(SA-IntuneAppFactory-AccessKey)
- task: PublishBuildArtifacts@1
name: publish_artifacts
inputs:
pathToPublish: $(Build.BinariesDirectory)
artifactName: AppsDownloadList
- task: DeleteFiles@1
name: cleanup_artifacts
inputs:
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '**'
# Stage: 5
# - Description: Download new apps eligible to be processed by pipeline
# - Input file required: AppsDownloadList.json
# - Output file created: AppsPrepareList.json
- stage: download_new_apps
dependsOn:
- test_environment
- prepare_environment
- check_app_files
- check_new_app_version
condition: and(succeeded(), eq(dependencies.check_new_app_version.outputs['check_new_app_version.test_app_list.shouldrun'], 'true'), or(eq('${{ parameters.operationalMode }}', 'Package'), eq('${{ parameters.operationalMode }}', 'Publish')))
jobs:
- job: download_new_apps
timeoutInMinutes: 120
steps:
- task: DownloadBuildArtifacts@0
name: download_artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: AppsDownloadList
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
name: save_installer
displayName: Save-Installer
inputs:
filePath: 'Scripts/Save-Installer.ps1'
arguments: -StorageAccountAccessKey $(SA-IntuneAppFactory-AccessKey)
- task: PublishBuildArtifacts@1
name: publish_artifacts
inputs:
pathToPublish: $(Build.BinariesDirectory)
artifactName: AppsPrepareList
- task: DeleteFiles@1
name: cleanup_artifacts
inputs:
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '**'
# Stage: 6
# - Description: Prepare apps by creating packaging folder, copy framework and setup files
# - Input file required: AppsPrepareList.json
# - Output file created: AppsPublishList.json
- stage: prepare_app_files
dependsOn:
- test_environment
- prepare_environment
- check_app_files
- check_new_app_version
- download_new_apps
condition: and(succeeded(), eq(dependencies.download_new_apps.outputs['download_new_apps.save_installer.shouldrun'], 'true'), or(eq('${{ parameters.operationalMode }}', 'Package'), eq('${{ parameters.operationalMode }}', 'Publish')))
jobs:
- job: prepare_app_package_folder
timeoutInMinutes: 60
steps:
- task: DownloadBuildArtifacts@0
name: download_artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: AppsPrepareList
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
name: create_package_folder
displayName: Prepare-AppPackageFolder
inputs:
filePath: 'Scripts/Prepare-AppPackageFolder.ps1'
- task: PublishBuildArtifacts@1
name: publish_artifacts
inputs:
pathToPublish: $(Build.BinariesDirectory)
artifactName: AppsPublishList
- task: DeleteFiles@1
name: cleanup_artifacts
inputs:
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '**'
# Stage: 7
# Description: Upload all apps that will be published to Intune to storage account for archival process
# - Input file required: AppsPublishList.json
# - Output file created: None
- stage: archive_apps
dependsOn:
- test_environment
- prepare_environment
- check_app_files
- check_new_app_version
- download_new_apps
- prepare_app_files
condition: and(succeeded(), eq(dependencies.prepare_app_files.outputs['prepare_app_package_folder.create_package_folder.shouldrun'], 'true'), eq('${{ parameters.archiveMode }}', 'Yes'), or(eq('${{ parameters.operationalMode }}', 'Package'), eq('${{ parameters.operationalMode }}', 'Publish')))
jobs:
- job: archive_apps
timeoutInMinutes: 60
steps:
- task: DownloadBuildArtifacts@0
name: download_artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: AppsPublishList
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
name: upload_app_archive
displayName: New-AppArchive
inputs:
filePath: 'Scripts/New-AppArchive.ps1'
arguments: -StorageAccountName $(ArchiveStorageAccountName) -ContainerName $(ArchiveContainerName) -StorageAccountKey $(SA-IntuneAppFactory-AccessKey)
- task: DeleteFiles@1
name: cleanup_artifacts
inputs:
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '**'
# Stage: 8
# - Description: Invoke IntuneWin32AppPackager framework script to package and publish new apps to Intune
# - Input file required: AppsPublishList.json
# - Output file created: None
- stage: publish_apps
dependsOn:
- test_environment
- prepare_environment
- check_app_files
- check_new_app_version
- download_new_apps
- prepare_app_files
condition: and(succeeded(), eq(dependencies.prepare_app_files.outputs['prepare_app_package_folder.create_package_folder.shouldrun'], 'true'), eq('${{ parameters.operationalMode }}', 'Publish'))
jobs:
- job: publish_apps
timeoutInMinutes: 120
steps:
- task: DownloadBuildArtifacts@0
name: download_artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: AppsPublishList
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: PowerShell@2
name: new_app
displayName: New-Win32App
inputs:
filePath: 'Scripts/New-Win32App.ps1'
arguments: -TenantID $(TenantID) -ClientID $(ClientID) -ClientSecret $(SP-IntuneAppFactory-ClientSecret) -WorkspaceID $(ReportWorkspaceID) -SharedKey $(LA-IntuneAppFactory-PrimaryKey)