Skip to content

Commit a5efbcf

Browse files
Add Update-dotnet-CIConfig (Azure#17037)
* Add Update-dotnet-CIConfig * Switch from using BuildNumber to BuildID for test versions
1 parent e1caefd commit a5efbcf

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

eng/pipelines/templates/jobs/archetype-sdk-client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
pwsh: true
1414
workingDirectory: $(Build.SourcesDirectory)
1515
filePath: eng/scripts/SetTestPipelineVersion.ps1
16-
arguments: '-BuildNumber $(Build.BuildNumber)'
16+
arguments: '-BuildID $(Build.BuildId)'
1717
- pwsh: |
1818
echo "##vso[build.addbuildtag]Scheduled"
1919
displayName: "Tag scheduled builds"

eng/pipelines/templates/stages/archetype-net-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ stages:
6363
pwsh: true
6464
workingDirectory: $(Build.SourcesDirectory)
6565
filePath: eng/scripts/SetTestPipelineVersion.ps1
66-
arguments: '-BuildNumber $(Build.BuildNumber)'
66+
arguments: '-BuildID $(Build.BuildId)'
6767
- template: /eng/common/pipelines/templates/steps/verify-changelog.yml
6868
parameters:
6969
PackageName: ${{artifact.name}}

eng/scripts/Language-Settings.ps1

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function Publish-dotnet-GithubIODocs ($DocLocation, $PublicArtifactLocation)
110110
New-Item -ItemType directory -Path $TempDir
111111

112112
Expand-Archive -LiteralPath $PublishedDocs[0].FullName -DestinationPath $DocsStagingDir
113-
$pkgProperties = ParseNugetPackage -pkg $PublishedPkgs[0].FullName -workingDirectory $TempDir
113+
$pkgProperties = Get-dotnet-PackageInfoFromPackageFile -pkg $PublishedPkgs[0].FullName -workingDirectory $TempDir
114114

115115
Write-Host "Start Upload for $($pkgProperties.ReleaseTag)"
116116
Write-Host "DocDir $($DocsStagingDir)"
@@ -128,4 +128,47 @@ function Get-dotnet-GithubIoDocIndex() {
128128
$tocContent = Get-TocMapping -metadata $metadata -artifacts $artifacts
129129
# Generate yml/md toc files and build site.
130130
GenerateDocfxTocContent -tocContent $tocContent -lang "NET"
131+
}
132+
133+
# details on CSV schema can be found here
134+
# https://review.docs.microsoft.com/en-us/help/onboard/admin/reference/dotnet/documenting-nuget?branch=master#set-up-the-ci-job
135+
function Update-dotnet-CIConfig($pkgs, $ciRepo, $locationInDocRepo, $monikerId=$null){
136+
$csvLoc = (Join-Path -Path $ciRepo -ChildPath $locationInDocRepo)
137+
138+
if (-not (Test-Path $csvLoc)) {
139+
Write-Error "Unable to locate package csv at location $csvLoc, exiting."
140+
exit(1)
141+
}
142+
143+
$allCSVRows = Get-Content $csvLoc
144+
$visibleInCI = @{}
145+
146+
# first pull what's already available
147+
for ($i=0; $i -lt $allCSVRows.Length; $i++) {
148+
$pkgDef = $allCSVRows[$i]
149+
150+
# get rid of the modifiers to get just the package id
151+
$id = $pkgDef.split(",")[1] -replace "\[.*?\]", ""
152+
153+
$visibleInCI[$id] = $i
154+
}
155+
156+
foreach ($releasingPkg in $pkgs) {
157+
$installModifiers = "tfm=netstandard2.0"
158+
if ($releasingPkg.IsPrerelease) {
159+
$installModifiers += ";isPrerelease=true"
160+
}
161+
$lineId = $releasingPkg.PackageId.Replace(".","").ToLower()
162+
163+
if ($visibleInCI.ContainsKey($releasingPkg.PackageId)) {
164+
$packagesIndex = $visibleInCI[$releasingPkg.PackageId]
165+
$allCSVRows[$packagesIndex] = "$($lineId),[$installModifiers]$($releasingPkg.PackageId)"
166+
}
167+
else {
168+
$newItem = "$($lineId),[$installModifiers]$($releasingPkg.PackageId)"
169+
$allCSVRows += ($newItem)
170+
}
171+
}
172+
173+
Set-Content -Path $csvLoc -Value $allCSVRows
131174
}

eng/scripts/SetTestPipelineVersion.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
param (
55
[Parameter(mandatory = $true)]
6-
$BuildNumber
6+
$BuildID
77
)
88

99
. "${PSScriptRoot}\..\common\scripts\common.ps1"
@@ -22,7 +22,7 @@ LogDebug "Last Published Version $($semVarsSorted[0])"
2222

2323
$newVersion = [AzureEngSemanticVersion]::ParseVersionString($semVarsSorted[0])
2424
$newVersion.PrereleaseLabel = "beta"
25-
$newVersion.PrereleaseNumber = $BuildNumber
25+
$newVersion.PrereleaseNumber = $BuildID
2626

2727
LogDebug "Version to publish [ $($newVersion.ToString()) ]"
2828

0 commit comments

Comments
 (0)