5
5
# Create a build asset JSON file as a pipeline artifact and publish build artifacts to blob storage.
6
6
7
7
parameters :
8
- - name : public
9
- type : boolean
10
-
11
8
- name : pool
12
9
type : object
13
10
@@ -28,34 +25,19 @@ parameters:
28
25
default : false
29
26
30
27
stages :
31
- - stage : Publish${{ parameters.public }}
32
- ${{ if parameters.public }} :
33
- displayName : Publish Public
34
- ${{ else }} :
35
- displayName : Publish Internal
28
+ - stage : PrePublish
29
+ displayName : Pre Internal Publish
36
30
${{ if eq(parameters.publishExistingRunID, 'nil') }} :
37
31
dependsOn : Sign
38
32
${{ else }} :
39
33
dependsOn : []
34
+
40
35
jobs :
41
- - job : Publish
36
+ - job : PrePublish
42
37
pool : ${{ parameters.pool }}
43
38
44
39
variables :
45
- - name : blobBackupAccount
46
- value : golangartifactsbackup
47
- - name : blobContainer
48
- ${{ if parameters.public }} :
49
- value : ' https://dotnetbuildoutput.blob.core.windows.net/golang/microsoft'
50
- ${{ else }} :
51
- value : ' https://$(blobBackupAccount).blob.core.windows.net/microsoft'
52
-
53
- - name : blobPrefix
54
- value : ' $(PublishBranchAlias)/$(Build.BuildNumber)'
55
- - name : blobDestinationUrl
56
- value : ' $(blobContainer)/$(blobPrefix)'
57
-
58
- - group : go-storage
40
+ - template : ../variables/publish-internal.yml
59
41
60
42
workspace :
61
43
clean : all
@@ -68,17 +50,11 @@ stages:
68
50
# Single file publish requires folder to be specified.
69
51
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sbom#specifying-sbom-build-drop-path-build-component-path-package-name-and-package-version-per-1es-pt-output
70
52
sbomBuildDropPath : $(Pipeline.Workspace)/Binaries Signed
71
- ${{ if parameters.public }} :
72
- artifact : BuildAssets
73
- ${{ else }} :
74
- artifact : BuildAssetsInternal
53
+ artifact : BuildAssetsInternal
75
54
- ${{ if parameters.publishSymbols }} :
76
55
- output : pipelineArtifact
77
56
path : $(Pipeline.Workspace)/Symbols
78
- ${{ if parameters.public }} :
79
- artifact : Symbols
80
- ${{ else }} :
81
- artifact : SymbolsInternal
57
+ artifact : SymbolsInternal
82
58
83
59
steps :
84
60
- template : ../steps/checkout-windows-task.yml
@@ -96,40 +72,9 @@ stages:
96
72
-destination-url '$(blobDestinationUrl)' `
97
73
-branch '$(PublishBranchAlias)' `
98
74
-o '$(Pipeline.Workspace)/Binaries Signed/assets.json'
99
- displayName: 'Create build asset JSON'
100
-
101
- - ${{ if parameters.public }} :
102
- - task : AzureCLI@2
103
- displayName : Upload to blob storage
104
- inputs :
105
- azureSubscription : GoLang
106
- scriptType : bash
107
- scriptLocation : inlineScript
108
- # Send literal '*' to az: it handles the wildcard itself. Az copy only accepts one
109
- # "from" argument, so we can't use the shell's wildcard expansion.
110
- inlineScript : |
111
- az storage copy -s '*' -d '$(blobDestinationUrl)' --sas-token '$(dotnetbuildoutput-golang-write-sas-query)'
112
- workingDirectory : ' $(Pipeline.Workspace)/Binaries Signed/'
113
- - ${{ else }} :
114
- - task : AzureFileCopy@6
115
- displayName : Upload to blob storage
116
- inputs :
117
- Destination : AzureBlob
118
- azureSubscription : golang-pme-storage
119
- storage : $(blobBackupAccount)
120
- ContainerName : microsoft
121
- SourcePath : ' $(Pipeline.Workspace)/Binaries Signed/*'
122
- BlobPrefix : $(blobPrefix)
123
-
124
- - pwsh : |
125
- Write-Host 'Generated links to artifacts in blob storage:'
126
- Write-Host ''
127
- Get-ChildItem -File -Path '.' | %{
128
- Write-Host "$(blobDestinationUrl)/$($_.Name)"
129
- }
130
- displayName: Show expected uploaded URLs
131
- workingDirectory: '$(Pipeline.Workspace)/Binaries Signed/'
75
+ displayName: '🧾 Create build asset JSON'
132
76
77
+ # Gather symbols from all builders.
133
78
- ${{ if eq(parameters.publishSymbols, true) }} :
134
79
- ${{ each builder in parameters.builders }} :
135
80
- ${{ if eq(parameters.publishExistingRunID, 'nil') }} :
@@ -164,8 +109,62 @@ stages:
164
109
}
165
110
Copy-Item $_.FullName $flatDir
166
111
}
167
- displayName: 'Flatten: Symbols ${{ builder.id }}'
112
+ displayName: '🫓 Flatten: Symbols ${{ builder.id }}'
168
113
workingDirectory: '$(Pipeline.Workspace)'
114
+
115
+ - stage : Publish
116
+ displayName : Publish Internal
117
+ dependsOn : PrePublish
118
+
119
+ jobs :
120
+ - job : Publish
121
+ pool : ${{ parameters.pool }}
122
+
123
+ variables :
124
+ - template : ../variables/publish-internal.yml
125
+
126
+ workspace :
127
+ clean : all
128
+
129
+ templateContext :
130
+ type : releaseJob # https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/releasepipelines/releaseworkflows/releasejob
131
+ isProduction : true
132
+ inputs :
133
+ - input : pipelineArtifact
134
+ artifactName : BuildAssetsInternal
135
+ - ${{ if parameters.publishSymbols }} :
136
+ - input : pipelineArtifact
137
+ artifactName : SymbolsInternal
138
+ path : $(Pipeline.Workspace)/Symbols
139
+
140
+ steps :
141
+ - template : ../steps/find-PublishBranchAlias-task.yml
142
+
143
+ - template : ../steps/download-signed-binaries-task.yml
144
+ parameters :
145
+ runID : ${{ parameters.publishExistingRunID }}
146
+ ReleaseJob : true
147
+
148
+ - task : AzureFileCopy@6
149
+ displayName : ↗️ Upload to blob storage
150
+ inputs :
151
+ Destination : AzureBlob
152
+ azureSubscription : golang-pme-storage
153
+ storage : $(blobBackupAccount)
154
+ ContainerName : microsoft
155
+ SourcePath : ' $(Pipeline.Workspace)/Binaries Signed/*'
156
+ BlobPrefix : $(blobPrefix)
157
+
158
+ - pwsh : |
159
+ Write-Host 'Generated links to artifacts in blob storage:'
160
+ Write-Host ''
161
+ Get-ChildItem -File -Path '.' | %{
162
+ Write-Host "$(blobDestinationUrl)/$($_.Name)"
163
+ }
164
+ displayName: 🧾 Show expected uploaded URLs
165
+ workingDirectory: '$(Pipeline.Workspace)/Binaries Signed/'
166
+
167
+ - ${{ if parameters.publishSymbols }} :
169
168
- task : PublishSymbols@2
170
169
inputs :
171
170
SymbolsFolder : $(Pipeline.Workspace)/Symbols
@@ -175,4 +174,4 @@ stages:
175
174
# in the AzDO repo, but we pull them at build time using a git submodule.
176
175
# See https://github.com/microsoft/go-lab/issues/67.
177
176
IndexSources : false
178
- displayName : Publish symbols
177
+ displayName : ↗️ Publish symbols
0 commit comments