Use "PushToBlobFeed" instead of "UploadToAzure"

This commit is contained in:
jbeisner 2018-01-16 22:16:56 +00:00
parent 552129db0d
commit 9dc9f4c87b
10 changed files with 82 additions and 93 deletions

View file

@ -36,7 +36,8 @@ tools\TestAssetsDependencies\TestAssetsDependencies.csproj
<Import Condition=" '$(GeneratePropsFile)' != 'true' " Project="$(GitCommitInfoProps)" />
<Import Condition=" '$(GeneratePropsFile)' != 'true' " Project="$(HostInfoProps)" />
<Import Condition=" '$(GeneratePropsFile)' != 'true' " Project="$(BuildInfoProps)" />
<Import Condition=" '$(GeneratePropsFile)' != 'true' " Project="$(NuGetPackagesDir)/microsoft.dotnet.build.tasks.feed/$(BuildTasksFeedToolVersion)/build/Microsoft.DotNet.Build.Tasks.Feed.targets" />
<Import Project="build/BranchInfo.props" />
<Import Project="build/AzureInfo.props" />

View file

@ -1,8 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Product>Sdk</Product>
<IsOrchestratedPublish Condition="'$(PB_PublishBlobFeedUrl)' != ''">True</IsOrchestratedPublish>
<BlobStoragePartialRelativePath>$(Product)</BlobStoragePartialRelativePath>
<IsOrchestratedPublish Condition="'$(PB_PublishBlobFeedUrl)' != ''">true</IsOrchestratedPublish>
<!-- Values related to the download of assets from blob storage -->
<DefaultCoreSetupBlobRootUrl>https://dotnetcli.azureedge.net/dotnet/</DefaultCoreSetupBlobRootUrl>
@ -19,6 +18,8 @@
<ArtifactContainerName Condition="'$(ArtifactContainerName)' == ''">dotnet</ArtifactContainerName>
<ArtifactCloudDropAccessToken>$(PB_PublishBlobFeedKey)</ArtifactCloudDropAccessToken>
<ArtifactCloudDropAccessToken Condition="'$(ArtifactCloudDropAccessToken)' == ''">$(ARTIFACT_STORAGE_KEY)</ArtifactCloudDropAccessToken>
<ArtifactCloudDropURL>$(PB_PublishBlobFeedUrl)</ArtifactCloudDropURL>
<ArtifactCloudDropURL Condition="'$(PB_PublishBlobFeedUrl)' == ''">"https://$(ArtifactCloudDropAccountName).blob.core.windows.net/$(ArtifactContainerName)/"</ArtifactCloudDropURL>
<!-- Values related to the upload of checksums to blob storage -->
<ChecksumCloudDropAccountName>$(CHECKSUM_STORAGE_ACCOUNT)</ChecksumCloudDropAccountName>
@ -27,11 +28,13 @@
<ChecksumContainerName Condition="'$(ChecksumContainerName)' == ''">dotnet</ChecksumContainerName>
<ChecksumCloudDropAccessToken>$(PB_PublishBlobFeedKey)</ChecksumCloudDropAccessToken>
<ChecksumCloudDropAccessToken Condition="'$(ChecksumCloudDropAccessToken)' == ''">$(CHECKSUM_STORAGE_KEY)</ChecksumCloudDropAccessToken>
<ChecksumCloudDropURL>$(PB_PublishBlobFeedUrl)</ChecksumCloudDropURL>
<ChecksumCloudDropURL Condition="'$(PB_PublishBlobFeedUrl)' == ''">"https://$(ChecksumCloudDropAccountName).blob.core.windows.net/$(ChecksumContainerName)/"</ChecksumCloudDropURL>
<!-- Values related to the upload of NuPkgs to the blob feed -->
<BlobFeedExpectedURL>$(PB_PublishBlobFeedUrl)</BlobFeedExpectedURL>
<BlobFeedExpectedURL Condition="'$(BlobFeedExpectedURL)' == ''">https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json</BlobFeedExpectedURL>
<BlobFeedCloudDropAccessToken>$(PB_PublishBlobFeedKey)</BlobFeedCloudDropAccessToken>
<BlobFeedCloudDropAccessToken Condition="'$(BlobFeedCloudDropAccessToken)' == ''">$(BLOBFEED_STORAGE_KEY)</BlobFeedCloudDropAccessToken>
</PropertyGroup>
</PropertyGroup>
</Project>

View file

@ -68,7 +68,7 @@
<PropertyGroup>
<VersionToolsVersion>1.0.27-prerelease-01723-01</VersionToolsVersion>
<DotnetDebToolVersion>2.0.0-preview2-25331-01</DotnetDebToolVersion>
<BuildTasksFeedToolVersion>2.1.0-prerelease-02312-02</BuildTasksFeedToolVersion>
<BuildTasksFeedToolVersion>2.1.0-prerelease-02411-04</BuildTasksFeedToolVersion>
</PropertyGroup>
</Project>

