Skip to content

Update Arcade SDK publishing #96

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

Merged
merged 78 commits into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
169c941
Arcade publishing infra update
adaggarwal Jan 3, 2020
35c1a51
place variables under fedora29 job
adaggarwal Jan 3, 2020
6de15de
Path correction
adaggarwal Jan 7, 2020
88aabdf
stages error: wip
adaggarwal Jan 7, 2020
8e596ae
upload to azure : wip
adaggarwal Jan 7, 2020
e832d06
postbuild yml indent error: wip
adaggarwal Jan 7, 2020
233615a
upload error: wip
adaggarwal Jan 7, 2020
fe70491
upload error: wip
adaggarwal Jan 7, 2020
cc0480f
change artifact name to match post build yml
adaggarwal Jan 7, 2020
e2e65ee
change artifact name to match post build yml
adaggarwal Jan 8, 2020
95b45c1
Merge branch 'master' of https://github.com/dotnet/source-build-refer…
adaggarwal Jan 8, 2020
513eae2
change arcade sdk version
adaggarwal Jan 8, 2020
52d23dd
change arcade sdk version
adaggarwal Jan 8, 2020
62bf02c
add dotnet feed and revert the sdk version
adaggarwal Jan 9, 2020
e996181
add empty Icon to emptyProject
adaggarwal Jan 9, 2020
14469f4
add IconURl to emptyProject
adaggarwal Jan 9, 2020
d3acc44
wip: Icon missing
adaggarwal Jan 9, 2020
7129350
do not import directory build props in emptyproject
adaggarwal Jan 10, 2020
0573918
wip:IconError
adaggarwal Jan 10, 2020
880c0e9
Add non-empty Icon file
adaggarwal Jan 10, 2020
02ec8c6
experiment: manifest name
adaggarwal Jan 10, 2020
8ed5a69
Experiment: add ManifestName to publish.proj
adaggarwal Jan 10, 2020
f54b880
update: Add PushToAzDoArtifacts in publish.proj instead of dependence…
adaggarwal Jan 15, 2020
ca75cc9
wip
adaggarwal Jan 15, 2020
f739f74
wip
adaggarwal Jan 15, 2020
1aad76c
wip
adaggarwal Jan 15, 2020
4643b63
wip
adaggarwal Jan 15, 2020
61ae40d
update: add copy to Publish targets
adaggarwal Jan 16, 2020
19c9c3a
wip
adaggarwal Jan 16, 2020
685ed0f
wip
adaggarwal Jan 16, 2020
04dd3e5
update:add build tasks feed targets to publish project
adaggarwal Jan 16, 2020
5f34461
experiment
adaggarwal Jan 16, 2020
9c7816c
debug: build quicker
adaggarwal Jan 16, 2020
347b21d
rollback tarball extension
adaggarwal Jan 16, 2020
e5b67eb
wip
adaggarwal Jan 17, 2020
a2d630b
wip
adaggarwal Jan 17, 2020
5a177b9
experiment
adaggarwal Jan 17, 2020
57067b0
experiment
adaggarwal Jan 17, 2020
ee69a6c
experiment
adaggarwal Jan 17, 2020
2df9b2d
revert
adaggarwal Jan 17, 2020
63f0339
try newer arcade version
adaggarwal Jan 17, 2020
e58c24d
wip
adaggarwal Jan 17, 2020
bd8d902
debug
adaggarwal Jan 21, 2020
ade7447
publishFlatContainer item to true
Jan 21, 2020
6efd245
wip
Jan 21, 2020
cbcee8c
move out of docker for publish
Jan 21, 2020
2ca579f
add:permissions step
Jan 21, 2020
5a97fd0
wip:try again
adaggarwal Jan 22, 2020
50e7729
wip
adaggarwal Jan 22, 2020
7f15d5a
temp dir path
adaggarwal Jan 22, 2020
414948d
path delimiter changes
adaggarwal Jan 22, 2020
e81a3ac
path correction
adaggarwal Jan 22, 2020
2393650
disable package validation
adaggarwal Jan 22, 2020
9d0d2c3
wip
adaggarwal Jan 22, 2020
28578fe
cleanup changes
adaggarwal Jan 22, 2020
63edf64
Updated publish.proj
Jan 22, 2020
27c2d15
try experimental Artifacts Category
adaggarwal Jan 23, 2020
2dc2f91
revert to .NETCORE Artifacts category
adaggarwal Jan 23, 2020
faa9450
cleanup
adaggarwal Jan 23, 2020
3a48cc9
Recommendation : include other build data attributes
adaggarwal Jan 27, 2020
a2d9851
Experiment: Try without copying manifests in PushToAzureDevOpsArtifac…
adaggarwal Jan 27, 2020
0455e98
dagood: Review comments resolution
adaggarwal Jan 27, 2020
de3321a
wip: test after code-review comments resolution
adaggarwal Jan 27, 2020
4159377
wip: test after code-review comments resolution
adaggarwal Jan 27, 2020
c4459d6
wip: test after removing the FeedUrl from NewManifestBuildData
adaggarwal Jan 27, 2020
2a82295
wip: review-comment: VSO message implicit duplication exclusion
adaggarwal Jan 27, 2020
1ab12ec
wip: review-comment: add InitialAssetsLocation for NewManifestBuildDa…
adaggarwal Jan 27, 2020
81a83c1
wip: review-comment: remove deprecated arguments from publish
adaggarwal Jan 27, 2020
a13d107
revert: add vso stdout for publishManifest files
adaggarwal Jan 28, 2020
9b4c546
correction: AzDoRepoURL
adaggarwal Jan 28, 2020
186e5cc
revert: do copy the manifest and stdout vso for tarball
adaggarwal Jan 28, 2020
4272449
revert: fix
adaggarwal Jan 28, 2020
4a068e6
azure-pipeline: remove pushd
adaggarwal Jan 29, 2020
edffa06
xml style update
adaggarwal Jan 29, 2020
e93650b
Ricardo: correction: AzureDevopsAccount
adaggarwal Jan 29, 2020
ff1cbaf
Merge branch 'publishUpdate' of https://github.com/adaggarwal/source-…
adaggarwal Jan 29, 2020
5d61335
cleanup
adaggarwal Jan 29, 2020
38dab89
AzureDevOpsBuildNumber update
adaggarwal Jan 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<add key="arcade" value="https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json" />
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
</packageSources>
</configuration>
35 changes: 26 additions & 9 deletions azure-pipelines/builds/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
jobs:
- template: ../jobs/ci-linux.yml
parameters:
job: fedora29
imageName: microsoft/dotnet-buildtools-prereqs:fedora-29-2f0798a-20181105183801
variables:
- name: _DotNetArtifactsCategory
value: .NETCore

