Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publishing problems #5538

Merged
merged 5 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 0 additions & 37 deletions build/publish.proj
Original file line number Diff line number Diff line change
@@ -1,51 +1,14 @@
<Project>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.BuildTools" Version="$(BuildToolsPackageVersion)" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />

<UsingTask TaskName="ExecWithRetriesForNuGetPush" AssemblyFile="$(NuGetPackageRoot)\microsoft.dotnet.buildtools\$(BuildToolsPackageVersion)\lib\Microsoft.DotNet.Build.Tasks.dll" />

<PropertyGroup>
<PublishSymbolsPackage>Microsoft.SymbolUploader.Build.Task</PublishSymbolsPackage>
<EnablePublishSymbols Condition="'$(EnablePublishSymbols)'==''" >true</EnablePublishSymbols>
<NuGetPushTimeoutSeconds Condition="'$(NuGetPushTimeoutSeconds)' == ''">600</NuGetPushTimeoutSeconds>
</PropertyGroup>

<Import Project="$(NuGetPackageRoot)\$(PublishSymbolsPackage.ToLower())\$(MicrosoftSymbolUploaderBuildTaskVersion)\build\PublishSymbols.targets" />

<Target Name="PublishPackages">
<Error Condition="'$(NuGetFeedUrl)' == ''" Text="Missing required property NuGetFeedUrl" />
<Error Condition="'$(NuGetApiKey)' == ''" Text="Missing required property NuGetApiKey" />

<ItemGroup>
<NuGetPackages Include="$(ArtifactsDir)packages\**\*.nupkg"
Exclude="$(ArtifactsDir)packages\**\*.snupkg" />

<!--
IgnorableErrorMessages applies to the "ExectWithRetriesForNuGetPush" task.
There's a very special failure scenario that we want to ignore. That scenario is
when NuGet hits a timeout on one "push" attempt, and then gets a "Forbidden" response
because the package "already exists" on the next response. This indicates that the
timeout occurred, but the push was actually successful.
-->
<IgnorableErrorMessages Include="Overwriting existing packages is forbidden according to the package retention settings for this feed.">
<ConditionalErrorMessage>Pushing took too long</ConditionalErrorMessage>
</IgnorableErrorMessages>
</ItemGroup>

<Message Text="Pushing ML.NET packages to $(NuGetFeedUrl)" />

<PropertyGroup>
<DotnetToolCommand>$(MSBuildThisFileDirectory)..\.dotnet\dotnet</DotnetToolCommand>
<NuGetPushCommand>$(DotnetToolCommand) nuget push --source $(NuGetFeedUrl) --api-key $(NuGetApiKey) --timeout $(NuGetPushTimeoutSeconds)</NuGetPushCommand>
</PropertyGroup>

<ExecWithRetriesForNuGetPush Command="$(NuGetPushCommand) %(NuGetPackages.Identity)"
IgnoredErrorMessagesWithConditional="@(IgnorableErrorMessages)" />
</Target>

<Target Name="PublishSymbolPackages"
Condition="'$(EnablePublishSymbols)'=='true'"
Expand Down
22 changes: 16 additions & 6 deletions build/vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ phases:
variables:
BuildConfig: Release
OfficialBuildId: $(BUILD.BUILDNUMBER)
DotnetVersionKind: $[variables.VERSIONKIND] # If no "VERSIONKIND" variable is set when queuing the publishing task, this defaults to empty string.
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_MULTILEVEL_LOOKUP: 0
Expand Down Expand Up @@ -230,33 +231,42 @@ phases:
sourceFolder: $(Build.SourcesDirectory)/artifacts/pkgassets/PackageAssets
targetFolder: $(Build.SourcesDirectory)/artifacts/pkgassets

- script: ./build.cmd -pack -configuration $(BuildConfig)
# Depending on the value of DotNetFinalVersionKind, the name of the package will change.
# For our nightly builds we want it to be empty, and when creating the official nugets, we want it to be "release"
# the value of the version kind is set when queuing the publishing job on AzureDevOps by adding a VERSIONKIND variable
# See more info in: https://github.com/dotnet/arcade/blob/master/Documentation/CorePackages/Versioning.md#package-version
- script: ./build.cmd -configuration $(BuildConfig) -pack -ci /p:OfficialBuildId=$(OfficialBuildId) /p:DotNetFinalVersionKind=$(DotnetVersionKind) /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages
displayName: Build Packages

- script: ./sign.cmd /p:SignNugetPackages=true
- script: ./sign.cmd /p:SignNugetPackages=true /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages
displayName: sign packages
continueOnError: false

- task: NuGetAuthenticate@0
inputs:
nuGetServiceConnections: machinelearning-dnceng-public-feed # To allow publishing to a feed of another organization

- script: $(Build.SourcesDirectory)\.dotnet\dotnet.exe msbuild build\publish.proj /t:PublishPackages /p:NuGetFeedUrl=$(_AzureDevopsFeedUrl) /p:NuGetApiKey=AzureArtifacts
displayName: Publish Packages to AzureDevOps Feed
- task: NuGetCommand@2
displayName: Push packages to AzureDevOps feed
inputs:
command: push
packagesToPush: $(Build.SourcesDirectory)/artifacts/**/*.nupkg;!$(Build.SourcesDirectory)/artifacts/**/*.snupkg
nuGetFeedType: external
publishFeedCredentials: machinelearning-dnceng-public-feed

- task: MSBuild@1
displayName: Publish Symbols to SymWeb Symbol Server
inputs:
solution: build/publish.proj
msbuildArguments: /t:PublishSymbolPackages /p:SymbolServerPath=$(_SymwebSymbolServerPath) /p:SymbolServerPAT=$(SymwebSymbolServerPAT)
msbuildArguments: /t:PublishSymbolPackages /p:SymbolServerPath=$(_SymwebSymbolServerPath) /p:SymbolServerPAT=$(SymwebSymbolServerPAT) /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages
msbuildVersion: 15.0
continueOnError: true

- task: MSBuild@1
displayName: Publish Symbols to Msdl Symbol Server
inputs:
solution: build/publish.proj
msbuildArguments: /t:PublishSymbolPackages /p:SymbolServerPath=$(_MsdlSymbolServerPath) /p:SymbolServerPAT=$(MsdlSymbolServerPAT)
msbuildArguments: /t:PublishSymbolPackages /p:SymbolServerPath=$(_MsdlSymbolServerPath) /p:SymbolServerPAT=$(MsdlSymbolServerPAT) /p:RestorePackagesPath=$(Build.SourcesDirectory)\packages /p:NUGET_PACKAGES=$(Build.SourcesDirectory)\packages
msbuildVersion: 15.0
continueOnError: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML.SampleUtils</IncludeInPackage>
<PackageDescription>Sample utils for Microsoft.ML.Samples</PackageDescription>

<!--The nuget we publish is named SampleUtils, so this is necessary.
Still, the namespace expected inside the nuget is named SamplesUtils,
So the project itself and its code is not to be renamed SampleUtils.-->
<PackageId>Microsoft.ML.SampleUtils</PackageId>
</PropertyGroup>

<ItemGroup>
Expand Down