View file

@ -7,6 +7,5 @@
<BuildInfoProps>$(GeneratedPropsDir)/BuildInfo.props</BuildInfoProps>
<OrchestratedPackageVersionsProps>$(GeneratedPropsDir)/OrchestratedPackageVersionsProps.props</OrchestratedPackageVersionsProps>
<GeneratedNuGetConfig>$(RepoRoot)/NuGet.Config</GeneratedNuGetConfig>
</PropertyGroup>
</Project>

View file

@ -4,7 +4,6 @@
<Import Project="$(MSBuildThisFileDirectory)/publish/PublishContent.targets" />
<Import Project="$(MSBuildThisFileDirectory)/publish/PublishNupkgToBlobFeed.targets" />
<Import Project="$(MSBuildThisFileDirectory)/publish/Badge.targets" />
<Import Project="$(MSBuildThisFileDirectory)/publish/AzureInfo.targets" />
<Import Project="$(MSBuildThisFileDirectory)/publish/Checksum.targets" />
<Import Project="$(MSBuildThisFileDirectory)/publish/RuntimeCoherence.targets" />
@ -13,7 +12,6 @@
Condition=" '$(PUBLISH_TO_AZURE_BLOB)' == 'true' "
DependsOnTargets="Init;
SetBadgeProps;
SetAzureProps;
Package;
EvaluateRuntimeCoherence;
PublishArtifacts;
@ -23,7 +21,6 @@
Condition=" '$(PUBLISH_TO_AZURE_BLOB)' == 'true' "
DependsOnTargets="Init;
SetBadgeProps;
SetAzureProps;
EvaluateRuntimeCoherence;
PublishArtifacts;
FinishBuild" />
@ -39,8 +36,7 @@
PublishNupkgToBlobFeed;
PublishCliVersionBadge" />
<Target Name="GatherItemsForPattern"
DependsOnTargets="SetAzureProps">
<Target Name="GatherItemsForPattern">
<ItemGroup>
<ForPublishing Include="@(GeneratedInstallers)"
Condition=" '$(PublishNativeInstallers)' == 'true' "/>
@ -56,13 +52,15 @@
<ItemGroup>
<ForPublishing>
<RelativeBlobPath>$(BlobStoragePartialRelativePath)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
<RelativeBlobPath>$(Product)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
</ForPublishing>
</ItemGroup>
</Target>
<Target Name="PublishCliVersionBadge"
DependsOnTargets="SetAzureProps">
<Target Name="PublishCliVersionBadge">
<Error Condition="'$(ArtifactCloudDropAccessToken)' == ''" Text="Missing property ArtifactCloudDropAccessToken." />
<Error Condition="'$(ArtifactCloudDropURL)' == ''" Text="Missing property ArtifactCloudDropURL." />
<ItemGroup>
<CliVersionBadgeToUpload Include="$(VersionBadge)" />
<CliVersionBadgeToUpload Include="$(CoherentBadge)"
@ -71,21 +69,15 @@
<ItemGroup>
<CliVersionBadgeToUpload>
<RelativeBlobPath>$(BlobStoragePartialRelativePath)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
<RelativeBlobPath>$(Product)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
</CliVersionBadgeToUpload>
</ItemGroup>
<UploadToAzure
AccountKey="$(ArtifactCloudDropAccessToken)"
AccountName="$(ArtifactCloudDropAccountName)"
ContainerName="$(ArtifactContainerName)"
Items="@(CliVersionBadgeToUpload)"
Overwrite="$(OverwriteOnPublish)" />
<Message Text="Publish badges to blob feed started: " />
<PushToBlobFeed AccountKey="$(ArtifactCloudDropAccessToken)"
ExpectedFeedUrl="$(ArtifactCloudDropURL)"
ItemsToPush="@(CliVersionBadgeToUpload)"
Overwrite="false" />
<SetBlobPropertiesBasedOnFileType
AccountKey="$(ArtifactCloudDropAccessToken)"
AccountName="$(ArtifactCloudDropAccountName)"
ContainerName="$(ArtifactContainerName)"
Items="@(CliVersionBadgeToUpload)" />
</Target>
</Project>

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="SetAzureProps"
Condition=" '$(IsOrchestratedPublish)' == 'True' And '$(PB_PublishBlobFeedUrl)' != '' ">
<ParseFeedUrl FeedUrl="$(PB_PublishBlobFeedUrl)">
<Output TaskParameter="BlobElements" ItemName="BlobElements" />
</ParseFeedUrl>
<PropertyGroup>
<ArtifactContainerName>%(BlobElements.ContainerName)</ArtifactContainerName>
<ChecksumContainerName>%(BlobElements.ContainerName)</ChecksumContainerName>
<ArtifactCloudDropAccountName>%(BlobElements.AccountName)</ArtifactCloudDropAccountName>
<ChecksumCloudDropAccountName>%(BlobElements.AccountName)</ChecksumCloudDropAccountName>
<PublishBlobFeedUrlBlobPath>%(BlobElements.BaseBlobPath)</PublishBlobFeedUrlBlobPath>
<BlobStoragePartialRelativePath>$(PublishBlobFeedUrlBlobPath.Replace('/index.json', ''))/assets/$(Product)</BlobStoragePartialRelativePath>
</PropertyGroup>
</Target>
</Project>

