Skip to content

Commit 53dc17f

Browse files
committed
making artifact assembler run parallel and update consolidate artifacts yaml
1 parent 7224ca4 commit 53dc17f

File tree

3 files changed

+167
-71
lines changed

3 files changed

+167
-71
lines changed

eng/ci/consolidate-artifacts.yml

+88-55
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ schedules:
77
include:
88
- main
99

10-
name: $(Build.SourceBranchName)_$(Build.Reason)
11-
1210
trigger: none
1311

1412
# This pipeline is triggered by the completion of scheduled builds
@@ -50,12 +48,12 @@ resources:
5048
variables:
5149
- template: /ci/variables/cfs.yml@eng
5250

53-
5451
extends:
5552
template: v1/1ES.Official.PipelineTemplate.yml@1es
5653
parameters:
5754
featureFlags:
5855
incrementalSDLBinaryAnalysis: true
56+
incrementalSDLSourceAnalysis: true
5957
pool:
6058
name: 1es-pool-azfunc
6159
image: 1es-windows-2022
@@ -70,46 +68,21 @@ extends:
7068
- stage: ConsolidateArticacts
7169
displayName: "Assemble Artifacts"
7270
jobs:
73-
- job: AssembleArtifacts
74-
timeoutInMinutes: 200 # Have this here in case there are new artifacts to be scanned with increment SDL binary analysis
75-
displayName: "Assemble Artifacts"
71+
- job: ProcessNuGetPackage
72+
displayName: "Process NuGet Package"
7673
templateContext:
77-
outputParentDirectory: $(Build.ArtifactStagingDirectory)
7874
outputs:
79-
- output: pipelineArtifact
80-
displayName: Publish assembled artifacts
81-
path: $(Pipeline.Workspace)\staging
82-
artifact: drop
83-
75+
- output: pipelineArtifact
76+
displayName: Publish nuget package
77+
targetPath: $(Pipeline.Workspace)/staging
78+
artifact: drop-nuget-package
8479
steps:
85-
- checkout: self
86-
87-
- download: core-tools-host
88-
artifact: drop-coretools-host-linux-signed
89-
displayName: "Download core-tools-host linux"
90-
91-
- download: core-tools-host
92-
artifact: drop-coretools-host-windows
93-
displayName: "Download core-tools-host windows"
94-
95-
- download: core-tools-inproc
96-
artifact: drop-inproc6
97-
displayName: "Download inproc6 artifact"
98-
99-
- download: core-tools-inproc
100-
artifact: drop-inproc8
101-
displayName: "Download inproc8 artifact"
80+
- checkout: none
10281

10382
- download: core-tools-default
10483
artifact: drop
10584
displayName: "Download out-of-proc artifact"
10685

