Skip to content

Commit 4af13a8

Browse files
committed
Switch OneBranch to msazure CFS feed
Which removes the need to do complicated authentication.
1 parent 6bf1cbd commit 4af13a8

2 files changed

Lines changed: 14 additions & 67 deletions

File tree

.pipelines/DSC-Official.yml

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,13 @@ extends:
9999
Write-Host "##$vstsCommandString"
100100
name: Package
101101
displayName: Set Package Version
102-
- task: AzureCLI@2
103-
displayName: Get Az Token
104-
inputs:
105-
azureSubscription: PowerShell-CICD-Feed-Access
106-
scriptType: pscore
107-
scriptLocation: inlineScript
108-
inlineScript: |
109-
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
110-
$vstsCommandString = "vso[task.setvariable variable=AzToken;isoutput=true]$token"
111-
Write-Host "Setting token"
112-
Write-Host "##$vstsCommandString"
113102
114103
- job: BuildWin_x64
115104
dependsOn: SetPackageVersion
116105
variables:
117106
ob_sdl_tsa_configFile: '$(System.DefaultWorkingDirectory)\.config\tsaoptions.json'
118107
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
119108
signSrcPath: '$(System.DefaultWorkingDirectory)\out'
120-
AzToken: $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
121109
ob_sdl_sbom_enabled: true
122110
ob_signing_setup_enabled: true
123111
ob_sdl_codeql_compiled_enabled: true
@@ -129,7 +117,6 @@ extends:
129117
buildName: x86_64-pc-windows-msvc
130118
signSrcPath: '$(signSrcPath)'
131119
PackageRoot: '$(PackageRoot)'
132-
aztoken: '$(AzToken)'
133120
rustSDK: '$(Rust.SDK)'
134121

135122
- job: BuildWin_arm64
@@ -138,7 +125,6 @@ extends:
138125
ob_sdl_tsa_configFile: '$(System.DefaultWorkingDirectory)\.config\tsaoptions.json'
139126
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
140127
signSrcPath: '$(System.DefaultWorkingDirectory)\out'
141-
AzToken: $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
142128
ob_sdl_sbom_enabled: true
143129
ob_signing_setup_enabled: true
144130
ob_sdl_codeql_compiled_enabled: true
@@ -150,7 +136,6 @@ extends:
150136
buildName: aarch64-pc-windows-msvc
151137
signSrcPath: '$(signSrcPath)'
152138
PackageRoot: '$(PackageRoot)'
153-
aztoken: '$(AzToken)'
154139
rustSDK: '$(Rust.SDK)'
155140

156141
- job: CreateMsixBundle
@@ -167,7 +152,6 @@ extends:
167152
ob_sdl_sbom_enabled: false
168153
ob_signing_setup_enabled: false
169154
ob_sdl_codeql_compiled_enabled: false
170-
ob_restore_phase: true
171155
pool:
172156
type: windows
173157
steps:
@@ -302,7 +286,6 @@ extends:
302286
variables:
303287
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
304288
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
305-
AzToken: $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
306289
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
307290
ob_linuxSymbolsPublishing_enabled: true
308291
ob_linuxSymbolsPublishing_symbolsFolder: '$(System.DefaultWorkingDirectory)/DSC/bin'
@@ -317,14 +300,13 @@ extends:
317300
toolchainFeed: $(Rust.SDK)
318301
additionalTargets: x86_64-unknown-linux-musl
319302
displayName: Install Rust
320-
env:
321-
ob_restore_phase: true
303+
- task: CargoAuthenticate@0
304+
inputs:
305+
configFile: '.cargo/config.toml'
306+
displayName: Authenticate with Azure Artifacts
322307
- pwsh: |
323308
apt update
324309
apt -y install musl-tools rpm dpkg build-essential protobuf-compiler
325-
$header = "Bearer $(AzToken)"
326-
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
327-
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
328310
./build.ps1 -Release -Architecture x86_64-unknown-linux-musl
329311
./packaging.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-musl -Release
330312
./packaging.ps1 -PackageType rpm -Architecture x86_64-unknown-linux-musl -Release
@@ -340,7 +322,6 @@ extends:
340322
variables:
341323
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204-arm64:latest'
342324
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
343-
AzToken: $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
344325
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
345326
ob_linuxSymbolsPublishing_enabled: true
346327
ob_linuxSymbolsPublishing_symbolsFolder: '$(System.DefaultWorkingDirectory)/DSC/bin'
@@ -356,16 +337,10 @@ extends:
356337
toolchainFeed: $(Rust.SDK)
357338
additionalTargets: aarch64-unknown-linux-musl
358339
displayName: Install Rust
359-
env:
360-
ob_restore_phase: true
361-
- task: AzureCLI@2
362-
displayName: Azure CLI
340+
- task: CargoAuthenticate@0
363341
inputs:
364-
azureSubscription: PowerShell-CICD-Feed-Access
365-
scriptType: pscore
366-
scriptLocation: inlineScript
367-
inlineScript: |
368-
az account show
342+
configFile: '.cargo/config.toml'
343+
displayName: Authenticate with Azure Artifacts
369344
- pwsh: |
370345
$env:CC_aarch64_unknown_linux_musl='clang'
371346
$env:AR_aarch64_unknown_linux_musl='llvm-ar'
@@ -386,9 +361,6 @@ extends:
386361
if ((openssl version -d) -match 'OPENSSLDIR: "(?<dir>.*?)"') {
387362
$env:OPENSSL_LIB_DIR = $matches['dir']
388363
}
389-
$header = "Bearer $(AzToken)"
390-
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
391-
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
392364
./build.ps1 -Release -Architecture aarch64-unknown-linux-musl
393365
./packaging.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-musl -Release
394366
./packaging.ps1 -PackageType rpm -Architecture aarch64-unknown-linux-musl -Release
@@ -403,7 +375,6 @@ extends:
403375
dependsOn: SetPackageVersion
404376
variables:
405377
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
406-
AzToken: $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
407378
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
408379
displayName: BuildMac
409380
pool:
@@ -424,20 +395,11 @@ extends:
424395
toolchainFeed: $(Rust.SDK)
425396
additionalTargets: $(buildName)
426397
displayName: Install Rust
427-
env:
428-
ob_restore_phase: true
429-
- task: AzureCLI@2
430-
displayName: Azure CLI
398+
- task: CargoAuthenticate@0
431399
inputs:
432-
azureSubscription: PowerShell-CICD-Feed-Access
433-
scriptType: pscore
434-
scriptLocation: inlineScript
435-
inlineScript: |
436-
az account show
400+
configFile: '.cargo/config.toml'
401+
displayName: Authenticate with Azure Artifacts
437402
- pwsh: |
438-
$header = "Bearer $(AzToken)"
439-
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
440-
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
441403
Write-Verbose -Verbose "Building for $(buildName)"
442404
./build.ps1 -Release -Architecture $(buildName)
443405
./packaging.ps1 -PackageType tgz -Architecture $(buildName) -Release