View file

@ -1,33 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="FinishBuild"
Condition="'$(IsOrchestratedPublish)' != 'True'"
DependsOnTargets="CheckIfAllBuildsHavePublished;
Condition="'$(IsOrchestratedPublish)' != 'true'"
DependsOnTargets="SetArtifactBlobProps;
SetChecksumBlobProps;
CheckIfAllBuildsHavePublished;
FinalizeBuild" />
<Target Name="SetArtifactBlobProps">
<Error Condition="'$(ArtifactCloudDropURL)' == ''" Text="Missing property ArtifactCloudDropURL." />
<ParseBlobUrl FeedUrl="$(ArtifactCloudDropURL)">
<Output TaskParameter="BlobElements" ItemName="BlobElements" />
</ParseBlobUrl>
<PropertyGroup>
<ArtifactBlobContainerName>%(BlobElements.ContainerName)</ArtifactBlobContainerName>
<ArtifactBlobAccountName>%(BlobElements.AccountName)</ArtifactBlobAccountName>
</PropertyGroup>
</Target>
<Target Name="SetChecksumBlobProps">
<Error Condition="'$(ChecksumCloudDropURL)' == ''" Text="Missing property ChecksumCloudDropURL." />
<ParseBlobUrl FeedUrl="$(ChecksumCloudDropURL)">
<Output TaskParameter="BlobElements" ItemName="BlobElements" />
</ParseBlobUrl>
<PropertyGroup>
<ChecksumBlobContainerName>%(BlobElements.ContainerName)</ChecksumBlobContainerName>
<ChecksumBlobAccountName>%(BlobElements.AccountName)</ChecksumBlobAccountName>
</PropertyGroup>
</Target>
<Target Name="CheckIfAllBuildsHavePublished">
<CheckIfAllBuildsHavePublished AccountKey="$(ArtifactCloudDropAccessToken)"
AccountName="$(ArtifactCloudDropAccountName)"
ContainerName="$(ArtifactContainerName)"
AccountName="$(ArtifactBlobAccountName)"
ContainerName="$(ArtifactBlobContainerName)"
NugetVersion="$(FullNugetVersion)"
VersionBadgeMoniker="$(VersionBadgeMoniker)">
<Output TaskParameter="HaveAllBuildsPublished" PropertyName="HaveAllBuildsPublished" />
</CheckIfAllBuildsHavePublished>
</Target>
<Target Name="FinalizeBuild"
Condition=" '$(HaveAllBuildsPublished)' == 'True' ">
<CopyBlobsToLatest AccountName="$(ArtifactCloudDropAccountName)"
<Target Name="FinalizeBuild" Condition=" '$(HaveAllBuildsPublished)' == 'True' ">
<CopyBlobsToLatest AccountName="$(ArtifactBlobAccountName)"
AccountKey="$(ArtifactCloudDropAccessToken)"
ContainerName="$(ArtifactContainerName)"
ContainerName="$(ArtifactBlobContainerName)"
NugetVersion="$(FullNugetVersion)"
Channel="$(Channel)"
CommitHash="$(CommitHash)"
Coherent="$(Coherent)" />
<CopyBlobsToLatest AccountName="$(ChecksumCloudDropAccountName)"
<CopyBlobsToLatest AccountName="$(ChecksumBlobAccountName)"
AccountKey="$(ChecksumCloudDropAccessToken)"
ContainerName="$(ChecksumContainerName)"
ContainerName="$(ChecksumBlobContainerName)"
NugetVersion="$(FullNugetVersion)"
Channel="$(Channel)"
CommitHash="$(CommitHash)"

View file

