Skip to content

Commit

Permalink
[ci] Improve maestro artifact publishing (#8945)
Browse files Browse the repository at this point in the history
Context: https://github.com/dotnet/arcade/blob/efc3da96e5ac110513e92ebd9ef87c73f44d8540/Documentation/DependencyFlowOnboardingWithoutArcade.md

The steps used to publish build asset information to maestro have been
updated.

With the new `PushToAzureDevOpsArtifacts` task the build pipeline should
now create all of the artifacts required for maestro artifact publishing.
The `add-build-to-channel` darc command will now trigger a
[Build Promotion Pipeline][0] that pushes build assets to the feed that
corresponds to the maestro channel that is being updated.  We should 
no longer need to push assets to various NuGet feeds in a separate step. 

[0]: https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=9577012&view=logs&j=ba23343f-f710-5af9-782d-5bd26b102304&t=c7a8693b-2f9c-5ea8-c909-cde9405ac2e1&l=238
  • Loading branch information
pjcollins authored May 15, 2024
1 parent 9cbf665 commit bbac9fe
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
13 changes: 2 additions & 11 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,6 @@ extends:
variables:
- ${{ if eq(variables['MicroBuildSignType'], 'Real') }}:
- group: Publish-Build-Assets
templateContext:
outputs:
- output: nuget
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))
useDotNetTask: false # The default is false to use the NuGetCommand task. Set to true to use the DotNetCoreCLI task to publish packages.
packagesToPush: $(Build.StagingDirectory)\nuget-signed\*.nupkg
packageParentPath: $(Build.StagingDirectory)\nuget-signed
nuGetFeedType: external
publishFeedCredentials: $(DotNetFeedCredential)
steps:
- checkout: self

Expand Down Expand Up @@ -617,11 +608,11 @@ extends:
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))
- powershell: |
$versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16'
$versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16'
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
& dotnet tool update microsoft.dotnet.darc --version "$darcVersion" --add-source "$arcadeServicesSource" --tool-path $(Agent.ToolsDirectory)\darc -v n
& $(Agent.ToolsDirectory)\darc\darc add-build-to-channel --default-channels --id $(BARBuildId) --publishing-infra-version 3 --skip-assets-publishing --password $(MaestroAccessToken) --azdev-pat $(publishing-dnceng-devdiv-code-r-build-re)
& $(Agent.ToolsDirectory)\darc\darc add-build-to-channel --default-channels --id $(BARBuildId) --publishing-infra-version 3 --password $(MaestroAccessToken) --azdev-pat $(publishing-dnceng-devdiv-code-r-build-re)
displayName: add build to default darc channel
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))
Expand Down
36 changes: 23 additions & 13 deletions build-tools/create-packs/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.SharedFramework.Sdk" Version="$(MicrosoftDotNetBuildTasksFeedPackageVersion)" />

<UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(DotNetSharedFrameworkTaskFile)"/>
<UsingTask TaskName="GenerateBuildManifest" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll" />
<UsingTask TaskName="Xamarin.Android.BuildTools.PrepTasks.ReplaceFileContents" AssemblyFile="$(PrepTasksAssembly)" />

<!-- https://github.com/dotnet/runtime/blob/0647ec314948904319da5eb15e9931f7c85ed1e2/src/installer/pkg/projects/Directory.Build.targets#L281 -->
Expand Down Expand Up @@ -164,15 +163,26 @@
<RemoveDir Directories="@(_PackFoldersToDelete)" />
</Target>

<!-- https://github.com/dotnet/arcade/blob/efc3da96e5ac110513e92ebd9ef87c73f44d8540/Documentation/DependencyFlowOnboardingWithoutArcade.md -->
<Target Name="PushManifestToBuildAssetRegistry" >
<PropertyGroup>
<ArtifactsLogDir>$(OutputPath)</ArtifactsLogDir>
<AssetManifestFileName>Assets.xml</AssetManifestFileName>
<AssetManifestPath>$(ArtifactsLogDir)AssetManifest\$(AssetManifestFileName)</AssetManifestPath>
</PropertyGroup>