stages:
- stage: build
displayName: Build
jobs:
- template: ../jobs/ci-linux.yml
parameters:
job: fedora29
imageName: microsoft/dotnet-buildtools-prereqs:fedora-29-2f0798a-20181105183801

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: ../../eng/common/templates/job/publish-build-assets.yml
parameters:
dependsOn: fedora29
publishUsingPipelines: true
pool:
vmImage: vs2017-win2016

# Based on - https://github.com/dotnet/arcade/blob/9b3f304c7bc9fd4d11be9ca0b466b83e98d2a191/Documentation/CorePackages/Publishing.md#moving-away-from-the-legacy-pushtoblobfeed-task
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: ../../eng/common/templates/job/publish-build-assets.yml
- template: ../../eng/common/templates/post-build/post-build.yml
parameters:
dependsOn: fedora29
pool:
vmImage: vs2017-win2016
enableSourceLinkValidation: true
#Nuget and Signing Validation are not needed as we use an empty placeholder nupkg which is never utilized
enableSigningValidation: false
enableNugetValidation: false
40 changes: 19 additions & 21 deletions azure-pipelines/jobs/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
imageName: ${{ parameters.imageName }}
rootDirectory: $(Build.SourcesDirectory)/..
stagingDirectory: $(rootDirectory)/source-build-reference-packages/staging
_PublishUsingPipelines: true

