Fix vmr build number (#19217)

This commit is contained in:
Djuradj Kurepa 2024-03-27 19:15:52 +01:00 committed by GitHub
parent ba50c92ce5
commit 6b0cb559d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 9 deletions

View file

@ -321,6 +321,8 @@ jobs:
# Allows Arcade to have access to the commit for the build, pass it through to the container # Allows Arcade to have access to the commit for the build, pass it through to the container
customEnvVars="$customEnvVars BUILD_SOURCEVERSION=$BUILD_SOURCEVERSION" customEnvVars="$customEnvVars BUILD_SOURCEVERSION=$BUILD_SOURCEVERSION"
customEnvVars="$customEnvVars BUILD_BUILDNUMBER=$(Build.BuildNumber)"
customDockerRunArgs="" customDockerRunArgs=""
for envVar in $customEnvVars; do for envVar in $customEnvVars; do
customDockerRunArgs="$customDockerRunArgs -e $envVar" customDockerRunArgs="$customDockerRunArgs -e $envVar"

View file

@ -214,12 +214,6 @@
<PoisonedReportFile>$(PackageReportDir)poisoned.txt</PoisonedReportFile> <PoisonedReportFile>$(PackageReportDir)poisoned.txt</PoisonedReportFile>
</PropertyGroup> </PropertyGroup>
<!-- The predefined environmental variable `BUILD_BUILDNUMBER` is getting overwritten in repo-projects,
so save it in a different varialbe-->
<PropertyGroup>
<VmrBuildNumber>$(BUILD_BUILDNUMBER)"</VmrBuildNumber>
</PropertyGroup>
<Import Project="$(GitInfoAllRepoPropsFile)" /> <Import Project="$(GitInfoAllRepoPropsFile)" />
</Project> </Project>

View file

@ -36,10 +36,11 @@
<RepoAssetManifest Include="$(AssetManifestsIntermediateDir)\**\*.xml" /> <RepoAssetManifest Include="$(AssetManifestsIntermediateDir)\**\*.xml" />
</ItemGroup> </ItemGroup>
<!-- It's OK for the VmrBuildNumber to be empty -->
<Microsoft.DotNet.UnifiedBuild.Tasks.MergeAssetManifests <Microsoft.DotNet.UnifiedBuild.Tasks.MergeAssetManifests
AssetManifest="@(RepoAssetManifest)" AssetManifest="@(RepoAssetManifest)"
MergedAssetManifestOutputPath="$(MergedAssetManifestOutputPath)" MergedAssetManifestOutputPath="$(MergedAssetManifestOutputPath)"
VmrBuildNumber="$(VmrBuildNumber)" /> VmrBuildNumber="$(BUILD_BUILDNUMBER)" />
</Target> </Target>
<Import Project="$(RepositoryEngineeringDir)build.sourcebuild.targets" Condition="'$(DotNetBuildSourceOnly)' == 'true'" /> <Import Project="$(RepositoryEngineeringDir)build.sourcebuild.targets" Condition="'$(DotNetBuildSourceOnly)' == 'true'" />

View file

@ -31,8 +31,7 @@ namespace Microsoft.DotNet.UnifiedBuild.Tasks
/// <summary> /// <summary>
/// Azure DevOps build number /// Azure DevOps build number
/// </summary> /// </summary>
[Required] public string VmrBuildNumber { get; set; } = string.Empty;
public required string VmrBuildNumber { get; init; }
private static readonly string _buildIdAttribute = "BuildId"; private static readonly string _buildIdAttribute = "BuildId";
private static readonly string _azureDevOpsBuildNumberAttribute = "AzureDevOpsBuildNumber"; private static readonly string _azureDevOpsBuildNumberAttribute = "AzureDevOpsBuildNumber";