Skip to content

Commit 71d8ef8

Browse files
committed
Only publish to the VS feed for our official build
1 parent 97e9ee7 commit 71d8ef8

File tree

6 files changed

+28
-85
lines changed

6 files changed

+28
-85
lines changed

azure-pipelines-official.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ extends:
268268
# Authenticate with service connections to be able to publish packages to external nuget feeds.
269269
- task: NuGetAuthenticate@1
270270
inputs:
271-
nuGetServiceConnections: azure-public/vs-impl, azure-public/vssdk, devdiv/engineering, devdiv/dotnet-core-internal-tooling
271+
nuGetServiceConnections: azure-public/vs-impl, azure-public/vssdk, devdiv/engineering, devdiv/dotnet-core-internal-tooling, DevDiv - VS package feed
272272

273273
# Needed for SBOM tool
274274
- task: UseDotNet@2
@@ -398,7 +398,7 @@ extends:
398398
componentPassword: $(dn-bot-dnceng-build-e-code-full-release-e-packaging-r)
399399
componentBuildProjectName: internal
400400
sourceBranch: "$(ComponentBranchName)"
401-
publishDataURI: "https://dev.azure.com/dnceng/internal/_apis/git/repositories/dotnet-roslyn/items?path=eng/config/PublishData.json&api-version=6.0"
401+
publishDataURI: "https://dev.azure.com/dnceng/internal/_apis/git/repositories/dotnet-roslyn/items?path=eng/config/PublishData.json&version=$(ComponentBranchName)&api-version=6.0"
402402
publishDataAccessToken: "$(System.AccessToken)"
403403
dropPath: '$(Pipeline.Workspace)\VSSetup'
404404
cherryPick: ${{ parameters.VisualStudioCherryPickSHA }}

azure-pipelines-pr-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ extends:
262262
displayName: Publish Assets
263263
inputs:
264264
filePath: 'eng\publish-assets.ps1'
265-
arguments: '-configuration $(BuildConfiguration) -branchName "$(SourceBranchName)" -prValidation'
265+
arguments: '-configuration $(BuildConfiguration) -branchName "$(SourceBranchName)"'
266266
condition: succeeded()
267267

268268
- task: PublishTestResults@2
@@ -357,7 +357,7 @@ extends:
357357
vsBranchName: ${{ parameters.VisualStudioBranchName }}
358358
titlePrefix: ${{ parameters.OptionalTitlePrefix }}
359359
sourceBranch: $(ComponentBranchName)
360-
publishDataURI: "https://raw.githubusercontent.com/dotnet/roslyn/main/eng/config/PublishData.json"
360+
publishDataURI: "https://raw.githubusercontent.com/dotnet/roslyn/$(ComponentBranchName)/eng/config/PublishData.json"
361361
queueSpeedometerValidation: true
362362
dropPath: '$(Pipeline.Workspace)\VSSetup'
363363
retainInsertedBuild: false

eng/Versions.props

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
Roslyn version
77
-->
88
<PropertyGroup>
9+
<!-- All packages produced by the Roslyn official build should be suffixed with '-vs' to distinguish them from VMR produced packages -->
10+
<RoslynPackageSuffix Condition="'$(DotNetBuildFromVMR)' != 'true'">-vs</RoslynPackageSuffix>
11+
912
<MajorVersion>5</MajorVersion>
1013
<MinorVersion>0</MinorVersion>
1114
<PatchVersion>0</PatchVersion>
12-
<PreReleaseVersionLabel>2</PreReleaseVersionLabel>
15+
<PreReleaseVersionLabel>2$(RoslynPackageSuffix)</PreReleaseVersionLabel>
1316
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
1417
<!--
1518
By default the assembly version in official builds is "$(MajorVersion).$(MinorVersion).0.0".

eng/build-utils.ps1

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ $ErrorActionPreference="Stop"
88

99
$VSSetupDir = Join-Path $ArtifactsDir "VSSetup\$configuration"
1010
$PackagesDir = Join-Path $ArtifactsDir "packages\$configuration"
11-
$PublishDataUrl = "https://raw.githubusercontent.com/dotnet/roslyn/main/eng/config/PublishData.json"
1211

