@@ -75,13 +75,25 @@ extends:
75
75
Write-Host ("sending " + $vstsCommandString)
76
76
Write-Host "##$vstsCommandString"
77
77
name: Package
78
+ - task : AzureCLI@2
79
+ displayName : Get Az Token
80
+ inputs :
81
+ azureSubscription : az-blob-cicd-infra
82
+ scriptType : pscore
83
+ scriptLocation : inlineScript
84
+ inlineScript : |
85
+ $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
86
+ $vstsCommandString = "vso[task.setvariable variable=AzToken;]$token"
87
+ Write-Host "Setting token"
88
+ Write-Host "##$vstsCommandString"
78
89
79
90
- job : BuildWin_x64
80
91
dependsOn : SetPackageVersion
81
92
variables :
82
93
ob_sdl_tsa_configFile : ' $(Build.SourcesDirectory)\DSC\.config\tsaoptions.json'
83
94
ob_outputDirectory : ' $(Build.ArtifactStagingDirectory)'
84
95
signSrcPath : ' $(Build.SourcesDirectory)\out'
96
+ AzToken : $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
85
97
ob_sdl_sbom_enabled : true
86
98
ob_signing_setup_enabled : true
87
99
ob_sdl_codeql_compiled_enabled : true
@@ -93,6 +105,7 @@ extends:
93
105
buildName : x86_64-pc-windows-msvc
94
106
signSrcPath : ' $(signSrcPath)'
95
107
PackageRoot : ' $(PackageRoot)'
108
+ token : ' $(AzToken)'
96
109
97
110
- job : BuildWin_arm64
98
111
dependsOn : SetPackageVersion
@@ -111,6 +124,7 @@ extends:
111
124
buildName : aarch64-pc-windows-msvc
112
125
signSrcPath : ' $(signSrcPath)'
113
126
PackageRoot : ' $(PackageRoot)'
127
+ token : ' $(AzToken)'
114
128
115
129
- job : CreateMsixBundle
116
130
dependsOn :
@@ -155,6 +169,7 @@ extends:
155
169
variables :
156
170
LinuxContainerImage : ' onebranch.azurecr.io/linux/ubuntu-2204:latest'
157
171
PackageVersion : $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
172
+ AzToken : $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
158
173
ob_outputDirectory : ' $(Build.ArtifactStagingDirectory)'
159
174
displayName : Linux-x64-musl
160
175
pool :
@@ -168,17 +183,12 @@ extends:
168
183
displayName : Install Rust
169
184
env :
170
185
ob_restore_phase : true
171
- - task : AzureCLI@2
172
- displayName : Azure CLI
173
- inputs :
174
- azureSubscription : az-blob-cicd-infra
175
- scriptType : pscore
176
- scriptLocation : inlineScript
177
- inlineScript : |
178
- az account show
179
186
- pwsh : |
180
187
apt update
181
188
apt -y install musl-tools
189
+ $header = "Bearer $accessToken"
190
+ $env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
191
+ $env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
182
192
./build.ps1 -Release -Architecture x86_64-unknown-linux-musl
183
193
./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-musl -Release
184
194
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
@@ -190,6 +200,7 @@ extends:
190
200
variables :
191
201
LinuxContainerImage : ' onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
192
202
PackageVersion : $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
203
+ AzToken : $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
193
204
ob_outputDirectory : ' $(Build.ArtifactStagingDirectory)'
194
205
displayName : Linux-ARM64-musl
195
206
pool :
@@ -227,6 +238,9 @@ extends:
227
238
if ((openssl version -d) -match 'OPENSSLDIR: "(?<dir>.*?)"') {
228
239
$env:OPENSSL_LIB_DIR = $matches['dir']
229
240
}
241
+ $header = "Bearer $accessToken"
242
+ $env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
243
+ $env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
230
244
./build.ps1 -Release -Architecture aarch64-unknown-linux-musl
231
245
./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-musl -Release
232
246
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
@@ -237,6 +251,7 @@ extends:
237
251
dependsOn : SetPackageVersion
238
252
variables :
239
253
PackageVersion : $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
254
+ AzToken : $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
240
255
ob_outputDirectory : ' $(Build.ArtifactStagingDirectory)'
241
256
displayName : BuildMac
242
257
pool :
@@ -268,6 +283,9 @@ extends:
268
283
inlineScript : |
269
284
az account show
270
285
- pwsh : |
286
+ $header = "Bearer $accessToken"
287
+ $env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
288
+ $env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
271
289
./build.ps1 -Release -Architecture $(buildName)
272
290
./build.ps1 -PackageType tgz -Architecture $(buildName) -Release
273
291
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
0 commit comments