8000 Reintroduce support for building VMR from repo PR/CI by NikolaMilosavljevic · Pull Request #548 · dotnet/dotnet · GitHub
[go: up one dir, main page]

Skip to content

Reintroduce support for building VMR from repo PR/CI #548

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
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
26 changes: 22 additions & 4 deletions eng/pipelines/templates/jobs/vmr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ parameters:
type: stepList
default: []

#### repo parameters ####

- name: isBuiltFromVmr
displayName: True when build is running from dotnet/dotnet directly
type: boolean

jobs:
- job: ${{ parameters.buildName }}_${{ parameters.targetArchitecture }}${{ replace(format('_BuildPass{0}', coalesce(parameters.buildPass, '1')), '_BuildPass1', '') }}
pool: ${{ parameters.pool }}
Expand Down Expand Up @@ -160,8 +166,13 @@ jobs:
value: ''
- name: runTestsTimeout
value: 30
- name: vmrPath
value: $(Build.SourcesDirectory)

- ${{ if parameters.isBuiltFromVmr }}:
- name: vmrPath
value: $(Build.SourcesDirectory)
- ${{ else }}:
- name: vmrPath
value: $(Agent.BuildDirectory)/vmr

# Location of the VMR sources
# We either build the repo directly, or we extract them outside (which is what partners do)
Expand Down Expand Up @@ -270,7 +281,7 @@ jobs:
timeoutInMinutes: 720
## Currently, CodeQL slows the build down too much
## https://github.com/dotnet/source-build/issues/4276
${{ elseif and(startswith(parameters.buildName, 'Windows'), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
${{ elseif and(parameters.isBuiltFromVmr, startswith(parameters.buildName, 'Windows'), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
timeoutInMinutes: 720
${{ else }}:
timeoutInMinutes: 240
Expand Down Expand Up @@ -311,6 +322,13 @@ jobs:
sbomEnabled: false

steps:
- ${{ if not(parameters.isBuiltFromVmr) }}:
# Synchronize new content in the VMR during PRs (we expect this to come
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't seem complete.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it was the original comment I brought back along with the surrounding code. I'll remove the content in parenthesis as it doesn't add any value.

Here's the same comment in P4 branch:

# Synchronize new content in the VMR during PRs (we expect this to come

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes with 9981a4f

- template: /eng/common/templates/steps/vmr-pull-updates.yml@self
parameters:
vmrPath: $(vmrPath)
targetRef: $(Build.SourceVersion) # Synchronize the current repo commit

- ${{ if parameters.buildFromArchive }}:
- script: |
set -ex
Expand All @@ -322,7 +340,7 @@ jobs:
- ${{ if ne(parameters.reuseBuildArtifactsFrom,'') }}:
- ${{ each reuseBuildArtifacts in parameters.reuseBuildArtifactsFrom }}:
- ${{ if eq(parameters.buildSourceOnly, true) }}:
- template: ../steps/download-artifacts.yml@self
- template: ../steps/download-artifacts.yml
parameters:
artifactDescription: Previous Build (${{ reuseBuildArtifacts }} - Source Build artifacts)
artifactName: ${{ reuseBuildArtifacts }}_Artifacts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ parameters:
- name: legs
type: object

# True when build is running from dotnet/dotnet directly
- name: isBuiltFromVmr
type: boolean
default: true

stages:
- stage: VMR_SourceOnly_Build
displayName: VMR Source-Only Build
Expand Down Expand Up @@ -83,6 +88,7 @@ stages:
targetRid: ${{ variables.alpineX64Rid }}

targetArchitecture: ${{ leg.targetArchitecture }}
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
${{ if eq(leg.targetArchitecture, 'arm64') }}:
pool: ${{ parameters.pool_LinuxArm64 }}
${{ else }}:
Expand Down Expand Up @@ -151,6 +157,7 @@ stages:
targetRid: ${{ variables.alpineX64Rid }}

targetArchitecture: ${{ leg.targetArchitecture }}
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
${{ if eq(leg.targetArchitecture, 'arm64') }}:
pool: ${{ parameters.pool_LinuxArm64 }}
${{ else }}:
Expand Down
6 changes: 6 additions & 0 deletions eng/pipelines/templates/stages/source-build-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ parameters:
type: boolean
default: true

# True when build is running from dotnet/dotnet directly
- name: isBuiltFromVmr
type: boolean
default: true

stages:
- template: source-build-and-validate.yml
parameters:
pool_Linux: ${{ parameters.pool_Linux }}
pool_LinuxArm64: ${{ parameters.pool_LinuxArm64 }}
scope: ${{ parameters.scope }}
useMicrosoftBuildAssetsForTests: ${{ parameters.useMicrosoftBuildAssetsForTests }}
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}

# Description of the source build legs to run.
# This is described here as a parameter to allow two separate stages to be produced from this list (one for building
Expand Down
18 changes: 16 additions & 2 deletions eng/pipelines/templates/stages/vmr-build-with-join.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ parameters:
- name: finalJoinCondition
type: boolean

#### repo parameters ####
- name: isBuiltFromVmr
displayName: True when build is running from dotnet/dotnet directly
type: boolean

# These are not expected to be passed it but rather just object variables reused below
- name: pool_Linux
type: object
Expand Down Expand Up @@ -66,8 +71,12 @@ stages:
- ${{ if ne(stage.templateContext.validationOnly, 'true') }}:
- ${{ stage.stage }}
variables:
- name: vmrPath
value: $(Build.SourcesDirectory)
- ${{ if parameters.isBuiltFromVmr }}:
- name: vmrPath
value: $(Build.SourcesDirectory)
- ${{ else }}:
- name: vmrPath
value: $(Agent.BuildDirectory)/vmr
- template: ../variables/vmr-build.yml
jobs:
- job: FinalJoin
Expand Down Expand Up @@ -129,6 +138,11 @@ stages:
inputs:
path: $(Build.ArtifactStagingDirectory)/VerticalArtifacts/${{ vertical.job }}
artifactName: ${{ vertical.job }}_Artifacts
- ${{ if not(parameters.isBuiltFromVmr) }}:
- template: /eng/common/templates/steps/vmr-pull-updates.yml@self
parameters:
vmrPath: ${{ variables.vmrPath }}
targetRef: $(Build.SourceVersion) # Synchronize the current repo commit
- template: ../steps/vmr-join-verticals.yml
parameters:
dotNetBuildPass: final
Expand Down
13 changes: 11 additions & 2 deletions eng/pipelines/templates/stages/vmr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ parameters:
# run everything
- full

# True when build is running from dotnet/dotnet directly
- name: isBuiltFromVmr
type: boolean
default: true

# True when building the VMR in source-only mode
- name: isSourceOnlyBuild
type: boolean
Expand Down Expand Up @@ -76,15 +81,17 @@ stages:
parameters:
desiredSigning: ${{ parameters.desiredSigning }}
desiredIbc: ${{ parameters.desiredIbc }}
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
scope: ${{ parameters.scope }}
isSourceOnlyBuild: ${{ parameters.isSourceOnlyBuild }}
finalJoinCondition: ${{ and(not(parameters.isSourceOnlyBuild), eq(parameters.scope, 'full')) }}
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
postJoinStages:
- ${{ if and(not(parameters.isSourceOnlyBuild), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if and(parameters.isBuiltFromVmr, not(parameters.isSourceOnlyBuild), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- stage: Publish_Build_Assets
displayName: Publish Assets
jobs:
- template: /eng/common/templates-official/job/publish-build-assets.yml@self
- template: /eng/common/templates-official/job/publish-build-assets.yml
parameters:
publishUsingPipelines: true
publishAssetsImmediately: true
Expand All @@ -104,10 +111,12 @@ stages:
pool_LinuxArm64: ${{ parameters.pool_LinuxArm64 }}
scope: ${{ parameters.scope }}
useMicrosoftBuildAssetsForTests: false
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
# Pull requests aren't supported until https://github.com/dotnet/source-build/issues/5061 is fixed
- ${{ elseif ne(variables['Build.Reason'], 'PullRequest') }}:
- template: source-build-stages.yml
parameters:
pool_Linux: ${{ parameters.pool_Linux }}
pool_LinuxArm64: ${{ parameters.pool_LinuxArm64 }}
scope: ${{ parameters.scope }}
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
Loading
Loading
0