1312
$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $false }
1413
$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { $false }
@@ -22,19 +21,21 @@ function GetProjectOutputBinary([string]$fileName, [string]$projectName = "", [s
2221
return Join-Path $ArtifactsDir "bin\$projectName\$configuration\$tfm\$ridDir$publishDir$fileName"
2322
}
2423

25-
function GetPublishData() {
24+
function GetPublishData([string]$branchName) {
2625
if (Test-Path variable:global:_PublishData) {
2726
return $global:_PublishData
2827
}
2928

30-
Write-Host "Downloading $PublishDataUrl"
31-
$content = (Invoke-WebRequest -Uri $PublishDataUrl -UseBasicParsing).Content
29+
$publishDataFile = Join-Path $PSScriptRoot "config\PublishData.json"
30+
31+
Write-Host "Reading $publishDataFile"
32+
$content = Get-Content -Path $publishDataFile -Raw
3233

3334
return $global:_PublishData = ConvertFrom-Json $content
3435
}
3536

3637
function GetBranchPublishData([string]$branchName) {
37-
$data = GetPublishData
38+
$data = GetPublishData $branchName
3839

3940
if (Get-Member -InputObject $data.branches -Name $branchName) {
4041
return $data.branches.$branchName
@@ -48,15 +49,6 @@ function GetFeedPublishData() {
4849
return $data.feeds
4950
}
5051

51-
function GetPackagesPublishData([string]$packageFeeds) {
52-
$data = GetPublishData
53-
if (Get-Member -InputObject $data.packages -Name $packageFeeds) {
54-
return $data.packages.$packageFeeds
55-
} else {
56-
return $null
57-
}
58-
}
59-
6052
function GetReleasePublishData([string]$releaseName) {
6153
$data = GetPublishData
6254

eng/config/PublishData.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"feeds": {
33
"vssdk": "https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json",
44
"vs-impl": "https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json",
5-
"vs": "https://pkgs.dev.azure.com/DevDiv/_packaging/VS/nuget/v3/index.json"
5+
"vs": "https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json"
66
},
77
"packages": {
88
"default": {
@@ -188,22 +188,20 @@
188188
"insertionCreateDraftPR": false
189189
},
190190
"community": {
191-
"nugetKind": [
192-
"Shipping",
193-
"NonShipping"
194-
],
195191
"vsBranch": "main",
196192
"insertionCreateDraftPR": true,
197193
"insertionTitlePrefix": "[Validation]"
198194
},
199195
"main": {
200-
"nugetKind": [
201-
"Shipping",
202-
"NonShipping"
203-
],
204196
"vsBranch": "main",
205197
"insertionCreateDraftPR": true,
206198
"insertionTitlePrefix": "[Validation]"
199+
},
200+
"dev/dibarbet/vs_packages": {
201+
"vsBranch": "main",
202+
"insertionCreateDraftPR": true,
203+
"insertionTitlePrefix": "[Validation]",
204+
"feed": "vs"
207205
}
208206
}
209207
}

eng/publish-assets.ps1

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Param(
1313
[string]$branchName = "",
1414
[string]$releaseName = "",
1515
[switch]$test,
16-
[switch]$prValidation,
1716

1817
# Credentials
1918
[string]$nugetApiKey = ""
@@ -27,6 +26,7 @@ function Get-PublishKey([string]$uploadUrl) {
2726
switch ($url.Host) {
2827
"api.nuget.org" { return $nugetApiKey }
2928
# For publishing to azure, the API key can be any non-empty string as authentication is done in the pipeline.
29+
"devdiv.pkgs.visualstudio.com" { return "AzureArtifacts" }
3030
"pkgs.dev.azure.com" { return "AzureArtifacts"}
3131
default { throw "Cannot determine publish key for $uploadUrl" }
3232
}
@@ -38,28 +38,13 @@ function Publish-Nuget($publishData, [string]$packageDir) {
3838
# Retrieve the feed name to source mapping.
3939
$feedData = GetFeedPublishData
4040

41-
# Let packageFeeds default to the default set of feeds
42-
$packageFeeds = "default"
43-
if ($publishData.PSobject.Properties.Name -contains "packageFeeds") {
44-
$packageFeeds = $publishData.packageFeeds
45-
}
46-
47-
# If the configured packageFeeds is arcade, then skip publishing here. Arcade will handle publishing packages to their feeds.
48-
if ($packageFeeds.equals("arcade") -and -not $prValidation) {
49-
Write-Host " Skipping publishing for all packages as they will be published by arcade"
50-
continue
51-
}
41+
# The default feed we publish to for our official build is the VS feed.
42+
$feedName = "vs"
5243

53-
# Let packageFeeds default to the default set of feeds
54-
$packageFeeds = "default"
55-
if ($publishData.PSobject.Properties.Name -contains "packageFeeds") {
56-
$packageFeeds = $publishData.packageFeeds
44+
if ($publishData.PSobject.Properties.Name -contains "feed") {
45+
$feedName = $publishData.feed
5746
}
5847

59-
# Each branch stores the name of the package to feed map it should use.
60-
# Retrieve the correct map for this particular branch.
61-
$packagesData = GetPackagesPublishData $packageFeeds
62-
6348
foreach ($package in Get-ChildItem *.nupkg) {
6449
Write-Host ""
6550

@@ -74,29 +59,6 @@ function Publish-Nuget($publishData, [string]$packageDir) {
7459
continue
7560
}
7661

77-
$nupkgWithoutVersion = $nupkg -replace '(\.\d+){3}-.*.nupkg', ''
78-
if ($nupkgWithoutVersion.EndsWith(".Symbols")) {
79-
Write-Host "Skipping symbol package $nupkg"
80-
continue
81-
}
82-
83-
# Lookup the feed name from the packages map using the package name without the version or extension.
84-
if (-not (Get-Member -InputObject $packagesData -Name $nupkgWithoutVersion)) {
85-
throw "$nupkg has no configured feed (looked for $nupkgWithoutVersion)"
86-
}
87-
88-
$feedName = $packagesData.$nupkgWithoutVersion
89-
90-
if ($prValidation) {
91-
$feedName = "vs"
92-
}
93-
94-
# If the configured feed is arcade, then skip publishing here. Arcade will handle publishing to their feeds.
95-
if ($feedName.equals("arcade")) {
96-
Write-Host "Skipping publishing for $nupkg as it is published by arcade"
97-
continue
98-
}
99-
10062
# Use the feed name to get the source to upload the package to.
10163
if (-not (Get-Member -InputObject $feedData -Name $feedName)) {
10264
throw "$feedName has no configured source feed"
@@ -116,23 +78,11 @@ function Publish-Nuget($publishData, [string]$packageDir) {
11678
}
11779
}
11880

119-
# Do basic verification on the values provided in the publish configuration
120-
function Test-Entry($publishData, [switch]$isBranch) {
121-
if ($isBranch) {
122-
foreach ($nugetKind in $publishData.nugetKind) {
123-
if ($nugetKind -ne "PerBuildPreRelease" -and $nugetKind -ne "Shipping" -and $nugetKind -ne "NonShipping") {
124-
throw "Branches are only allowed to publish Shipping, NonShipping, or PerBuildPreRelease"
125-
}
126-
}
127-
}
128-
}
129-
13081
# Publish a given entry: branch or release.
13182
function Publish-Entry($publishData, [switch]$isBranch) {
132-
Test-Entry $publishData -isBranch:$isBranch
133-
13483
# First publish the NuGet packages to the specified feeds
135-
foreach ($nugetKind in $publishData.nugetKind) {
84+
$nugetKinds = @('Shipping', 'NonShipping')
85+
foreach ($nugetKind in $nugetKinds) {
13686
Publish-NuGet $publishData (Join-Path $PackagesDir $nugetKind)
13787
}
13888

0 commit comments

Comments
 (0)