107-
- powershell: |
108-
Write-Host "Value of env variable: $(Pipeline.Workspace)"
109-
Write-Host "Artifacts are stored in: D:\a\_work\1"
110-
Get-ChildItem -Path "D:\a\_work\1" -Recurse
111-
displayName: "List Artifact Paths"
112-
11386
- powershell: |
11487
$currentRunName = $env:BUILD_REASON
11588
Write-Host "Current pipeline run name: $currentRunName"
@@ -135,10 +108,10 @@ extends:
135108
exit 1
136109
}
137110
138-
# Define the destination path in $(Pipeline.Workspace)/nugetPackage
139-
$nugetPackageDirectory = Join-Path -Path $(Pipeline.Workspace) -ChildPath "nugetPackage"
111+
# Define the destination path in $(Pipeline.Workspace)/staging
112+
$nugetPackageDirectory = Join-Path -Path $(Pipeline.Workspace) -ChildPath "staging"
140113
141-
# Create the nugetPackage directory if it doesn't exist
114+
# Create the staging directory if it doesn't exist
142115
if (-not (Test-Path $nugetPackageDirectory)) {
143116
New-Item -Path $nugetPackageDirectory -ItemType Directory
144117
Write-Host "Directory created at: $nugetPackageDirectory"
@@ -148,31 +121,90 @@ extends:
148121
Move-Item -Path $fileToMove.FullName -Destination $nugetPackageDirectory -Force
149122
150123
Write-Host "File $($fileToMove.Name) moved to $nugetPackageDirectory"
151-
displayName: 'Move Microsoft.Azure.Functions.CoreTools.x.x.xxxx.nupkg to nugetPackage directory'
152-
124+
displayName: 'Process Microsoft.Azure.Functions.CoreTools NuGet Package'
125+
126+
- job: AssembleArtifacts
127+
strategy:
128+
matrix:
129+
win-x64:
130+
artifactName: 'Azure.Functions.Cli.win-x64'
131+
artifactId: 'win-x64'
132+
win-x86:
133+
artifactName: 'Azure.Functions.Cli.win-x86'
134+
artifactId: 'win-x86'
135+
osx-x64:
136+
artifactName: 'Azure.Functions.Cli.osx-x64'
137+
artifactId: 'osx-x64'
138+
linux-x64:
139+
artifactName: 'Azure.Functions.Cli.linux-x64'
140+
artifactId: 'linux-x64'
141+
osx-arm64:
142+
artifactName: 'Azure.Functions.Cli.osx-arm64'
143+
artifactId: 'osx-arm64'
144+
win-arm64:
145+
artifactName: 'Azure.Functions.Cli.win-arm64'
146+
artifactId: 'win-arm64'
147+
min.win-x64:
148+
artifactName: 'Azure.Functions.Cli.min.win-x64'
149+
artifactId: 'min.win-x64'
150+
min.win-arm64:
151+
artifactName: 'Azure.Functions.Cli.min.win-arm64'
152+
artifactId: 'min.win-arm64'
153+
min.win-x86:
154+
artifactName: 'Azure.Functions.Cli.min.win-x86'
155+
artifactId: 'min.win-x86'
156+
displayName: "Assemble Artifacts"
157+
templateContext:
158+
outputs:
159+
- output: pipelineArtifact
160+
displayName: Publish assembled artifact $(System.JobPositionInPhase)
161+
targetPath: $(Build.ArtifactStagingDirectory)
162+
artifact: drop-$(artifactId)
163+
- output: pipelineArtifact
164+
displayName: Publish metadata.json
165+
targetPath: $(Pipeline.Workspace)/staging/metadata.json
166+
artifact: drop-metadata-json
167+
condition: and(succeeded(), eq(variables['artifactName'], 'Azure.Functions.Cli.min.win-x64'))
168+
169+
steps:
170+
- checkout: self
171+
172+
- download: core-tools-host
173+
artifact: drop-coretools-host-linux-signed
174+
displayName: "Download core-tools-host linux"
175+
176+
- download: core-tools-host
177+
artifact: drop-coretools-host-windows
178+
displayName: "Download core-tools-host windows"
179+
180+
- download: core-tools-inproc
181+
artifact: drop-inproc6
182+
displayName: "Download inproc6 artifact"
183+
184+
- download: core-tools-inproc
185+
artifact: drop-inproc8
186+
displayName: "Download inproc8 artifact"
187+
188+
- download: core-tools-default
189+
artifact: drop
190+
displayName: "Download out-of-proc artifact"
191+
153192
- task: DotNetCoreCLI@2
154193
displayName: "Run ArtifactAssembler"
155194
inputs:
156195
command: run
157196
projects: "$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler/Azure.Functions.ArtifactAssembler.csproj"
158-
arguments: ' -c release'
197+
arguments: ' -c release "$(artifactName)"'
159198
workingDirectory: '$(Pipeline.Workspace)'
160199

161-
162-
- powershell: |
163-
Write-Host "Value of env variable: $(Pipeline.Workspace)"
164-
Write-Host "Artifacts are stored in: D:\a\_work\1"
165-
Get-ChildItem -Path "D:\a\_work\1" -Recurse
166-
displayName: "List Artifact Paths"
167-
168-
169200
- task: PowerShell@2
170201
displayName: 'Generate metadata.json file'
171202
inputs:
172203
targetType: filePath
173204
filePath: '$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler/PipelineHelpers/generateMetadataFile.ps1'
174205
arguments: '-StagingDirectory "$(Pipeline.Workspace)\staging"'
175206
workingDirectory: '$(Pipeline.Workspace)'
207+
condition: and(succeeded(), eq(variables['artifactName'], 'Azure.Functions.Cli.min.win-x64'))
176208

177209
- task: PowerShell@2
178210
displayName: 'Generate MSI files'
@@ -182,8 +214,7 @@ extends:
182214
arguments: '-ArtifactsPath "$(Pipeline.Workspace)\staging\coretools-cli"'
183215
workingDirectory: '$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler'
184216

185-
186-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
217+
- task: EsrpCodeSigning@5
187218
displayName: 'ESRP CodeSigning'
188219
inputs:
189220
ConnectedServiceName: 'azfunc-internal-esrp'
@@ -226,20 +257,23 @@ extends:
226257
filePath: '$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler/PipelineHelpers/testVsArtifacts.ps1'
227258
arguments: '-StagingDirectory "$(Pipeline.Workspace)\staging\coretools-visualstudio"'
228259
workingDirectory: '$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler'
260+
condition: and(succeeded(), eq(variables['artifactName'], 'Azure.Functions.Cli.min.win-x64'))
261+
229262
- task: PowerShell@2
230263
displayName: 'Test Artifacts'
231264
inputs:
232265
targetType: filePath
233266
filePath: '$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler/PipelineHelpers/testArtifacts.ps1'
234267
arguments: '-StagingDirectory "$(Pipeline.Workspace)\staging\coretools-cli"'
235268
workingDirectory: '$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler'
269+
condition: and(succeeded(), or(eq(variables['artifactName'], 'Azure.Functions.Cli.win-x64'), eq(variables['artifactName'], 'Azure.Functions.Cli.win-x86')))
236270
- task: DotNetCoreCLI@2
237271
displayName: 'Zip Artifacts'
238272
inputs:
239273
command: run
240274
projects: '$(Build.SourcesDirectory)/src/Azure.Functions.ArtifactAssembler/Azure.Functions.ArtifactAssembler.csproj'
241275
arguments: 'zip -c release'
242-
workingDirectory: '$(Pipeline.Workspace)''
276+
workingDirectory: '$(Pipeline.Workspace)'
243277
- powershell: |
244278
$rootPath = "$(Pipeline.Workspace)\staging"
245279
$zipFiles = Get-ChildItem -Path $rootPath -Filter *.zip -Recurse
@@ -250,7 +284,7 @@ extends:
250284
Out-File -InputObject $sha -Encoding ascii -FilePath $shaFilePath -NoNewline
251285
Write-Host "Generated sha for $filePath at $shaFilePath"
252286
}
253-
displayName: 'Generate SHA files'
287+
displayName: 'Generate SHA files'
254288
255289
- pwsh: |
256290
# Guardian files in TEMP add up and can cause the AntiMalware task to timeout.
@@ -261,11 +295,10 @@ extends:
261295
displayName: 'Copy Files to Artifact Staging Directory'
262296
inputs:
263297
SourceFolder: '$(Pipeline.Workspace)/staging'
264-
Contents: '**'
298+
Contents: 'coretools-*/**'
265299
TargetFolder: '$(Build.ArtifactStagingDirectory)'
266300

267301
- powershell: |
268-
Write-Host "Value of env variable: $(Pipeline.Workspace)"
269302
Write-Host "Artifacts are stored in: D:\a\_work\1"
270303
Get-ChildItem -Path "D:\a\_work\1\a" -Recurse
271304
displayName: "List Artifact Paths"

0 commit comments

Comments
 (0)