.pipelines/DSC-Windows.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,31 @@ parameters:
88
- name: BuildConfiguration
99
type: string
1010
default: Release
11-
- name: aztoken
12-
type: string
1311
- name: RustSDK
1412
type: string
1513

1614
steps:
1715
- checkout: self
18-
env:
19-
ob_restore_phase: true
2016
- task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
2117
inputs:
2218
Enabled: true
2319
AnalyzeInPipeline: true
2420
Language: rust
25-
env:
26-
ob_restore_phase: true
2721
- pwsh: |
2822
$tmpdir = "$(Agent.TempDirectory)"
2923
Write-Host "##vso[task.setvariable variable=CARGO_TARGET_DIR;]$tmpdir"
3024
displayName: 🛠️ Workaround for the LoadLibrary ACCESS_VIOLATION OneBranch issue
31-
env:
32-
ob_restore_phase: true
3325
- task: RustInstaller@1
3426
inputs:
3527
rustVersion: ms-prod-1.93
3628
toolchainFeed: ${{ parameters.RustSDK }}
3729
additionalTargets: ${{ parameters.buildName }}
3830
displayName: Install Rust
39-
env:
40-
ob_restore_phase: true
31+
- task: CargoAuthenticate@0
32+
inputs:
33+
configFile: '.cargo/config.toml'
34+
displayName: Authenticate with Azure Artifacts
4135
- pwsh: |
42-
$header = "Bearer ${{ parameters.aztoken }}"
43-
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
44-
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
4536
Set-Location "$(Build.SourcesDirectory)/DSC"
4637
$LLVMBIN = "$($env:PROGRAMFILES)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin"
4738
if (!(Test-Path $LLVMBIN)) {
@@ -52,13 +43,9 @@ steps:
5243
Write-Verbose -Verbose "Building for ${{ parameters.buildName }}"
5344
./build.ps1 -Release -Architecture ${{ parameters.buildName }} -SkipLinkCheck -Verbose
5445
displayName: 'Build ${{ parameters.buildName }}'
55-
env:
56-
ob_restore_phase: true
5746
condition: succeeded()
5847
- task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
5948
condition: always()
60-
env:
61-
ob_restore_phase: true
6249
- pwsh: |
6350
$null = New-Item -ItemType Directory -Path "${{ parameters.PackageRoot }}" -ErrorAction Ignore
6451
$null = New-Item -ItemType Directory -Path "${{ parameters.PackageRoot }}/out" -ErrorAction Ignore
@@ -72,8 +59,6 @@ steps:
7259
write-host 'Binaries in ${{ parameters.signSrcPath }}'
7360
dir -r "${{ parameters.signSrcPath }}"
7461
displayName: Copy built binaries
75-
env:
76-
ob_restore_phase: true
7762
condition: succeeded()
7863
- task: onebranch.pipeline.signing@1
7964
displayName: Sign 1st party files

0 commit comments

Comments
 (0)