<Error Condition="Exists($(AssetManifestPath))" Text="The manifest file '$(AssetManifestPath)' already exists." />

<ItemGroup>
<BuildArtifacts Include="$(OutputPath)*.nupkg" />
<ItemsToPush Include="$(OutputPath)*.nupkg" />
</ItemGroup>

<Error Condition="'@(BuildArtifacts)' == ''" Text="No packages to create manifest from." />
<Error Condition="'@(ItemsToPush)' == ''" Text="No packages to push." />

<Message Text="Publishing %(ItemsToPush.Identity)" Importance="normal" />

<ItemGroup>
<ManifestBuildData Include="InitialAssetsLocation=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
<ManifestBuildData Include="InitialAssetsLocation=" />
<ManifestBuildData Include="AzureDevOpsBuildId=$(BUILD_BUILDID)" />
<ManifestBuildData Include="AzureDevOpsBuildDefinitionId=$(SYSTEM_DEFINITIONID)" />
<ManifestBuildData Include="AzureDevOpsProject=$(SYSTEM_TEAMPROJECT)" />
Expand All @@ -181,14 +191,14 @@
<ManifestBuildData Include="AzureDevOpsBranch=$(BUILD_SOURCEBRANCH)" />
</ItemGroup>

<GenerateBuildManifest
Artifacts="@(BuildArtifacts)"
OutputPath="$(OutputPath)bar-manifests\AssetManifest.xml"
BuildId="$(BUILD_BUILDNUMBER)"
BuildData="@(ManifestBuildData)"
RepoUri="$(BUILD_REPOSITORY_URI)"
RepoBranch="$(BUILD_SOURCEBRANCH)"
RepoCommit="$(BUILD_SOURCEVERSION)"
<PushToAzureDevOpsArtifacts
ItemsToPush="@(ItemsToPush)"
ManifestBuildData="@(ManifestBuildData)"
ManifestRepoUri="$(BUILD_REPOSITORY_NAME)"
ManifestBranch="$(BUILD_SOURCEBRANCH)"
ManifestBuildId="$(BUILD_BUILDNUMBER)"
ManifestCommit="$(BUILD_SOURCEVERSION)"
AssetManifestPath="$(AssetManifestPath)"
PublishingVersion="3" />

<MSBuild
Expand All @@ -199,7 +209,7 @@

<MSBuild
Projects="$(PkgMicrosoft_DotNet_Arcade_Sdk)\tools\SdkTasks\PublishBuildAssets.proj"
Properties="Configuration=$(Configuration);RepoRoot=$(XamarinAndroidSourcePath);VersionPrefix=$(AndroidPackVersion);ManifestsPath=$(OutputPath)bar-manifests;MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com"
Properties="Configuration=$(Configuration);RepoRoot=$(XamarinAndroidSourcePath);VersionPrefix=$(AndroidPackVersion);ManifestsPath=$(ArtifactsLogDir)AssetManifest;MaestroApiEndpoint=https://maestro.dot.net"
/>
</Target>

Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>70831f0d126fe88b81d7dc8de11358e17a5ce364</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="7.0.0-beta.22103.1">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="8.0.0-beta.24225.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>70831f0d126fe88b81d7dc8de11358e17a5ce364</Sha>
<Sha>67d23f4ba1813b315e7e33c71d18b63475f5c5f8</Sha>
</Dependency>
<Dependency Name="Microsoft.TemplateEngine.Tasks" Version="7.0.100-rc.1.22410.7">
<Uri>https://github.com/dotnet/templating</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-preview.4.24251.3</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-preview.4.24251.3</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>8.0.0-beta.24225.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-preview.5.24223.2</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
Expand Down

0 comments on commit bbac9fe

Please sign in to comment.