steps:
- template: ../steps/docker-cleanup-linux.yml
Expand Down Expand Up @@ -56,16 +57,28 @@ jobs:
in(variables['Build.Reason'], 'PullRequest')
)"
continueOnError: true
# Below step's sourced from : https://github.com/dotnet/runtime/blob/4e72737a8ec246297bce916ad747e4a2fb1265ac/eng/pipelines/installer/jobs/base-job.yml#L455-L468
# Files may be owned by root because builds don't set user ID. Later build steps run 'find' in
# the source tree, which fails due to permissions in the 'NetCore*-Int-Pool' queues. This step
# prevents the failure by using chown to clean up our source tree.
- script: |
set -x
docker run --rm \
-v "$(Agent.BuildDirectory):/root/build" \
-w /root/build \
bash -c "chown -R $(id -u):$(id -g) *"
displayName: Update file ownership from root to build agent account
continueOnError: true
condition: succeededOrFailed()

# Create reference packages tarball and upload to azure storage
- script: |
set -x
df -h
$(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) ./publish.sh $(BUILD.BUILDNUMBER) --ci \
/p:AzureAccountName=$(publish.blobStorage.account) \
/p:ContainerName=$(publish.blobStorage.container) \
/p:AzureAccessToken=$(publish.blobStorage.accessToken) \
/p:ManifestName=$(BUILD.REPOSITORY.NAME) \
cd "$(rootDirectory)/source-build-reference-packages/src"
./publish.sh $(BUILD.BUILDNUMBER) --ci \
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines) \
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) \
/p:ManifestBuildId=$(BUILD.BUILDID) \
/p:ManifestBranch=$(BUILD.SOURCEBRANCHNAME) \
/p:ManifestCommit=$(BUILD.SOURCEVERSION)
Expand Down Expand Up @@ -114,22 +127,7 @@ jobs:
continueOnError: true
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: Artifacts
ArtifactType: Container

# Publish manifest.
- task: PublishBuildArtifacts@1
displayName: Publish Manifest
condition: "
and(
succeeded(),
ne(variables['System.TeamProject'], 'public'),
notin(variables['Build.Reason'], 'PullRequest')
)"
continueOnError: true
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/asset-manifests/
ArtifactName: AssetManifests
ArtifactName: All_Artifacts
ArtifactType: Container

# Clean up working directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
<RepositoryCommit>0000</RepositoryCommit>
<RepositoryCommit Condition="'$(ManifestCommit)' != ''">$(ManifestCommit)</RepositoryCommit>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>true</IsPackable>
<IsShipping>false</IsShipping>
</PropertyGroup>

</Project>
<ItemGroup>
<None Include="icon.png" Pack="true" PackagePath="" />
</ItemGroup>

</Project>
Binary file added src/emptyPackageProject/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 86 additions & 14 deletions src/publishPackages/publish.proj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(RepoRoot)eng/Directory.Build.props" />
<Import Project="$(RepoRoot)src/dir.props" />
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<ArtifactsPkgDir>$(RepoRoot)artifacts/packages/</ArtifactsPkgDir>
<ManifestDir>$(RepoRoot)artifacts/asset-manifests/</ManifestDir>
<TarballDir>$(RepoRoot)artifacts/tarball/</TarballDir>
<ManifestName>source-build-reference-packages</ManifestName>
<RestoreSources>
$(RestoreSources);
https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json;
Expand All @@ -18,11 +20,11 @@
<BuildDependsOn>
$(CreateTargets)
</BuildDependsOn>
<BuildDependsOn Condition="'$(AzureAccessToken)' != ''">
<BuildDependsOn>
$(BuildDependsOn)
PreparePublish;
PublishPackagesToBlobFeed;
PublishFilesToBlobFeed;
PreparePublishPackages;
PreparePublishFiles;
</BuildDependsOn>
</PropertyGroup>

Expand All @@ -32,16 +34,17 @@

<Target Name="GetTarballFileName">
<PropertyGroup>
<TarballFileName>$(TarballDir)Private.SourceBuild.ReferencePackages.$(VersionPrefix)-$(VersionSuffix).tar.gz</TarballFileName>
<TarballFileName>Private.SourceBuild.ReferencePackages.$(VersionPrefix)-$(VersionSuffix).tar.gz</TarballFileName>
<TarballFilePath>$(TarballDir)$(TarballFileName)</TarballFilePath>
</PropertyGroup>
</Target>

<Target Name="CreateTarball" DependsOnTargets="GetTarballFileName" >
<MakeDir Directories="$(TarballDir)" />

<Exec Command="tar --numeric-owner -czf $(TarballFileName) *.nupkg" WorkingDirectory="$(ArtifactsRefPkgDir)" />
<Exec Command="tar --numeric-owner -czf $(TarballFilePath) *.nupkg" WorkingDirectory="$(ArtifactsRefPkgDir)" />

<Message Importance="High" Text="Created $(TarballFileName)" />
<Message Importance="High" Text="Created $(TarballFilePath)" />
</Target>

<Target Name="CreateEmptyPackage">
Expand All @@ -53,33 +56,102 @@

<Target Name="PreparePublish" DependsOnTargets="$(CreateDependsOn)">
<MakeDir Directories="$(ManifestDir)" />
<MakeDir Directories="$(ArtifactsTempWorkDir)" />
<!-- Include other build data attributes : (Src) https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj#L167 -->
<PropertyGroup>
<ExpectedFeedUrl>https://$(AzureAccountName).blob.core.windows.net/$(ContainerName)/index.json</ExpectedFeedUrl>
<AccountKey>$(AzureAccessToken)</AccountKey>
<CollectionUri>$(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)</CollectionUri>

<!-- When we have dev.azure.com/<account>/ -->
<AzureDevOpsAccount Condition="$(CollectionUri.IndexOf('dev.azure.com')) >= 0">$(CollectionUri.Split('/')[3])</AzureDevOpsAccount>

</PropertyGroup>
<ItemGroup>
<NewManifestBuildData Include="InitialAssetsLocation=$(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$(SYSTEM_TEAMPROJECT)/_apis/build/builds/$(BUILD_BUILDID)/artifacts" />
<NewManifestBuildData Include="AzureDevOpsBuildId=$(BUILD_BUILDID)" />
<NewManifestBuildData Include="AzureDevOpsBuildDefinitionId=$(SYSTEM_DEFINITIONID)" />
<NewManifestBuildData Include="AzureDevOpsAccount=$(AzureDevOpsAccount)" />
<NewManifestBuildData Include="AzureDevOpsProject=$(SYSTEM_TEAMPROJECT)" />
<NewManifestBuildData Include="AzureDevOpsBuildNumber=$(BUILD_BUILDNUMBER)" />
<NewManifestBuildData Include="AzureDevOpsRepository=$(BUILD_REPOSITORY_URI)" />
<NewManifestBuildData Include="AzureDevOpsBranch=$(ManifestBranch)" />
<!--
Adding this just to not fail the validation when creating the manifest.
TODO: Should be removed once PublishingUsingPipelines is the default.
-->
<NewManifestBuildData Include="Location=$(AzureFeedUrl)" />
</ItemGroup>
</Target>

<Target Name="PreparePublishPackages" DependsOnTargets="PreparePublish" BeforeTargets="PublishPackagesToBlobFeed">
<Target Name="PreparePublishPackages" DependsOnTargets="PreparePublish">
<PropertyGroup>
<AssetManifestFilePath>$(ManifestDir)reference-packages-nupkg-manifest.xml</AssetManifestFilePath>
<AssetManifestFilename>reference-packages-nupkg-manifest.xml</AssetManifestFilename>
<AssetManifestFilePath>$(ManifestDir)$(AssetManifestFileName)</AssetManifestFilePath>
<!-- Create a temporary directory to store the generated asset manifest by the task -->
<TempWorkingDirectory>$(ArtifactsDir)AssetsTmpDir\$([System.Guid]::NewGuid())/</TempWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<PackagesToPublish Include="$(ArtifactsPkgDir)**/*.nupkg" />
</ItemGroup>
<MakeDir Directories="$(TempWorkingDirectory)"/>
<PushToAzureDevOpsArtifacts
ItemsToPush="@(PackagesToPublish)"
ManifestBuildData="@(NewManifestBuildData)"
ManifestRepoUri="$(ManifestName)"
ManifestBranch="$(ManifestBranch)"
ManifestBuildId="$(ManifestBuildId)"
ManifestCommit="$(ManifestCommit)"
IsStableBuild="false"
AssetManifestPath="$(AssetManifestFilePath)"
AssetsTemporaryDirectory="$(TempWorkingDirectory)" />

<!-- Copy the generated manifest to the build's artifacts -->
<Copy
SourceFiles="$(AssetManifestFilePath)"
DestinationFolder="$(TempWorkingDirectory)$(AssetManifestFileName)" />

<Message
Text="##vso[artifact.upload containerfolder=AssetManifests;artifactname=AssetManifests]$(TempWorkingDirectory)$(AssetManifestFileName)"
Importance="high" />

</Target>

<Target Name="PreparePublishFiles" DependsOnTargets="PreparePublish;GetTarballFileName" BeforeTargets="PublishFilesToBlobFeed">
<Target Name="PreparePublishFiles" DependsOnTargets="PreparePublish;GetTarballFileName">
<PropertyGroup>
<AssetManifestFilePath>$(ManifestDir)reference-packages-tar-manifest.xml</AssetManifestFilePath>
<AssetManifestFilename>reference-packages-tar-manifest.xml</AssetManifestFilename>
<AssetManifestFilePath>$(ManifestDir)$(AssetManifestFileName)</AssetManifestFilePath>
<!-- Create a temporary directory to store the generated asset manifest by the task -->
<TempWorkingDirectory>$(ArtifactsDir)AssetsTmpDir/$([System.Guid]::NewGuid())/</TempWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<FilesToPublish Include="$(TarballFileName)" />
<FilesToPublish Include="$(TarballFilePath)" RelativeBlobPath="assets/$(TarballFileName)" />
</ItemGroup>
<MakeDir Directories="$(TempWorkingDirectory)"/>
<PushToAzureDevOpsArtifacts
ItemsToPush="@(FilesToPublish)"
ManifestBuildData="@(NewManifestBuildData)"
ManifestRepoUri="$(ManifestName)"
ManifestBranch="$(ManifestBranch)"
ManifestBuildId="$(ManifestBuildId)"
ManifestCommit="$(ManifestCommit)"
PublishFlatContainer="true"
IsStableBuild="false"
AssetManifestPath="$(AssetManifestFilePath)"
AssetsTemporaryDirectory="$(TempWorkingDirectory)" />

<!-- Copy the generated manifest to the build's artifacts -->
<Copy
SourceFiles="$(AssetManifestFilePath)"
DestinationFolder="$(TempWorkingDirectory)$(AssetManifestFileName)" />

<Message
Text="##vso[artifact.upload containerfolder=AssetManifests;artifactname=AssetManifests]$(TempWorkingDirectory)$(AssetManifestFileName)"
Importance="high" />

</Target>



<Import Project="$(NuGetPackageRoot)microsoft.dotnet.build.tasks.feed\$(MicrosoftDotNetBuildTasksFeedVersion)\build\Microsoft.DotNet.Build.Tasks.Feed.targets" />
<Import Project="$(NuGetPackageRoot)microsoft.dotnet.build.tasks.feed/$(MicrosoftDotNetBuildTasksFeedVersion)/build/Microsoft.DotNet.Build.Tasks.Feed.targets" />
<Import Project="$(RepoRoot)eng/Directory.Build.targets" />

</Project>