-
Notifications
You must be signed in to change notification settings - Fork 76
/
shesha-io.shesha-framework-20240911-BP.yml
544 lines (540 loc) · 21 KB
/
shesha-io.shesha-framework-20240911-BP.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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# Variable 'artifactName' was defined in the Variables tab - This is from my fix branch
# Agent Queue 'Azure Pipelines' was used with unrecognized Agent Specification, vmImage property must be specified to determine image - https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software
variables:
- name: NODE_OPTIONS
value: --max_old_space_size=8192
- name: BuildParameters.solution1
value: Boxfusion.SheshaFunctionalTests.sln
- name: BuildParameters.solution2
value: ShaCompanyName.ShaProjectName.sln
- name: BuildParameters.configuration
value: release
- name: pack-version
value: ""
- name: isMain
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
pr:
branches:
include:
- releases/*
- main
trigger:
tags:
include:
- 'release-*'
branches:
include:
- releases/*
- main
pool:
name: Azure Pipelines
vmImage1: windows-latest
vmImage2: ubuntu-latest
# name: 2.0.0.$(BuildID)
stages:
- stage: build
jobs:
- job: Job_1
displayName: Build_Functional_Shesha_API
dependsOn: Job_4
pool:
name: Azure Pipelines
vmImage: windows-latest
steps:
- checkout: self
- task: PowerShell@2
displayName: Check if Pull Request
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
$targetBranch = ""
if ("$(Build.SourceBranch)" -like "*/pull/*")
{
$targetBranch = "$(System.PullRequest.TargetBranch)"
write-host "This is a Pull Request and the target branch is: $targetBranch"
write-host "##vso[task.setvariable variable=prTargetBranch]$targetBranch"
}
else
{
write-host "This is not a Pull Request and the target branch is set to empty string"
write-host "##vso[task.setvariable variable=prTargetBranch]''"
}
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Check to establish if this pipeline was triggered from a tag
inputs:
filePath: 'ReleaseFlow.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)'
arguments: '-PipeBuildNumber "$(Build.BuildNumber)" -PipeSourceBranch "$(Build.SourceBranch)" -PipeSourceVersion "$(Build.SourceVersion)" -PipeTargetBranch "$(prTargetBranch)" -PipeBuildId "$(Build.BuildId)"'
- task: PowerShell@2
displayName: Output to console the current branch and version
inputs:
targetType: 'inline'
script: |
write-host "The current branch is: $(currentBranch)"
write-host "The current version is: $(versionNo)"
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Create a txt file to carry the original branch name to the release pipeline
inputs:
targetType: 'inline'
script: |
$variable = '$(currentBranch)'
$variable | Out-File $(Build.ArtifactStagingDirectory)\branchName.txt
Get-Content $(Build.ArtifactStagingDirectory)\branchName.txt
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: api-info-1'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'api-info-1'
- task: UseDotNet@2
displayName: Use .NET Core sdk 8.x
inputs:
version: 8.x
- task: Assembly-Info-NetCore@3
displayName: 'Set Assembly Manifest Data'
inputs:
InsertAttributes: true
VersionNumber: "$(versionNo)"
FileVersionNumber: "$(versionNo)"
InformationalVersion: "$(versionNo)"
PackageVersion: "$(versionNo)"
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: DotNetCoreCLI@2
displayName: dotnet Restore
inputs:
command: 'restore'
projects: shesha-functional-tests/backend/**/*.csproj
feedsToUse: 'select'
vstsFeed: '44b4667a-8963-403d-9962-bde66225adbd'
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
projects: shesha-functional-tests/backend/Boxfusion.SheshaFunctionalTests.sln
arguments: --configuration $(BuildParameters.configuration) -p:DefineConstants=DisableEditModule
- task: DotNetCoreCLI@2
displayName: dotnet publish
inputs:
command: publish
publishWebProjects: false
projects: shesha-functional-tests/backend/Boxfusion.SheshaFunctionalTests.sln
arguments: --configuration $(BuildParameters.configuration) --output $(build.artifactstagingdirectory) --no-build
zipAfterPublish: false
modifyOutputPath: false
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: functional-shesha-api'
inputs:
ArtifactName: functional-shesha-api
# - task: DotNetCoreCLI@2
# displayName: dotnet pack
# inputs:
# command: 'pack'
# packagesToPack: 'shesha-functional-tests/backend/src/**/*.csproj'
# # packagesToPack: 'shesha-functional-tests/backend/src/Boxfusion.SheshaFunctionalTests.Web.Host.csproj'
# configuration: '$(BuildParameters.configuration)'
# nobuild: false
# includesymbols: true
# includesource: true
# versioningScheme: 'byEnvVar'
# versionEnvVar: 'versionNo'
- task: DotNetCoreCLI@2
displayName: dotnet pack
inputs:
command: 'pack'
packagesToPack: 'shesha-core/src/**/*.csproj'
# packagesToPack: 'shesha-functional-tests/backend/src/Boxfusion.SheshaFunctionalTests.Web.Host.csproj'
configuration: '$(BuildParameters.configuration)'
nobuild: false
includesymbols: true
includesource: true
versioningScheme: 'byEnvVar'
versionEnvVar: 'versionNo'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Nuget packs'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'packs-functional'
- job: Job_2
dependsOn: Job_4
displayName: Build_Functional_Shesha_AdminPortal
pool:
vmImage: windows-latest
steps:
- task: PowerShell@2
displayName: Check if Pull Request
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
$targetBranch = ""
if ("$(Build.SourceBranch)" -like "*/pull/*")
{
$targetBranch = "$(System.PullRequest.TargetBranch)"
write-host "This is a Pull Request and the target branch is: $targetBranch"
write-host "##vso[task.setvariable variable=prTargetBranch]$targetBranch"
}
else
{
write-host "This is not a Pull Request and the target branch is set to empty string"
write-host "##vso[task.setvariable variable=prTargetBranch]''"
}
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Check to establish if this pipeline was triggered from a tag
inputs:
filePath: 'ReleaseFlow.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)'
arguments: '-PipeBuildNumber "$(Build.BuildNumber)" -PipeSourceBranch "$(Build.SourceBranch)" -PipeSourceVersion "$(Build.SourceVersion)" -PipeTargetBranch "$(prTargetBranch)" -PipeBuildId "$(Build.BuildId)"'
- task: PowerShell@2
displayName: Output to console the current branch
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
write-host "The current branch is: $(currentBranch)"
write-host "The current version is: $(versionNo)"
workingDirectory: 'shesha-functional-tests/adminportal'
- task: NodeTool@0
displayName: 'Use Node 21.x'
inputs:
versionSpec: 21.x
retryCountOnTaskFailure: 5
- task: Npm@1
displayName: 'Npm Update Version'
inputs:
command: custom
workingDir: shesha-reactjs
verbose: false
customCommand: 'version $(versionNo) --allow-same-version'
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: Npm@1
displayName: 'Npm Install'
inputs:
command: custom
workingDir: shesha-reactjs
verbose: false
customCommand: 'install'
# - task: Npm@1
# displayName: Install Latest Shesha
# inputs:
# command: custom
# workingDir: 'shesha-functional-tests/adminportal'
# verbose: true
# customCommand: install @shesha/reactjs@latest
- task: Npm@1
displayName: Npm Build
inputs:
command: custom
workingDir: shesha-reactjs
verbose: true
customCommand: run build
- task: Npm@1
displayName: 'Npm Update Version'
inputs:
command: custom
workingDir: shesha-functional-tests/adminportal
verbose: false
customCommand: 'version $(versionNo) --allow-same-version'
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: Npm@1
displayName: 'Npm Install'
inputs:
command: custom
workingDir: shesha-functional-tests/adminportal
verbose: false
customCommand: 'install' # NOTE: never use --legacy-peer-deps here!
# - task: Npm@1
# displayName: Install Latest Shesha
# inputs:
# command: custom
# workingDir: 'shesha-functional-tests/adminportal'
# verbose: true
# customCommand: install @shesha/reactjs@latest
- task: Npm@1
displayName: Npm Build
inputs:
command: custom
workingDir: 'shesha-functional-tests/adminportal'
verbose: true
customCommand: run build
# Creating a temporary directory to copy both node apps
- task: PowerShell@2
displayName: 'Preparing ReactJS for Archiving'
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
mkdir $(System.DefaultWorkingDirectory)/temp
Write-Host "Copying Shesha ReactJS Artifacts"
cp -R shesha-reactjs $(System.DefaultWorkingDirectory)/temp/shesha-reactjs
cp -R shesha-functional-tests $(System.DefaultWorkingDirectory)/temp/shesha-functional-tests
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/temp'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/adminportal.zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: shesha-adminportal-functional'
inputs:
ArtifactName: adminportal-functional
- job: Job_3
displayName: Prepare Release if published
dependsOn: Job_4
pool:
vmImage: windows-latest
steps:
- task: PowerShell@2
displayName: Check if Pull Request
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
$targetBranch = ""
if ("$(Build.SourceBranch)" -like "*/pull/*")
{
$targetBranch = "$(System.PullRequest.TargetBranch)"
write-host "This is a Pull Request and the target branch is: $targetBranch"
write-host "##vso[task.setvariable variable=prTargetBranch]$targetBranch"
}
else
{
write-host "This is not a Pull Request and the target branch is set to empty string"
write-host "##vso[task.setvariable variable=prTargetBranch]''"
}
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Check to establish if this pipeline was triggered from a tag
inputs:
filePath: 'ReleaseFlow.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)'
arguments: '-PipeBuildNumber "$(Build.BuildNumber)" -PipeSourceBranch "$(Build.SourceBranch)" -PipeSourceVersion "$(Build.SourceVersion)" -PipeTargetBranch "$(prTargetBranch)" -PipeBuildId "$(Build.BuildId)"'
- task: PowerShell@2
displayName: Delete Pipeline and Actions Yaml Files
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
ls
Remove-Item -Recurse -Force .github
ls
Remove-Item -Force Starter-and-Functional-BP.yaml
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: 'ChangeLog.md'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
OverWrite: true
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/shesha-framework-$(version).zip'
replaceExistingArchive: true
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/shesha-framework-$(version).tar.gz'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Release Version'
inputs:
ArtifactName: release-version
- job: Job_4
displayName: SonarSource
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 0
- task: PowerShell@2
displayName: Check if Pull Request
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
$targetBranch = ""
if ("$(Build.SourceBranch)" -like "*/pull/*")
{
$targetBranch = "$(System.PullRequest.TargetBranch)"
write-host "This is a Pull Request and the target branch is: $targetBranch"
write-host "##vso[task.setvariable variable=prTargetBranch]$targetBranch"
}
else
{
write-host "This is not a Pull Request and the target branch is set to empty string"
write-host "##vso[task.setvariable variable=prTargetBranch]''"
}
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Check to establish if this pipeline was triggered from a tag
inputs:
filePath: 'ReleaseFlow.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)'
arguments: '-PipeBuildNumber "$(Build.BuildNumber)" -PipeSourceBranch "$(Build.SourceBranch)" -PipeSourceVersion "$(Build.SourceVersion)" -PipeTargetBranch "$(prTargetBranch)" -PipeBuildId "$(Build.BuildId)"'
- task: PowerShell@2
displayName: Output to console the current branch and version
inputs:
targetType: 'inline'
script: |
write-host "The current branch is: $(currentBranch)"
write-host "The current version is: $(versionNo)"
workingDirectory: '$(System.DefaultWorkingDirectory)'
# - task: SonarCloudAnalyze@1
# inputs:
# jdkversion: 'JAVA_HOME_17_X64'
# - task: SonarCloudPrepare@1
# inputs:
# SonarCloud: 'Sonarcloud'
# organization: 'boxfusion'
# scannerMode: 'MSBuild'
# projectKey: 'Boxfusion_Shesha-Web-v3.0'
# projectName: 'Shesha Web v3.0'
# projectVersion: '$(versionNo)'
- task: SonarCloudPrepare@1
condition: eq(variables['System.PullRequest.IsFork'], 'false')
inputs:
SonarCloud: 'Sonarcloud' # This is the name of the service connection you created
organization: 'boxfusion'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'Boxfusion_Shesha-Web-v3.0'
cliProjectName: 'Shesha Web v3.0'
cliProjectVersion: '$(versionNo)'
cliSources: '$(System.DefaultWorkingDirectory)' # This is the relative path to your source code
- task: SonarCloudAnalyze@1
condition: eq(variables['System.PullRequest.IsFork'], 'false')
inputs:
jdkversion: 'JAVA_HOME_17_X64'
- task: SonarQubePublish@5
condition: eq(variables['System.PullRequest.IsFork'], 'false')
inputs:
pollingTimeoutSec: '300'
- job: Job_5
dependsOn: Job_4
displayName: Build_Functional_Shesha_PublicPortal
pool:
vmImage: windows-latest
steps:
- task: PowerShell@2
displayName: Check if Pull Request
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
$targetBranch = ""
if ("$(Build.SourceBranch)" -like "*/pull/*")
{
$targetBranch = "$(System.PullRequest.TargetBranch)"
write-host "This is a Pull Request and the target branch is: $targetBranch"
write-host "##vso[task.setvariable variable=prTargetBranch]$targetBranch"
}
else
{
write-host "This is not a Pull Request and the target branch is set to empty string"
write-host "##vso[task.setvariable variable=prTargetBranch]''"
}
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Check to establish if this pipeline was triggered from a tag
inputs:
filePath: 'ReleaseFlow.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)'
arguments: '-PipeBuildNumber "$(Build.BuildNumber)" -PipeSourceBranch "$(Build.SourceBranch)" -PipeSourceVersion "$(Build.SourceVersion)" -PipeTargetBranch "$(prTargetBranch)" -PipeBuildId "$(Build.BuildId)"'
- task: PowerShell@2
displayName: Output to console the current branch
retryCountOnTaskFailure: 5
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
write-host "The current branch is: $(currentBranch)"
write-host "The current version is: $(versionNo)"
workingDirectory: 'shesha-functional-tests/publicportal'
- task: NodeTool@0
displayName: 'Use Node 21.x'
inputs:
versionSpec: 21.x
retryCountOnTaskFailure: 5
# - task: Npm@1
# displayName: 'Npm Update Version'
# inputs:
# command: custom
# workingDir: shesha-reactjs
# verbose: false
# customCommand: 'version $(versionNo) --allow-same-version'
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: Npm@1
displayName: 'Npm Install'
inputs:
command: custom
workingDir: shesha-reactjs
verbose: false
customCommand: 'install'
- task: Npm@1
displayName: Npm Build
inputs:
command: custom
workingDir: shesha-reactjs
verbose: true
customCommand: run build
- task: Npm@1
displayName: 'Npm Update Version'
inputs:
command: custom
workingDir: shesha-functional-tests/publicportal
verbose: false
customCommand: 'version $(versionNo) --allow-same-version'
# condition: ne(variables['currentBranch'], 'refs/heads/main')
- task: Npm@1
displayName: 'Npm Install'
inputs:
command: custom
workingDir: shesha-functional-tests/publicportal
verbose: false
customCommand: 'install' # NOTE: never use --legacy-peer-deps here!
# - task: Npm@1
# displayName: Install Latest Shesha
# inputs:
# command: custom
# workingDir: 'shesha-functional-tests/adminportal'
# verbose: true
# customCommand: install @shesha/reactjs@latest
- task: Npm@1
displayName: Npm Build
inputs:
command: custom
workingDir: 'shesha-functional-tests/publicportal'
verbose: true
customCommand: run build
# Creating a temporary directory to copy both node apps
- task: PowerShell@2
displayName: 'Preparing ReactJS for Archiving'
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
mkdir $(System.DefaultWorkingDirectory)/temp
Write-Host "Copying Shesha ReactJS Artifacts"
# cp -R shesha-reactjs $(System.DefaultWorkingDirectory)/temp/shesha-reactjs
cp -R shesha-functional-tests/publicportal $(System.DefaultWorkingDirectory)/temp
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/temp'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/publicportal.zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: shesha-publicportal-functional'
inputs:
ArtifactName: publicportal-functional