Add independent publish step based on publishtype
In order to reduce risk with current builds while still enabling our larger orchestrated build scenario we are adding an independent publish-type step. Only one or the other should be enabled at a time.
This commit is contained in:
Родитель
cec624d8ba
Коммит
4f9aaff774
|
@ -1 +1 @@
|
|||
2.0.0-prerelease-02202-02
|
||||
2.0.0-prerelease-02210-05
|
||||
|
|
|
@ -222,8 +222,8 @@
|
|||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "Publish",
|
||||
"condition": "and(succeeded(), ne(variables.PB_PublishType, ''))",
|
||||
"displayName": "Publish (no PublishType)",
|
||||
"condition": "and(succeeded(), eq(variables.PB_PublishType, 'nopublishtype'))",
|
||||
"timeoutInMinutes": 0,
|
||||
"task": {
|
||||
"id": "c6c4c611-aa2e-4a33-b606-5eaba2196824",
|
||||
|
@ -246,6 +246,34 @@
|
|||
"msbuildLocation": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "Publish via PublishType",
|
||||
"condition": "and(succeeded(), ne(variables.PB_PublishType, ''))",
|
||||
"timeoutInMinutes": 0,
|
||||
"task": {
|
||||
"id": "c6c4c611-aa2e-4a33-b606-5eaba2196824",
|
||||
"versionSpec": "1.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"solution": "$(PB_SourcesDirectory)\\publish\\publish-type.proj",
|
||||
"platform": "$(PB_TargetArchitecture)",
|
||||
"configuration": "$(BuildConfiguration)",
|
||||
"msbuildArguments": "/p:Configuration=$(BuildConfiguration) $(PB_CommonMSBuildArgs) /p:PublishType=$(PB_PublishType) /p:SignType=$(PB_SignType) /p:AzureAccountName=$(PB_AzureAccountName) /p:ContainerName=$(PB_ContainerName) /p:AzureAccessToken=$(PB_AzureAccessToken) /p:PublishBlobFeedUrl=$(PB_PublishBlobFeedUrl) /p:PublishBlobFeedKey=$(PB_PublishBlobFeedKey) /p:OfficialPublish=true /p:GitHubUser=$(PB_GitHubUser) /p:GitHubEmail=$(PB_GitHubEmail) /p:GitHubAuthToken=$(GITHUB_PASSWORD) /p:VersionsRepoOwner=$(PB_VersionsRepoOwner) /p:VersionsRepo=$(PB_VersionsRepo) /p:VersionsRepoPath=build-info/dotnet/$(PB_RepoName)/$(SourceBranch) /p:DotNetToolDir=$(DotNetToolDir) /p:EmbedIndexToolDir=$(EmbedIndexToolDir) /flp:v=detailed;LogFile=$(PB_SourcesDirectory)\\publish-blob.log",
|
||||
"clean": "false",
|
||||
"maximumCpuCount": "false",
|
||||
"restoreNugetPackages": "false",
|
||||
"logProjectEvents": "false",
|
||||
"createLogFile": "false",
|
||||
"msbuildLocationMethod": "version",
|
||||
"msbuildVersion": "Latest",
|
||||
"msbuildArchitecture": "x64",
|
||||
"msbuildLocation": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"continueOnError": true,
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<!-- Package versions used as toolsets -->
|
||||
<PropertyGroup>
|
||||
<FeedTasksPackage>Microsoft.DotNet.Build.Tasks.Feed</FeedTasksPackage>
|
||||
<FeedTasksPackageVersion>1.0.0-prerelease-02202-02</FeedTasksPackageVersion>
|
||||
<FeedTasksPackageVersion>1.0.0-prerelease-02210-05</FeedTasksPackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<UsingTask TaskName="DownloadFromAzure" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll" />
|
||||
|
||||
<Import Project="$(PackagesDir)/$(FeedTasksPackage.ToLower())/$(FeedTasksPackageVersion)/build/$(FeedTasksPackage).targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<BuildDependsOn>
|
||||
ValidateProperties;
|
||||
DownloadFilesFromContainer;
|
||||
SignSymbolPackages
|
||||
</BuildDependsOn>
|
||||
|
||||
<BuildDependsOn Condition="$(PublishType.Contains('blob')">
|
||||
$(BuildDependsOn);
|
||||
ValidateBlobFeedProperties;
|
||||
PublishPackagesToBlobFeed;
|
||||
PublishFilesToBlobFeed;
|
||||
</BuildDependsOn>
|
||||
|
||||
<BuildDependsOn Condition="$(PublishType.Contains('versions')">
|
||||
$(BuildDependsOn);
|
||||
UpdateVersionsRepo
|
||||
</BuildDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)" />
|
||||
|
||||
<Target Name="ValidateProperties">
|
||||
<Error Condition="'$(AzureAccessToken)' == ''" Text="Missing required property 'AzureAccessToken'" />
|
||||
<Error Condition="'$(AzureAccountName)' == ''" Text="Missing required property 'AzureAccountName'" />
|
||||
<Error Condition="'$(ContainerName)' == ''" Text="Missing required property 'ContainerName'" />
|
||||
<Message Condition="'$(WindowsSdkDir)' == ''" Text="Windows SDK not found. Symbols packages will not be signed." />
|
||||
</Target>
|
||||
|
||||
<Target Name="ValidateBlobFeedProperties">
|
||||
<Error Condition="'$(PublishBlobFeedUrl)' == ''" Text="Missing required property 'PublishBlobFeedUrl'" />
|
||||
<Error Condition="'$(PublishBlobFeedKey)' == ''" Text="Missing required property 'PublishBlobFeedKey'" />
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- map the properties to the values expexed by the Feeds.targets file -->
|
||||
<ExpectedFeedUrl>$(PublishBlobFeedUrl)</ExpectedFeedUrl>
|
||||
<AccountKey>$(PublishBlobFeedKey)</AccountKey>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="DownloadFilesFromContainer">
|
||||
<!-- TODO: We should also think about pulling down the checksums or recomputing them -->
|
||||
<PropertyGroup>
|
||||
<DownloadDirectory Condition="'$(DownloadDirectory)' == ''">$(BinDir)PackageDownload/</DownloadDirectory>
|
||||
<PublishDirectory Condition="'$(PublishDirectory)' == ''">$(BinDir)ForPublishing/</PublishDirectory>
|
||||
<!-- if we're not signing packages, publish directly from the download directory, as we won't be
|
||||
copying them to the indexed directory -->
|
||||
<PublishDirectory Condition="'$(WindowsSdkDir)' == '' OR '$(SignType)' != 'real'">$(DownloadDirectory)</PublishDirectory>
|
||||
</PropertyGroup>
|
||||
<MakeDir Directories="$(DownloadDirectory)" Condition="!Exists('$(DownloadDirectory)')" />
|
||||
|
||||
<DownloadFromAzure AccountName="$(AzureAccountName)"
|
||||
AccountKey="$(AzureAccessToken)"
|
||||
ContainerName="$(ContainerName)"
|
||||
BlobNamePrefix="$(BinariesRelativePath)"
|
||||
DownloadDirectory="$(DownloadDirectory)" />
|
||||
|
||||
<ItemGroup>
|
||||
<!-- ShippedNugetPackage item is used for updating versions repo -->
|
||||
<ShippedNuGetPackage Include="$(DownloadDirectory)**\*.nupkg" Exclude="$(DownloadDirectory)**\*.symbols.nupkg" />
|
||||
|
||||
<!-- Setup item groups for PublishPackagesToBlobFeed and PublishFilesToBlobFeed -->
|
||||
<PackagesToPublish Include="$(DownloadDirectory)**\*.nupkg" />
|
||||
<FilesToPublish Include="$(DownloadDirectory)**\*.*" Exclude="$(PackagesToPublish)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="FindDownloadedPackagesForSigning">
|
||||
<ItemGroup>
|
||||
<!-- Find the downloaded symbol packages -->
|
||||
<SymbolPackagesToEmbedIndex Include="$(DownloadDirectory)**\*.symbols.nupkg" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<UnsignedSymbolsDirectory Condition="'$(UnsignedSymbolsDirectory)' == ''">$(BinDir)UnsignedSymbolsDirectory/</UnsignedSymbolsDirectory>
|
||||
<!-- Glob matching packages that we want to embed symbol signatures in. Used in BuildTools. -->
|
||||
<SymbolPackagesToPublishGlob Condition="'$(SymbolPackagesToPublishGlob)' == ''">$(DownloadDirectory)**\*.symbols.nupkg</SymbolPackagesToPublishGlob>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Move all the symbol packages to an unsigned directory -->
|
||||
<MakeDir Directories="$(UnsignedSymbolsDirectory)" />
|
||||
<Move SourceFiles="@(SymbolPackagesToEmbedIndex)" DestinationFolder="$(UnsignedSymbolsDirectory)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SignSymbolPackages"
|
||||
DependsOnTargets="FindDownloadedPackagesForSigning;InjectSignedSymbolCatalogIntoSymbolPackages"
|
||||
Condition="'$(WindowsSdkDir)' != '' AND '$(SignType)' == 'real'">
|
||||
<ItemGroup>
|
||||
<EmbedIndexArgPairs Include="@(SymbolPackagesToEmbedIndex -> '$(UnsignedSymbolsDirectory)%(Filename)%(Extension) %(Identity)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Inline the EmbedIndex.ps1 script used in CoreFX and CoreCLR: directly call EmbedIndex. -->
|
||||
<Exec Command="$(DotNetToolDir)\dotnet $(EmbedIndexToolDir)\tools\EmbedIndex.dll %(EmbedIndexArgPairs.Identity)" />
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
Target wrapping UpdatePublishedVersions: ensures that ShippedNuGetPackage items are created and
|
||||
disables versions repo update if no auth token is defined. Otherwise, not specifying an auth
|
||||
token would cause an error.
|
||||
-->
|
||||
<Target Name="UpdateVersionsRepo"
|
||||
Condition="'$(GitHubAuthToken)' != ''"
|
||||
DependsOnTargets="UpdatePublishedVersions" />
|
||||
|
||||
<Import Project="$(ToolsDir)VersionTools.targets" Condition="Exists('$(ToolsDir)VersionTools.targets')" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче