Skip to content

Support OfficialBuildId for SB #48327

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 22 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a22e3ab
Support OfficialBuildId for SB
mthalman Mar 18, 2025
269eba9
Revert line removal
mthalman Apr 10, 2025
2e4029b
Fix comments
mthalman Apr 10, 2025
2eb97de
Use common property for determining prebuilt feed inclusion
mthalman Apr 10, 2025
483c975
Use condition for arcade bootstrap
mthalman Apr 10, 2025
5a86952
Use RestoreAdditionalProjectSources for SB tests
mthalman Apr 10, 2025
392a5e6
Update condition in arcade patch
mthalman Apr 10, 2025
e87b02f
Remove test ref on UB.Tasks
mthalman Apr 10, 2025
b8206dd
Factor out SB jobs
mthalman Apr 11, 2025
2085294
Don't override package versions in test-only mode
mthalman Apr 11, 2025
442ab33
Update arcade patch
mthalman Apr 11, 2025
54bcb66
Fix repo deps for scenario tests
mthalman Apr 11, 2025
5e0273d
Encode semicolons for msbuild prop
mthalman Apr 14, 2025
d81686e
Update src/SourceBuild/content/repo-projects/Directory.Build.targets
mthalman Apr 14, 2025
848abe1
Update src/SourceBuild/patches/arcade/0001-Use-test-prefix-on-unoffic…
mthalman Apr 14, 2025
51fe342
Define empty-ish packages.props file for test only model
mthalman Apr 14, 2025
850f56c
Downgrade importance of msg
mthalman Apr 14, 2025
01552a2
Merge branch 'main' into sb4855-officialbuildid
mthalman Apr 14, 2025
7d1383e
Encode semicolons for msbuild prop
mthalman Apr 14, 2025
7f6e3e2
Merge branch 'main' into sb4855-officialbuildid
mthalman Apr 15, 2025
5c06683
Remove arcade patch for prerelease labels
mthalman Apr 17, 2025
ed42450
Merge branch 'main' into sb4855-officialbuildid
mthalman Apr 17, 2025
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
96 changes: 96 additions & 0 deletions eng/pipelines/templates/jobs/source-only-build-and-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
parameters:
- name: buildNamePrefix
type: string

- name: container
type: object
default:
image: ''
name: ''

# Allow downloading artifacts from the internet during the build
- name: runOnline
type: boolean
default: true

- name: targetArchitecture
type: string
default: ''

- name: pool_Linux
type: object
default:
name: $(defaultPoolName)
image: $(poolImage_Linux)
demands: ImageOverride -equals $(poolImage_Linux)
os: linux

jobs:
# Source Build Leg
- template: ../jobs/vmr-build.yml
parameters:
buildName: ${{ format('{0}_SourceBuild_Online_MsftSdk', parameters.buildNamePrefix) }}
isBuiltFromVmr: true
vmrBranch: ${{ variables.VmrBranch }}
targetArchitecture: x64
pool: ${{ parameters.pool_Linux }}
container: ${{ parameters.container }}
buildSourceOnly: true
runOnline: ${{ parameters.runOnline }}
runTests: false
extraProperties: "/p:EnableDevBuildAsDefaultForSourceOnly=true"

# Source Build Validation
- template: ../jobs/vmr-build.yml
parameters:
buildName: ${{ format('{0}_SourceBuild_Online_MsftSdk', parameters.buildNamePrefix) }}_Validation
isBuiltFromVmr: true
vmrBranch: ${{ variables.VmrBranch }}
targetArchitecture: ${{ parameters.targetArchitecture }}
pool: ${{ parameters.pool_Linux }}
container: ${{ parameters.container }}
buildSourceOnly: true
runOnline: ${{ parameters.runOnline }}
runTests: true
skipBuild: true
extraProperties: >
/p:DotNetSourceOnlyTestOnly=true
/p:ExtraRestoreSourcePath=$(Pipeline.Workspace)/msft-pkgs
/p:RestoreAdditionalProjectSources=$(Pipeline.Workspace)/msft-pkgs
dependsOn:
- AzureLinux_x64_Cross_x64
- Browser_Shortstack_wasm
- Windows_x64
- ${{ format('{0}_SourceBuild_Online_MsftSdk_x64', parameters.buildNamePrefix) }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the x64 references in the validation parameter be updated to use ${{ parameters.targetArchitecture }}? This one particular reference jumps out as the preceding job's name is built with the targetArchitecture. I am alright with fixing this when other legs are onboarded so that they can be validated.

testInitSteps:
# Ensure the artifacts staging directory exists so that even if no files get placed there, it won't fail
# when publishing the artifacts.
- script: mkdir -p $(artifactsStagingDir)
displayName: Create Artifacts Staging Directory
- template: ../steps/download-artifacts.yml
parameters:
artifactDescription: Microsoft Linux Packages
artifactName: AzureLinux_x64_Cross_x64_Artifacts
downloadFilePatterns: packages/Release/Shipping/**
copyDestination: $(Pipeline.Workspace)/msft-pkgs
flattenDirs: true
- template: ../steps/download-artifacts.yml
parameters:
artifactDescription: Microsoft WASM Packages
artifactName: Browser_Shortstack_wasm_Artifacts
downloadFilePatterns: packages/Release/Shipping/**
copyDestination: $(Pipeline.Workspace)/msft-pkgs
flattenDirs: true
- template: ../steps/download-artifacts.yml
parameters:
artifactDescription: Microsoft Windows Packages
artifactName: Windows_x64_Artifacts
downloadFilePatterns: packages/Release/Shipping/**
copyDestination: $(Pipeline.Workspace)/msft-pkgs
flattenDirs: true
- template: ../steps/download-artifacts.yml
parameters:
artifactDescription: Source Build Assets
artifactName: ${{ format('{0}_SourceBuild_Online_MsftSdk_x64', parameters.buildNamePrefix) }}_Artifacts
downloadFilePatterns: assets/Release/**/*.tar.gz
copyDestination: $(Build.SourcesDirectory)/artifacts
148 changes: 83 additions & 65 deletions eng/pipelines/templates/jobs/vmr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ parameters:
type: boolean
default: false

# Name of previous job(s) (from the same template as this) whose output will be used to build this job
# The SDK from its artifacts is copied to $(sourcesPath)/.dotnet
- name: reuseBuildArtifactsFrom
type: object
default: ''

# Names of jobs that this job depends on. This only provides a job dependency and does not automatically
# download artifacts from the other job. Use reuseBuildArtifactsFrom for that.
- name: dependsOn
type: object
default: ''

#### SOURCE-ONLY parameters ####

# Instead of building the VMR directly, exports the sources into a tarball and builds from that
Expand All @@ -83,12 +95,6 @@ parameters:
type: boolean
default: false

# Name of previous job(s) (from the same template as this) whose output will be used to build this job
# The SDK from its artifacts is copied to $(sourcesPath)/.dotnet
- name: reuseBuildArtifactsFrom
type: object
default: ''

# Allow downloading artifacts from the internet during the build
- name: runOnline
type: boolean
Expand All @@ -108,6 +114,16 @@ parameters:
type: boolean
default: false

# Skip the build step (this would be used when wanting to run tests only)
- name: skipBuild
type: boolean
default: false

# Custom steps to run before running tests
- name: testInitSteps
type: stepList
default: []

#### sdk parameters ####

- name: isBuiltFromVmr
Expand Down Expand Up @@ -138,7 +154,7 @@ jobs:
image: ${{ parameters.container.image }}
options: $(defaultContainerOptions)

${{ if ne(parameters.reuseBuildArtifactsFrom, '') }}:
${{ if or(ne(parameters.reuseBuildArtifactsFrom, ''), ne(parameters.dependsOn, '')) }}:
${{ if eq(parameters.buildPass, '') }}:
# For PR builds, skip the stage 2 build if the stage 1 build fails.
# Otherwise, run the stage 2 build even if the stage 1 build fails so that we can get a complete assessment of the build status.
Expand All @@ -149,7 +165,11 @@ jobs:
condition: succeededOrFailed()
${{ else }}:
condition: succeeded()
dependsOn: ${{ parameters.reuseBuildArtifactsFrom }}
dependsOn:
- ${{ if ne(parameters.reuseBuildArtifactsFrom, '') }}:
- ${{ parameters.reuseBuildArtifactsFrom }}
- ${{ if ne(parameters.dependsOn, '') }}:
- ${{ parameters.dependsOn }}
variables:
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
Expand Down Expand Up @@ -344,20 +364,15 @@ jobs:
- ${{ if ne(parameters.reuseBuildArtifactsFrom,'') }}:
- ${{ each reuseBuildArtifacts in parameters.reuseBuildArtifactsFrom }}:
- ${{ if eq(parameters.buildSourceOnly, true) }}:
- download: current
artifact: ${{ reuseBuildArtifacts }}_Artifacts
patterns: |
**/Private.SourceBuilt.Artifacts.*.tar.gz
**/dotnet-sdk-*.tar.gz
**/*.nupkg
displayName: Download Previous Build (${{ reuseBuildArtifacts }})

- task: CopyFiles@2
displayName: Copy Previous Build (${{ reuseBuildArtifacts }} - Source Build artifacts)
inputs:
SourceFolder: $(Pipeline.Workspace)/${{ reuseBuildArtifacts }}_Artifacts/assets/Release
Contents: '*.tar.gz'
TargetFolder: $(sourcesPath)/prereqs/packages/archive/
- template: ../steps/download-artifacts.yml@self
parameters:
artifactDescription: Previous Build (${{ reuseBuildArtifacts }} - Source Build artifacts)
artifactName: ${{ reuseBuildArtifacts }}_Artifacts
downloadFilePatterns: |
**/Private.SourceBuilt.Artifacts.*.tar.gz
**/dotnet-sdk-*.tar.gz
copyDestination: $(sourcesPath)/prereqs/packages/archive/
flattenDirs: true

- ${{ else }}:
- task: DownloadPipelineArtifact@2
Expand Down Expand Up @@ -502,61 +517,62 @@ jobs:
displayName: Prep the Build
workingDirectory: $(sourcesPath)

- script: |
set -ex
df -h
- ${{ if ne(parameters.skipBuild, 'true') }}:

customEnvVars=""
customPreBuildArgs=""
customBuildArgs="$(baseArguments) $(signArguments) $(_SignDiagnosticFilesArgs)"
extraBuildProperties="$(baseProperties) /p:ArtifactsStagingDir=$(Build.ArtifactStagingDirectory) $(targetProperties) $(signProperties) $(buildPassProperties) ${{ parameters.extraProperties }}"
- script: |
set -ex
df -h

if [[ '${{ parameters.runOnline }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --online"
else
customPreBuildArgs="$customPreBuildArgs sudo unshare -n"
fi
customEnvVars=""
customPreBuildArgs=""
customBuildArgs="$(baseArguments) $(signArguments) $(_SignDiagnosticFilesArgs)"
extraBuildProperties="$(baseProperties) /p:ArtifactsStagingDir=$(Build.ArtifactStagingDirectory) $(targetProperties) $(signProperties) $(buildPassProperties) ${{ parameters.extraProperties }}"

if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --poison"
fi
if [[ '${{ parameters.runOnline }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --online"
else
customPreBuildArgs="$customPreBuildArgs sudo unshare -n"
fi

if [[ '${{ parameters.buildFromArchive }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --source-repository https://github.com/dotnet/dotnet"
customBuildArgs="$customBuildArgs --source-version $(git -C "$(vmrPath)" rev-parse HEAD)"
fi
if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --poison"
fi

if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --source-only"
extraBuildProperties="$extraBuildProperties /p:ReportSbrpUsage=true"
fi
if [[ '${{ parameters.buildFromArchive }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --source-repository https://github.com/dotnet/dotnet"
customBuildArgs="$customBuildArgs --source-version $(git -C "$(vmrPath)" rev-parse HEAD)"
fi

if [[ '${{ parameters.useMonoRuntime }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --use-mono-runtime"
fi
if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --source-only"
extraBuildProperties="$extraBuildProperties /p:ReportSbrpUsage=true"
fi

if [[ -n "${{ parameters.targetRid }}" ]]; then
customBuildArgs="$customBuildArgs --target-rid ${{ parameters.targetRid }}"
fi
if [[ '${{ parameters.useMonoRuntime }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --use-mono-runtime"
fi

if [[ -n "${{ parameters.crossRootFs }}" ]]; then
customEnvVars="$customEnvVars ROOTFS_DIR=${{ parameters.crossRootFs}}"
if [[ '${{ parameters.targetArchitecture }}' != 'wasm' ]]; then
extraBuildProperties="$extraBuildProperties /p:CrossBuild=true"
if [[ -n "${{ parameters.targetRid }}" ]]; then
customBuildArgs="$customBuildArgs --target-rid ${{ parameters.targetRid }}"
fi

if [[ -n "${{ parameters.crossRootFs }}" ]]; then
customEnvVars="$customEnvVars ROOTFS_DIR=${{ parameters.crossRootFs}}"
if [[ '${{ parameters.targetArchitecture }}' != 'wasm' ]]; then
extraBuildProperties="$extraBuildProperties /p:CrossBuild=true"
fi
fi
fi

buildArgs="$(additionalBuildArgs) $customBuildArgs $extraBuildProperties"
buildArgs=$(echo $buildArgs | xargs) # Remove extra spaces
buildArgs="$(additionalBuildArgs) $customBuildArgs $extraBuildProperties"

for envVar in $customEnvVars; do
customEnvVarsWithBashSyntax="$customEnvVarsWithBashSyntax export $envVar;"
done
for envVar in $customEnvVars; do
customEnvVarsWithBashSyntax="$customEnvVarsWithBashSyntax export $envVar;"
done

eval $customEnvVarsWithBashSyntax
$customPreBuildArgs ./build.sh $buildArgs
displayName: Build
workingDirectory: $(sourcesPath)
eval $customEnvVarsWithBashSyntax
$customPreBuildArgs ./build.sh $buildArgs
displayName: Build
workingDirectory: $(sourcesPath)

- ${{ if ne(parameters.runOnline, 'True' )}}:
- script: |
Expand All @@ -567,6 +583,8 @@ jobs:

# Only run tests if enabled
- ${{ if eq(parameters.runTests, 'True') }}:
- ${{ parameters.testInitSteps }}

# Setup the NuGet sources used by the tests to use private feeds. This is necessary when testing internal-only product
# builds where the packages are only available in the private feeds. This allows the tests to restore from those feeds.
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
Expand Down
9 changes: 9 additions & 0 deletions eng/pipelines/templates/stages/vmr-verticals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -995,3 +995,12 @@ stages:
- Windows_x64
- Windows_x86
- Windows_arm64

- template: ../jobs/source-only-build-and-validate.yml
parameters:
buildNamePrefix: ${{ variables.centOSStreamName }}
runOnline: true
targetArchitecture: x64
container:
name: ${{ variables.centOSStreamContainerName }}
image: ${{ variables.centOSStreamContainerImage }}
25 changes: 25 additions & 0 deletions eng/pipelines/templates/steps/download-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
parameters:
- name: artifactDescription
type: string
- name: artifactName
type: string
- name: downloadFilePatterns
type: string
- name: copyDestination
type: string
- name: flattenDirs
type: boolean
default: false

steps:
- download: current
artifact: ${{ parameters.artifactName }}
patterns: ${{ parameters.downloadFilePatterns }}
displayName: Download ${{ parameters.artifactDescription }}
- task: CopyFiles@2
displayName: Copy ${{ parameters.artifactDescription }}
inputs:
SourceFolder: $(Pipeline.Workspace)/${{ parameters.artifactName }}
Contents: '**'
FlattenFolders: ${{ parameters.flattenDirs }}
TargetFolder: ${{ parameters.copyDestination }}
2 changes: 1 addition & 1 deletion src/Layout/redist/targets/RestoreLayout.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<!-- Blob storage directories are not stabilized, so these must refer to a package that does not stabilize -->
<!-- In unified build, the layout does match, so use the runtime package versions rather than the VS redist versions -->
<AspNetCoreBlobVersion>$(MicrosoftAspNetCoreAppRefInternalPackageVersion)</AspNetCoreBlobVersion>
<AspNetCoreBlobVersion>$(MicrosoftAspNetCoreAppRuntimePackageVersion)</AspNetCoreBlobVersion>
<NetRuntimeBlobVersion>$(MicrosoftNETCorePlatformsPackageVersion)</NetRuntimeBlobVersion>
<WindowsDesktopBlobVersion>$(VSRedistCommonWindowsDesktopSharedFrameworkx64100PackageVersion)</WindowsDesktopBlobVersion>
<WindowsDesktopBlobVersion Condition="'$(DotNetBuildOrchestrator)' == 'true'">$(MicrosoftWindowsDesktopAppRuntimePackageVersion)</WindowsDesktopBlobVersion>
Expand Down
Loading
Loading