Skip to content

Commit 436700a

Browse files
authored
Publishing nuget packages to myget feed. (#155)
* Publishing nuget packages to myget feed. Also - set the symbols expiration days default based on feedback from the .NET core-eng team. Fixes #11 * Shorten nuget push timeout to match corefx and coreclr.
1 parent 83f9bac commit 436700a

File tree

3 files changed

+63
-12
lines changed

3 files changed

+63
-12
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Install-Package Microsoft.ML
3434

3535
Or alternatively you can add the Microsoft.ML package from within Visual Studio's NuGet package manager or via [Paket](https://github.com/fsprojects/Paket).
3636

37+
Daily NuGet builds of the project are also available in our MyGet feed:
38+
39+
> [https://dotnet.myget.org/F/dotnet-core/api/v3/index.json](https://dotnet.myget.org/F/dotnet-core/api/v3/index.json)
40+
3741
## Building
3842

3943
To build ML.NET from source please visit our [developers guide](Documentation/project-docs/developer-guide.md).

build/publish.proj

+39-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,50 @@
1-
<Project DefaultTargets="Publish" >
1+
<Project>
22
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
33

4+
<UsingTask TaskName="ExecWithRetriesForNuGetPush" AssemblyFile="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll" />
5+
46
<PropertyGroup>
57
<PublishSymbolsPackage>Microsoft.SymbolUploader.Build.Task</PublishSymbolsPackage>
68
<EnablePublishSymbols Condition="'$(EnablePublishSymbols)'==''" >true</EnablePublishSymbols>
9+
<NuGetPushTimeoutSeconds Condition="'$(NuGetPushTimeoutSeconds)' == ''">600</NuGetPushTimeoutSeconds>
710
</PropertyGroup>
811

912
<Import Project="$(PackagesDir)\$(PublishSymbolsPackage.ToLower())\$(PublishSymbolsPackageVersion)\build\PublishSymbols.targets" />
1013

11-
<Target Name="Publish" Condition="'$(EnablePublishSymbols)'=='true'" DependsOnTargets="SetupPublishSymbols">
14+
<Target Name="PublishPackages">
15+
<Error Condition="'$(NuGetFeedUrl)' == ''" Text="Missing required property NuGetFeedUrl" />
16+
<Error Condition="'$(NuGetApiKey)' == ''" Text="Missing required property NuGetApiKey" />
17+
18+
<ItemGroup>
19+
<NuGetPackages Include="$(PackageOutputPath)**\*.nupkg"
20+
Exclude="$(PackageOutputPath)**\*.symbols.*nupkg" />
21+
22+
<!--
23+
IgnorableErrorMessages applies to the "ExectWithRetriesForNuGetPush" task.
24+
There's a very special failure scenario that we want to ignore. That scenario is
25+
when NuGet hits a timeout on one "push" attempt, and then gets a "Forbidden" response
26+
because the package "already exists" on the next response. This indicates that the
27+
timeout occurred, but the push was actually successful.
28+
-->
29+
<IgnorableErrorMessages Include="Overwriting existing packages is forbidden according to the package retention settings for this feed.">
30+
<ConditionalErrorMessage>Pushing took too long</ConditionalErrorMessage>
31+
</IgnorableErrorMessages>
32+
</ItemGroup>
33+
34+
<Message Text="Pushing ML.NET packages to $(NuGetFeedUrl)" />
35+
36+
<PropertyGroup>
37+
<DotnetToolCommand>$(ToolsDir)dotnetcli/dotnet</DotnetToolCommand>
38+
<NuGetPushCommand>$(DotnetToolCommand) nuget push --source $(NuGetFeedUrl) --api-key $(NuGetApiKey) --timeout $(NuGetPushTimeoutSeconds)</NuGetPushCommand>
39+
</PropertyGroup>
40+
41+
<ExecWithRetriesForNuGetPush Command="$(NuGetPushCommand) %(NuGetPackages.Identity)"
42+
IgnoredErrorMessagesWithConditional="@(IgnorableErrorMessages)" />
43+
</Target>
44+
45+
<Target Name="PublishSymbolPackages"
46+
Condition="'$(EnablePublishSymbols)'=='true'"
47+
DependsOnTargets="SetupPublishSymbols">
1248
<Message Text="Attempting to Publish Symbols" />
1349
<Error Condition="!Exists('$(PackageOutputPath)')" Text="'PackageOutputPath' folder '$(PackageOutputPath)' does not exist."/>
1450
<Error Condition="'$(SymbolServerPath)'==''" Text="Missing property SymbolServerPath" />
@@ -18,7 +54,7 @@
1854

1955
<Target Name="SetupPublishSymbols">
2056
<PropertyGroup>
21-
<SymbolExpirationInDays Condition="'$(SymbolExpirationInDays)'=='' and '$(SymbolExpirationDate)'==''">1</SymbolExpirationInDays>
57+
<SymbolExpirationInDays Condition="'$(SymbolExpirationInDays)'=='' and '$(SymbolExpirationDate)'==''">180</SymbolExpirationInDays>
2258
<ConvertPortablePdbsToWindowsPdbs>true</ConvertPortablePdbsToWindowsPdbs>
2359
</PropertyGroup>
2460

build/vsts-ci.yml

+20-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ phases:
66
_PREVIEW_VSTS_DOCKER_IMAGE: microsoft/dotnet-buildtools-prereqs:centos-7-d485f41-20173404063424
77
BuildConfig: Release
88
OfficialBuildId: $(BUILD.BUILDNUMBER)
9+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
10+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
11+
DOTNET_MULTILEVEL_LOOKUP: 0
912
queue:
1013
name: DotNetCore-Test
1114
demands:
@@ -27,6 +30,9 @@ phases:
2730
variables:
2831
BuildConfig: Release
2932
OfficialBuildId: $(BUILD.BUILDNUMBER)
33+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
34+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
35+
DOTNET_MULTILEVEL_LOOKUP: 0
3036
queue:
3137
name: DotNetCore-Build
3238
demands:
@@ -48,6 +54,9 @@ phases:
4854
variables:
4955
BuildConfig: Release
5056
OfficialBuildId: $(BUILD.BUILDNUMBER)
57+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
58+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
59+
DOTNET_MULTILEVEL_LOOKUP: 0
5160
_SignType: real
5261
_UseEsrpSigning: true
5362
_TeamName: DotNetCore
@@ -96,12 +105,15 @@ phases:
96105
variables:
97106
BuildConfig: Release
98107
OfficialBuildId: $(BUILD.BUILDNUMBER)
108+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
109+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
110+
DOTNET_MULTILEVEL_LOOKUP: 0
99111
_SignType: real
100112
_UseEsrpSigning: true
101113
_TeamName: DotNetCore
114+
_NuGetFeedUrl: https://dotnet.myget.org/F/dotnet-core/api/v2/package
102115
_SymwebSymbolServerPath: https://microsoft.artifacts.visualstudio.com/DefaultCollection
103116
_MsdlSymbolServerPath: https://microsoftpublicsymbols.artifacts.visualstudio.com/DefaultCollection
104-
_SymbolExpirationInDays: 30
105117
queue:
106118
name: DotNetCore-Build
107119
demands:
@@ -145,26 +157,25 @@ phases:
145157
msbuildVersion: 15.0
146158
continueOnError: false
147159

148-
- task: NuGetCommand@2
149-
displayName: Publish Packages to VSTS Feed
160+
- task: MSBuild@1
161+
displayName: Publish Packages to MyGet Feed
150162
inputs:
151-
command: push
152-
packagesToPush: $(Build.SourcesDirectory)/bin/packages/**/*.nupkg;!$(Build.SourcesDirectory)/bin/packages/**/*.symbols.nupkg
153-
nuGetFeedType: internal
154-
feedPublish: MachineLearning
163+
solution: build/publish.proj
164+
msbuildArguments: /t:PublishPackages /p:NuGetFeedUrl=$(_NuGetFeedUrl) /p:NuGetApiKey=$(dotnet-myget-org-api-key)
165+
msbuildVersion: 15.0
155166

156167
- task: MSBuild@1
157168
displayName: Publish Symbols to SymWeb Symbol Server
158169
inputs:
159170
solution: build/publish.proj
160-
msbuildArguments: /p:SymbolServerPath=$(_SymwebSymbolServerPath) /p:SymbolServerPAT=$(SymwebSymbolServerPAT) /p:SymbolExpirationInDays=$(_SymbolExpirationInDays)
171+
msbuildArguments: /t:PublishSymbolPackages /p:SymbolServerPath=$(_SymwebSymbolServerPath) /p:SymbolServerPAT=$(SymwebSymbolServerPAT)
161172
msbuildVersion: 15.0
162173
continueOnError: true
163174

164175
- task: MSBuild@1
165176
displayName: Publish Symbols to Msdl Symbol Server
166177
inputs:
167178
solution: build/publish.proj
168-
msbuildArguments: /p:SymbolServerPath=$(_MsdlSymbolServerPath) /p:SymbolServerPAT=$(MsdlSymbolServerPAT) /p:SymbolExpirationInDays=$(_SymbolExpirationInDays)
179+
msbuildArguments: /t:PublishSymbolPackages /p:SymbolServerPath=$(_MsdlSymbolServerPath) /p:SymbolServerPAT=$(MsdlSymbolServerPAT)
169180
msbuildVersion: 15.0
170181
continueOnError: true

0 commit comments

Comments
 (0)