@ -21,40 +21,26 @@
<!-- publishes artifacts to blob storage in Azure -->
<Target Name="UploadArtifactsToAzure" DependsOnTargets="GatherItemsForPattern">
<Error Condition="'$(ArtifactContainerName)' == ''" Text="Missing property ArtifactContainerName." />
<Error Condition="'$(ArtifactCloudDropAccountName)' == ''" Text="Missing property ArtifactCloudDropAccountName." />
<Error Condition="'$(ArtifactCloudDropAccessToken)' == ''" Text="Missing property ArtifactCloudDropAccessToken." />
<!-- create the container if it doesn't exist -->
<CreateAzureContainer
AccountKey="$(ArtifactCloudDropAccessToken)"
AccountName="$(ArtifactCloudDropAccountName)"
ContainerName="$(ArtifactContainerName)" />
<!-- now upload the items -->
<UploadToAzure
AccountKey="$(ArtifactCloudDropAccessToken)"
AccountName="$(ArtifactCloudDropAccountName)"
ContainerName="$(ArtifactContainerName)"
Items="@(ForPublishing)"
Overwrite="$(OverwriteOnPublish)" />
<Error Condition="'$(ArtifactCloudDropURL)' == ''" Text="Missing property ArtifactCloudDropURL." />
<Message Text="Publish assets to blob storage started: $(ArtifactCloudDropURL)" />
<PushToBlobFeed AccountKey="$(ArtifactCloudDropAccessToken)"
ExpectedFeedUrl="$(ArtifactCloudDropURL)"
ItemsToPush="@(ForPublishing)"
Overwrite="$(OverwriteOnPublish)" />
</Target>
<!-- publishes checksums for the artifacts to blob storage in Azure -->
<Target Name="UploadChecksumsToAzure" DependsOnTargets="GenerateChecksums">
<Error Condition="'$(ChecksumContainerName)' == ''" Text="Missing property ChecksumContainerName." />
<Error Condition="'$(ChecksumCloudDropAccountName)' == ''" Text="Missing property ChecksumCloudDropAccountName." />
<Error Condition="'$(ChecksumCloudDropAccessToken)' == ''" Text="Missing property ChecksumCloudDropAccessToken." />
<!-- create the container if it doesn't exist -->
<CreateAzureContainer
AccountKey="$(ChecksumCloudDropAccessToken)"
AccountName="$(ChecksumCloudDropAccountName)"
ContainerName="$(ChecksumContainerName)" />
<!-- now upload the items -->
<UploadToAzure
AccountKey="$(ChecksumCloudDropAccessToken)"
AccountName="$(ChecksumCloudDropAccountName)"
ContainerName="$(ChecksumContainerName)"
Items="@(ArtifactsForGeneratingChecksums->'%(DestinationPath)')"
Overwrite="$(OverwriteOnPublish)" />
<Error Condition="'$(ChecksumCloudDropURL)' == ''" Text="Missing property ChecksumCloudDropURL." />
<Message Text="Publish checksums to blob storage started: $(ChecksumCloudDropURL)" />
<PushToBlobFeed AccountKey="$(ChecksumCloudDropAccessToken)"
ExpectedFeedUrl="$(ChecksumCloudDropURL)"
ItemsToPush="@(ArtifactsForGeneratingChecksums->'%(DestinationPath)')"
Overwrite="$(OverwriteOnPublish)" />
</Target>
</Project>
</Project>

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="'$(GeneratePropsFile)' != 'true'" Project="$(NuGetPackagesDir)/microsoft.dotnet.build.tasks.feed/$(BuildTasksFeedToolVersion)/build/Microsoft.DotNet.Build.Tasks.Feed.targets" />
<ItemGroup>
<NupkgsForPublishing Include="$(PackagesDirectory)/Microsoft.DotNet.Cli.Utils.*.nupkg" />
<NupkgsForPublishing Include="$(PackagesDirectory)/Microsoft.DotNet.MSBuildSdkResolver.*.nupkg" />
@ -13,8 +11,8 @@
<Message Text="Publish NuPkgs to Blob feed started" />
<PushToBlobFeed AccountKey="$(BlobFeedCloudDropAccessToken)"
ExpectedFeedUrl="$(BlobFeedExpectedURL)"
ItemsToPush="@(NupkgsForPublishing)"
Overwrite="false" />
ExpectedFeedUrl="$(BlobFeedExpectedURL)"
ItemsToPush="@(NupkgsForPublishing)"
Overwrite="false" />
</Target>
</Project>

View file

@ -136,5 +136,8 @@ docker run $INTERACTIVE -t --rm --sig-proxy=true \
-e AZUREACCOUNTNAME \
-e RELEASETOOLSGITURL \
-e CORESETUPBLOBROOTURL \
-e PB_AssetRootUrl \
-e PB_PackageVersionPropsUrl \
-e PB_PublishBlobFeedUrl \
$DOTNET_BUILD_CONTAINER_TAG \
$BUILD_COMMAND "$@"