File tree Expand file tree Collapse file tree 5 files changed +19
-18
lines changed
pipelines/templates/stages Expand file tree Collapse file tree 5 files changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -93,13 +93,14 @@ stages:
9393
9494 - task : PowerShell@2
9595 displayName : Publish Crate
96+ env :
97+ CARGO_REGISTRY_TOKEN : $(azure-sdk-cratesio-token)
9698 inputs :
9799 targetType : filePath
98100 filePath : $(Build.SourcesDirectory)/eng/scripts/Publish-Crates.ps1
99101 arguments : >
100102 -PackagesPath '$(Pipeline.Workspace)/drop'
101103 -CrateNames '${{artifact.name}}'
102- -Token $(azure-sdk-cratesio-token)
103104 -AdditionalOwners 'heaths','hallipr'
104105
105106 # - job: CreateApiReview
@@ -158,10 +159,11 @@ stages:
158159
159160 - task : PowerShell@2
160161 displayName : Yank Crates
162+ env :
163+ CARGO_REGISTRY_TOKEN : $(azure-sdk-cratesio-token)
161164 inputs :
162165 targetType : filePath
163166 filePath : $(Build.SourcesDirectory)/eng/scripts/Yank-Crates.ps1
164167 arguments :
165168 -CrateNames '${{artifact.name}}'
166- -PackagesPath '$(Pipeline.Workspace)/${{parameters.PipelineArtifactName}}'
167- -Token $(azure-sdk-cratesio-token)
169+ -PackageInfoDirectory '$(Pipeline.Workspace)/${{parameters.PipelineArtifactName}}/PackageInfo'
Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ function Get-rust-AdditionalValidationPackagesFromPackageSet ($packagesWithChang
125125 [array ]$serviceFiles = ($diff.ChangedFiles + $diff.DeletedFiles ) | ForEach-Object { $_ -replace ' \\' , ' /' } | Where-Object { $_ -match " ^sdk/.+/" }
126126 # remove files that target any specific package
127127 foreach ($package in $allPackageProperties ) {
128- $serviceFiles = $serviceFiles | Where-Object { " $RepoRoot /$_ " -notmatch " ^$ ( $package.DirectoryPath ) /" }
128+ $packagePathPattern = " ^$ ( [Regex ]::Escape($package.DirectoryPath.Replace (' \' , ' /' )) ) /"
129+ $serviceFiles = $serviceFiles | Where-Object { " $RepoRoot /$_ " .Replace(' \' , ' /' ) -notmatch $packagePathPattern }
129130 }
130131
131132 $affectedServiceDirectories = $serviceFiles | ForEach-Object { $_ -replace ' ^sdk/(.+?)/.*' , ' $1' } | Sort-Object - Unique
@@ -144,7 +145,7 @@ function Get-rust-AdditionalValidationPackagesFromPackageSet ($packagesWithChang
144145
145146function Get-rust-PackageInfoFromPackageFile ([IO.FileInfo ]$pkg , [string ]$workingDirectory ) {
146147 # $pkg will be a FileInfo object for the Cargo.toml file in a package artifact directory
147- $package = cargo read-manifest -- manifest- path $pkg.FullName
148+ $package = cargo read-manifest -- manifest- path $pkg.FullName | ConvertFrom-Json
148149
149150 $packageName = $package.name
150151 $packageVersion = $package.version
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ function Get-PackagesToBuild() {
119119
120120function Initialize-VendorDirectory () {
121121 $path = " $RepoRoot /target/vendor"
122- Invoke-LoggedCommand " cargo vendor $path " | Out-Host
122+ Invoke-LoggedCommand " cargo vendor $path " - GroupOutput | Out-Host
123123 return $path
124124}
125125
@@ -206,7 +206,7 @@ try {
206206
207207 Write-Host " Copying package '$packageName ' to '$packageOutputPath '"
208208 New-Item - ItemType Directory - Path $packageOutputPath - Force | Out-Null
209- Copy-Item - Path $targetPackagePath - Destination $packageOutputPath - Recurse - Exclude " Cargo.toml.orig"
209+ Copy-Item - Path $targetPackagePath /* - Destination $packageOutputPath - Recurse - Exclude " Cargo.toml.orig"
210210 }
211211 }
212212
Original file line number Diff line number Diff line change 44param (
55 [string ]$PackagesPath ,
66 [string []]$CrateNames ,
7- [string []]$AdditionalOwners ,
8- [string ]$Token
7+ [string []]$AdditionalOwners
98)
109
1110$ErrorActionPreference = ' Stop'
@@ -15,18 +14,18 @@ foreach ($crateName in $CrateNames) {
1514 Write-Host " Publishing packae: '$crateName '"
1615 $manifestPath = " $PackagesPath /$crateName /Cargo.toml"
1716 # https://doc.rust-lang.org/cargo/reference/registry-web-api.html#publish
18- Write-Host " > cargo publish --manifest-path `" $manifestPath `" --token <TOKEN> "
19- cargo publish -- manifest- path $manifestPath -- token $Token
17+ Write-Host " > cargo publish --manifest-path `" $manifestPath `" "
18+ cargo publish -- manifest- path $manifestPath
2019 if (! $? ) {
2120 Write-Error " Failed to publish package: '$crateName '"
2221 exit 1
2322 }
2423
25- $existingOwners = (Invoke-LoggedCommand cargo owner -- list $crateName ) -replace " \(.*" , " "
24+ $existingOwners = (cargo owner -- list $crateName ) -replace " \(.*" , " "
2625 $missingOwners = $AdditionalOwners | Where-Object { $existingOwners -notcontains $_ }
2726
2827 foreach ($owner in $missingOwners ) {
29- Write-Host " > cargo owner --add $owner $crateName --token <TOKEN> "
30- cargo owner -- add $owner $crateName -- token $Token
28+ Write-Host " > cargo owner --add $owner $crateName "
29+ cargo owner -- add $owner $crateName
3130 }
3231}
Original file line number Diff line number Diff line change 33# Requires -Version 7.0
44param (
55 [string ]$PackageInfoDirectory ,
6- [string []]$CrateNames ,
7- [string ]$Token
6+ [string []]$CrateNames
87)
98
109$ErrorActionPreference = ' Stop'
@@ -17,8 +16,8 @@ foreach ($crateName in $crateNames) {
1716
1817 Write-Host " Yanking crate: '$crateName @$crateVersion '"
1918
20- Write-Host " cargo yank $crateName --version $crateVersion --token <TOKEN> "
21- cargo yank $crateName -- version $crateVersion -- token $Token
19+ Write-Host " cargo yank $crateName --version $crateVersion "
20+ cargo yank $crateName -- version $crateVersion
2221
2322 if (! $? ) {
2423 Write-Host " Failed to yank crate: '$crateName @$crateVersion '"
You can’t perform that action at this time.
0 commit comments