Skip to content
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

[ci] Support stable publishing and passwordless auth for darc/maestro #20914

Merged
merged 21 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions dotnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call VersionsTemplate,$(platform

version-props: $(foreach platform,$(DOTNET_PLATFORMS),targets/Microsoft.$(platform).Sdk.Versions.props)

setup-publish-bar-manifest: version-props
echo \#\#vso[task.setvariable variable=PrereleaseIdentifier]$(NUGET_PRERELEASE_IDENTIFIER)

define AutoImports
Microsoft.$(1).Sdk/Sdk/AutoImport.props: targets/AutoImport.template.props Makefile
$(Q) rm -f [email protected]
Expand Down
7 changes: 5 additions & 2 deletions dotnet/package/common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@
</Content>
</ItemGroup>

<!-- https://github.com/dotnet/arcade/blob/efc3da96e5ac110513e92ebd9ef87c73f44d8540/Documentation/DependencyFlowOnboardingWithoutArcade.md -->
<!-- https://github.com/dotnet/arcade/blob/00d6decc59f5030c2399a64fd3e4f6e8e11bacca/Documentation/DependencyFlowOnboardingWithoutArcade.md -->
<Target Name="PushManifestToBuildAssetRegistry" >
<PropertyGroup>
<ArtifactsLogDir>$(BarManifestOutputPath)</ArtifactsLogDir>
<AssetManifestFileName>Assets.xml</AssetManifestFileName>
<AssetManifestPath>$(ArtifactsLogDir)AssetManifest\$(AssetManifestFileName)</AssetManifestPath>
<IsStableBuild Condition=" '$(PrereleaseIdentifier)' == '' ">true</IsStableBuild>
<IsStableBuild Condition=" '$(PrereleaseIdentifier)' != '' ">false</IsStableBuild>
</PropertyGroup>

<Error Condition="Exists($(AssetManifestPath))" Text="The manifest file '$(AssetManifestPath)' already exists." />
Expand All @@ -140,8 +142,9 @@
<ManifestBuildData Include="AzureDevOpsBranch=$(BUILD_SOURCEBRANCH)" />
</ItemGroup>

<PushToAzureDevOpsArtifacts
<PushToBuildStorage
ItemsToPush="@(ItemsToPush)"
IsStableBuild="$(IsStableBuild)"
ManifestBuildData="@(ManifestBuildData)"
ManifestRepoUri="$(BUILD_REPOSITORY_NAME)"
ManifestBranch="$(BUILD_SOURCEBRANCH)"
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="6.0.0-beta.21212.6">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="9.0.0-beta.24408.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>db49d790a4bfa977a9ed7436bf2aa242cefae45e</Sha>
<Sha>60ae233c3d77f11c5fdb53e570b64d503b13ba59</Sha>
</Dependency>
<Dependency Name="Microsoft.TemplateEngine.Tasks" Version="7.0.100-alpha.1.21601.1">
<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 @@
<MicrosoftNETSdkPackageVersion>9.0.100-rc.1.24413.1</MicrosoftNETSdkPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-rc.1.24410.5</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETILLinkPackageVersion>9.0.0-alpha.1.23556.4</MicrosoftNETILLinkPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>8.0.0-beta.24225.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>9.0.0-beta.24408.2</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-rc.1.24410.5</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>8.0.0-rtm.23511.3</MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>
<MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>9.0.0-alpha.1.23556.4</MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>
Expand Down
59 changes: 37 additions & 22 deletions tools/devops/automation/templates/release/vs-insertion-prep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ stages:
value: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_DOTNET_MACOS'] ]
- name: INCLUDE_DOTNET_TVOS
value: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_DOTNET_TVOS'] ]
- ${{ if eq(parameters.isPR, false) }}:
- group: Publish-Build-Assets
pool:
name: AzurePipelines-EO
demands:
Expand All @@ -148,6 +146,12 @@ stages:
New-Item -Path "$(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/governance" -Name "CredScanSuppressions.json" -Value '{"tool":"Crendential Scanner", "supressions":[]}'
displayName: Create credscan dummy ignore file

- task: UseDotNet@2
displayName: Install .NET 9.x
inputs:
version: 9.x
includePreviewVersions: true

- task: DownloadPipelineArtifact@2
inputs:
artifactName: DropMetadata-shipping-nugets
Expand All @@ -168,47 +172,58 @@ stages:
buildNumber: $(ReleaseDropPrefix)/nugets
destinationPath: $(Build.StagingDirectory)\nuget-signed

- script: make -C $(Build.SourcesDirectory)/dotnet version-props
displayName: make version props
- script: make -C $(Build.SourcesDirectory)/dotnet setup-publish-bar-manifest
displayName: make setup-publish-bar-manifest

- powershell: |
$varMap = @{ "INCLUDE_DOTNET_IOS" = "iOS"; "INCLUDE_DOTNET_MACCATALYST" = "MacCatalyst"; "INCLUDE_DOTNET_MACOS" = "macOS"; "INCLUDE_DOTNET_TVOS" = "tvOS" }
- pwsh: |
gci env: | format-table -autosize -wrap
Get-ChildItem -Name -Recurse -Path $(Build.StagingDirectory)
$varMap = [ordered]@{ "INCLUDE_DOTNET_IOS" = "iOS"; "INCLUDE_DOTNET_MACCATALYST" = "MacCatalyst"; "INCLUDE_DOTNET_MACOS" = "macOS"; "INCLUDE_DOTNET_TVOS" = "tvOS" }
foreach ($varName in $varMap.Keys) {
if ([Environment]::GetEnvironmentVariable($varName)) {
Write-Host "Variable '$varName' was set, setting MaestroProjectPlatformName to '$($varMap[$varName])'"
Write-Host "##vso[task.setvariable variable=MaestroProjectPlatformName]$($varMap[$varName])"
exit 0;
}
}
displayName: Set maestro project variable

- task: DotNetCoreCLI@2
- task: AzureCLI@2
displayName: generate and publish BAR manifest
inputs:
projects: $(Build.SourcesDirectory)/dotnet/package/Microsoft.$(MaestroProjectPlatformName).Ref/package.csproj
arguments: >-
azureSubscription: "Darc: Maestro Production"
scriptType: pscore
scriptLocation: inlineScript
inlineScript: >-
dotnet build $(Build.SourcesDirectory)\dotnet\package\Microsoft.$(MaestroProjectPlatformName).Ref\package.csproj
-t:PushManifestToBuildAssetRegistry
-p:BuildAssetRegistryToken=$(MaestroAccessToken)
-p:NupkgPath=$(Build.StagingDirectory)/nuget-signed
-bl:$(Build.ArtifactStagingDirectory)/maestro-binlogs/generate-bar-manifest.binlog
-p:NupkgPath=$(Build.StagingDirectory)\nuget-signed
-p:PrereleaseIdentifier=$(PrereleaseIdentifier)
-bl:$(Build.StagingDirectory)\maestro-binlogs\generate-bar-manifest.binlog
workingDirectory: $(Build.SourcesDirectory)\..
condition: and(succeeded(), eq('${{ parameters.pushNugetsToMaestro }}', 'true'))

- powershell: |
$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 --password $(MaestroAccessToken) --azdev-pat $(publishing-dnceng-devdiv-code-r-build-re)
- task: AzureCLI@2
inputs:
azureSubscription: "Darc: Maestro Production"
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
$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) --ci --publishing-infra-version 3 --azdev-pat $(System.AccessToken)
# We can't use the global.json located in the root of our repo, because makes it required to use the exact .NET version we're referencing in our eng/Versions.Details.xml file.
# So in order to not use it, we set the working directory to the parent directory of xamarin-macios.
workingDirectory: $(Build.SourcesDirectory)\..
displayName: Add builds to default darc channel
# We can't use the global.json located in the root of our repo, because makes it required to use the exact .NET version we're referencing in our eng/Versions.Details.xml file.
# So in order to not use it, we set the working directory to the parent directory of xamarin-macios.
workingDirectory: $(Build.SourcesDirectory)\..
condition: and(succeeded(), eq('${{ parameters.pushNugetsToMaestro }}', 'true'))

- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Artifact: maestro-binlogs'
inputs:
path: $(Build.ArtifactStagingDirectory)/maestro-binlogs
path: $(Build.StagingDirectory)\maestro-binlogs
artifact: ${{ parameters.uploadPrefix }}maestro-binlogs-$(System.JobAttempt)
condition: and(succeededOrFailed(), eq('${{ parameters.pushNugetsToMaestro }}', 'true'))
continueOnError: true
Loading