Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
c4970d6
Build the VMR during PR validation
premun Nov 23, 2022
0938c23
Remove unnecessary steps for managing tarball
premun Nov 23, 2022
fd3b65b
Add nicer names
premun Nov 23, 2022
9d02157
Fix booleans
premun Nov 23, 2022
26491a7
Fix job name
premun Nov 23, 2022
e7f6a73
Improve file headers
premun Nov 23, 2022
14ca9c8
Merge VMR pipelines into the official installer one
premun Nov 24, 2022
cfc98f9
Try `variables.` notation
premun Nov 24, 2022
b58fc9d
Unroll the matrix into a template list
premun Nov 24, 2022
a736d60
Try different way of default pool
premun Nov 24, 2022
3ab8718
Add the two weird extra legs
premun Nov 24, 2022
a623097
Fix the default pool + previous SDK
premun Nov 24, 2022
fc8ac0a
Copy installer on manual runs too
premun Nov 24, 2022
ef4e066
Remove the GitHub PAT everywhere but pushing
premun Nov 25, 2022
1f40c52
Fix VMR path + some other minor problems
premun Nov 25, 2022
dad3f25
Disable VMR push on manual builds
premun Nov 25, 2022
170fd0a
Use token in internal always
premun Nov 25, 2022
bffc8a8
Add the noPush parameter to the installer CI
premun Nov 25, 2022
d579767
Comment out build configuration
premun Nov 25, 2022
a96e66f
Add the public origin for installer
premun Nov 25, 2022
fcf98f1
Fix setting up private feeds
premun Nov 25, 2022
3e50b83
Try removing offending NuGet.config files
premun Nov 25, 2022
26e6d3f
Pass and re-use VMR SHA
premun Nov 25, 2022
8521507
Revert "Try removing offending NuGet.config files"
premun Nov 25, 2022
eccd5b1
Merge source-build-steps into the template
premun Nov 25, 2022
84b1f59
Pass SHA through a variable
premun Nov 25, 2022
0691bff
Parametrize VMR branch
premun Nov 25, 2022
b303a08
Pull VMR updates for manual runs
premun Nov 25, 2022
92bb88e
Add the GitHub PAT
premun Nov 25, 2022
a85ee23
Fix job that depends on previous artifacts
premun Nov 25, 2022
01936f9
Pass down vmr branch
premun Nov 25, 2022
c5ad876
Create a dedicated stage for source-build dependencies
premun Nov 25, 2022
a9e63cb
Fix vmrPath
premun Nov 25, 2022
435c0fe
Reorganize stages once more
premun Nov 25, 2022
87742f5
Add the feeds variable group
premun Nov 25, 2022
94861af
Fix job name for previously built artifacts
premun Nov 25, 2022
74b1090
Clean-up
premun Nov 25, 2022
05d99ad
Unify parameters for re-using previous artifacts
premun Nov 25, 2022
b0fcc23
Improve logic around pushing the VMR
premun Nov 25, 2022
8997338
Add the noPublish option
premun Nov 25, 2022
db52219
Remove source-build pipelines
premun Nov 25, 2022
7e82b11
Skip ComponentGovernance detection for VMR build legs
premun Nov 25, 2022
b972416
Unify variable names
premun Nov 28, 2022
788fc6b
Re-order the matrix and add icons
premun Nov 28, 2022
c0b26e8
Add a new pipeline for the VMR source-build
premun Nov 28, 2022
4d19a0e
Depend on the Build_Linux stage
premun Nov 28, 2022
2974ecf
Re-use the same installer commit as the previous pipeline
premun Nov 28, 2022
f522dda
Checkout VMR's commit from the previous build
premun Nov 28, 2022
0604837
Fix VMR synchronization
premun Nov 28, 2022
ac603e7
Do not sync VMR when pushed
premun Nov 28, 2022
87b774d
Clone installer for private feed setup
premun Nov 28, 2022
06c2ce2
Merge remote-tracking branch 'origin/main' into prvysoky/vmr-source-b…
premun Nov 28, 2022
a9bbeac
Clean up code
premun Nov 28, 2022
83b107b
Use endpoint in internal builds only
premun Nov 28, 2022
043b8c2
Use endpoint in internal builds only
premun Nov 28, 2022
834e4a2
Use the public endpoint
premun Nov 28, 2022
6ec3ee0
Use the right pool
premun Nov 28, 2022
5755033
Do not use AzDO PAT
premun Nov 28, 2022
181b435
Rename `vmr-source-build` to `vmr-build`
premun Nov 29, 2022
415e00f
Rename the Build step
premun Nov 29, 2022
4fa2346
Rename to `vmr-ci`
premun Nov 29, 2022
448c419
Remove branch exclusions
premun Nov 29, 2022
4fda1cb
Use scripts from the VMR, remove clone of installer
premun Nov 29, 2022
2051b9b
Remove unnecessary `if`s
premun Nov 29, 2022
25964a4
Rename name to buildName
premun Nov 29, 2022
12bf3e6
Only run CI in PRs, simplify VMR SHA flow
premun Nov 29, 2022
5e87dff
Remove noPublish
premun Nov 29, 2022
48f86e1
Remove noPush
premun Nov 29, 2022
af4094a
Revert the separate stage
premun Nov 29, 2022
7488561
Remove the `Build_` prefix
premun Nov 29, 2022
f3ab6b4
Add a note about disabling the source-build leg
premun Nov 29, 2022
628379d
Merge remote-tracking branch 'origin/main' into prvysoky/vmr-source-b…
premun Nov 29, 2022
26d3bee
Pull in changes from https://github.com/dotnet/installer/pull/15007
premun Nov 30, 2022
7aafe2b
Merge remote-tracking branch 'azdo/main' into prvysoky/vmr-source-build
premun Nov 30, 2022
2235781
Use the `dotnet` endpoint
premun Nov 30, 2022
da962a2
Add the VmrBranch parameter to vmr-ci
premun Nov 30, 2022
c27b032
Revert PGO changes
premun Nov 30, 2022
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
35 changes: 30 additions & 5 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ trigger:
- internal/release/6.*
- internal/release/7.*

resources:
repositories:
- repository: vmr
type: github
name: dotnet/dotnet
endpoint: dotnet

parameters:
- name: vmrBranch
displayName: dotnet/dotnet branch to push to
type: string
default: $(Build.SourceBranchName)

variables:
- name: _PublishUsingPipelines
value: false
Expand Down Expand Up @@ -345,12 +358,24 @@ stages:

- template: /eng/common/templates/jobs/source-build.yml

- template: /src/SourceBuild/Arcade/eng/common/templates/job/source-build-create-tarball.yml

- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
- template: /src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- stage: Synchronize_VMR
displayName: Synchronize VMR
dependsOn: []
jobs:
- template: /eng/pipelines/templates/jobs/vmr-synchronization.yml
parameters:
dependsOn: Source_Build_Create_Tarball
vmrBranch: ${{ parameters.vmrBranch }}

# In case the VMR Build stage needs to be temporarily disabled, please make sure that
# the VMR synchronization step is run to validate that the PR can be merged and later
# synchronized into the VMR without problems.
# You can do this by allowing the Synchronize_VMR stage from above in PRs.
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- template: /eng/pipelines/templates/stages/vmr-build.yml
parameters:
vmrBranch: ${{ parameters.vmrBranch }}
installerBuildResourceId: current

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- stage: Publish
Expand Down
225 changes: 225 additions & 0 deletions eng/pipelines/templates/jobs/vmr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
### This job source-builds https://github.com/dotnet/dotnet with given parameters
### If run in a PR, new changes are applied to a local copy of the VMR, then it is source-built and tested

parameters:

- name: vmrPath
type: string
default: $(Agent.BuildDirectory)/vmr

- name: vmrBranch
displayName: dotnet/dotnet branch to use
type: string
default: $(Build.SourceBranchName)

# Resource id of the installer build to retrieve MSFT SDK from
- name: installerBuildResourceId
type: string

- name: buildName
type: string

- name: architecture
type: string

- name: container
type: string

- name: pool
type: object

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

# Skip running the SDK content smoke-tests
- name: excludeSdkContentTests
type: boolean
default: false

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

- name: excludeOmniSharpTests
type: boolean

- name: bootstrapPrep
type: boolean

- name: enablePoison
type: boolean

jobs:
- job: ${{ parameters.buildName }}_${{ parameters.architecture }}
timeoutInMinutes: 150
pool: ${{ parameters.pool }}
${{ if ne(parameters.reuseBuildArtifactsFrom, '') }}:
# Always attempt to run the bootstrap leg (e.g. even when stage 1 tests fail) in order to get a complete accessment of the build status.
# The build shortcuts when stage 1 build fails and doesn't produce the SDK.
condition: succeededOrFailed()
dependsOn: ${{ parameters.reuseBuildArtifactsFrom }}_${{ parameters.architecture }}
variables:
- template: /eng/common/templates/variables/pool-providers.yml
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNetBot-GitHub
- group: AzureDevOps-Artifact-Feeds-Pats
- ${{ else }}:
- name: BotAccount-dotnet-bot-repo-PAT
value: N/A
- ${{ if eq(parameters.reuseBuildArtifactsFrom, '') }}:
- name: additionalBuildArgs
value: ''
- ${{ else }}:
- name: additionalBuildArgs
value: ' --with-sdk /vmr/.dotnet'

steps:
- template: ../steps/vmr-prepare.yml
parameters:
vmrBranch: ${{ parameters.vmrBranch }}
installerBuildResourceId: ${{ parameters.installerBuildResourceId }}
skipComponentGovernanceDetection: true

# Synchronize new content in the VMR during PRs (we expect this to come
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- template: ../steps/vmr-pull-updates.yml
parameters:
vmrPath: ${{ parameters.vmrPath }}
vmrBranch: ${{ parameters.vmrBranch }}
targetRef: $(Build.SourceVersion) # Synchronize the current installer commit

- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- script: cp ${{ parameters.vmrPath }}/src/installer/NuGet.config ${{ parameters.vmrPath }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/online.NuGet.Config
displayName: Copy Test NuGet Config

- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: ${{ parameters.vmrPath }}/src/installer/eng/common/SetupNugetSources.sh
arguments: ${{ parameters.vmrPath }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/online.NuGet.Config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)

- ${{ if ne(parameters.excludeSdkContentTests, 'true') }}:
- download: ${{ parameters.installerBuildResourceId }}
artifact: BlobArtifacts
patterns: '**/dotnet-sdk-+([0-9]).+([0-9]).+([0-9])?(-@(alpha|preview|rc|rtm)*)-linux-${{ parameters.architecture }}.tar.gz'
displayName: Download MSFT SDK

- ${{ if ne(parameters.reuseBuildArtifactsFrom, '') }}:
- download: current
artifact: ${{ parameters.reuseBuildArtifactsFrom }}_${{ parameters.architecture }}_Artifacts
patterns: '*.tar.gz'
displayName: Download Previous Build

- task: CopyFiles@2
displayName: Copy Previous Build
inputs:
SourceFolder: $(Pipeline.Workspace)/${{ parameters.reuseBuildArtifactsFrom }}_${{ parameters.architecture }}_Artifacts
Contents: '*.tar.gz'
TargetFolder: ${{ parameters.vmrPath }}/packages/archive/

- script: |
set -x

if [[ -z '${{ parameters.reuseBuildArtifactsFrom }}' ]]; then
customPrepArgs=
if [[ '${{ parameters.bootstrapPrep }}' == 'True' ]]; then
customPrepArgs='--bootstrap'
fi

docker run --rm -v ${{ parameters.vmrPath }}:/vmr -w /vmr ${{ parameters.container }} ./prep.sh ${customPrepArgs}
else
mkdir ${{ parameters.vmrPath }}/.dotnet
previousSdkPath="${{ parameters.vmrPath }}/packages/archive/dotnet-sdk-*.tar.gz"
eval tar -ozxf "$previousSdkPath" -C "${{ parameters.vmrPath }}/.dotnet"
eval rm -f "$previousSdkPath"
fi
displayName: Prep the Build

- script: |
set -x
df -h

networkArgs=
customBuildArgs=
if [[ '${{ parameters.runOnline }}' == 'True' ]]; then
customBuildArgs='--online'
else
networkArgs='--network none'
fi

if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --poison"
fi

docker run --rm -v ${{ parameters.vmrPath }}:/vmr -w /vmr ${networkArgs} ${{ parameters.container }} ./build.sh --clean-while-building $(additionalBuildArgs) ${customBuildArgs}
displayName: Build

- script: |
set -x

dockerVolumeArgs="-v ${{ parameters.vmrPath }}:/vmr"
dockerEnvArgs="-e SMOKE_TESTS_EXCLUDE_OMNISHARP=${{ parameters.excludeOmniSharpTests }} -e SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS=true"
poisonArg=''

if [[ '${{ parameters.excludeSdkContentTests }}' != 'True' ]]; then
dockerVolumeArgs+=" -v $(Pipeline.Workspace)/${{ parameters.installerBuildResourceId }}/BlobArtifacts/:/BlobArtifacts"
msftSdkTarballName=$(find "$(Pipeline.Workspace)/${{ parameters.installerBuildResourceId }}/BlobArtifacts/" -name "dotnet-sdk-*-linux-${{ parameters.architecture }}.tar.gz" -exec basename {} \;)
dockerEnvArgs+=" -e SMOKE_TESTS_MSFT_SDK_TARBALL_PATH=/BlobArtifacts/$msftSdkTarballName"
fi

if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
poisonArg='--poison'
dockerEnvArgs+=" -e SMOKE_TESTS_WARN_POISON_DIFFS=true"
fi

docker run --rm $dockerVolumeArgs -w /vmr $dockerEnvArgs ${{ parameters.container }} ./build.sh $poisonArg --run-smoke-test $(additionalBuildArgs) -- -p:SmokeTestConsoleVerbosity=detailed
displayName: Run Tests

# Don't use CopyFiles@2 as it encounters permissions issues because it indexes all files in the source directory graph.
- script: |
set -x

targetFolder=$(Build.StagingDirectory)/BuildLogs/
mkdir -p ${targetFolder}

cd "${{ parameters.vmrPath }}"
find artifacts/ -type f -name "*.binlog" -exec cp {} --parents -t ${targetFolder} \;
find artifacts/ -type f -name "*.log" -exec cp {} --parents -t ${targetFolder} \;
find artifacts/prebuilt-report/ -exec cp {} --parents -t ${targetFolder} \;
find src/ -type f -name "*.binlog" -exec cp {} --parents -t ${targetFolder} \;
find src/ -type f -name "*.log" -exec cp {} --parents -t ${targetFolder} \;
find test/ -type f -name "*.binlog" -exec cp {} --parents -t ${targetFolder} \;
find test/ -type f -name "Updated*.diff" -exec cp {} --parents -t ${targetFolder} \;
find test/ -type f -name "Updated*.txt" -exec cp {} --parents -t ${targetFolder} \;
displayName: Prepare BuildLogs staging directory
continueOnError: true
condition: succeededOrFailed()

- publish: '$(Build.StagingDirectory)/BuildLogs'
artifact: $(Agent.JobName)_BuildLogs_Attempt$(System.JobAttempt)
displayName: Publish BuildLogs
continueOnError: true
condition: succeededOrFailed()

- task: PublishTestResults@2
displayName: Publish Test Results
condition: succeededOrFailed()
continueOnError: true
inputs:
testRunner: vSTest
testResultsFiles: 'test/**/*.trx'
searchFolder: ${{ parameters.vmrPath }}
mergeTestResults: true
publishRunAttachments: true
testRunTitle: SourceBuild_SmokeTests_$(Agent.JobName)

- publish: '${{ parameters.vmrPath }}/artifacts/${{ parameters.architecture }}/Release/'
artifact: $(Agent.JobName)_Artifacts
displayName: Publish Artifacts
condition: succeededOrFailed()
continueOnError: true
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
### This pipeline synchronizes code from product repositories into the VMR (https://github.com/dotnet/dotnet)
### This job synchronizes code from product repositories into the VMR (https://github.com/dotnet/dotnet)
### It synchronizes the content of the VMR to this new commit and pushes the changes

parameters:
- name: targetRef
displayName: Target revision in dotnet/installer to synchronize to
displayName: Target revision of dotnet/installer to synchronize
type: string
default: $(Build.SourceVersion)

Expand All @@ -16,59 +17,57 @@ parameters:
type: boolean
default: false

trigger:
branches:
include:
- main
- release/*
- internal/release/*

pr: none

resources:
repositories:
- repository: vmr
type: github
name: dotnet/dotnet
endpoint: dotnet

variables:
- template: /eng/common/templates/variables/pool-providers.yml
- template: templates/variables/vmr-variables.yml

jobs:
- job: Synchronize
- job: Synchronize_VMR
displayName: Synchronize dotnet/dotnet
timeoutInMinutes: 120
variables:
- template: /eng/common/templates/variables/pool-providers.yml
- name: vmrPath
value: $(Agent.BuildDirectory)/vmr
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNetBot-GitHub
- ${{ else }}:
- name: BotAccount-dotnet-bot-repo-PAT
value: N/A

pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals Build.Ubuntu.2004.Amd64.Open
${{ else }}:
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals Build.Ubuntu.2004.Amd64

steps:
- template: templates/steps/vmr-prepare.yml
- template: ../steps/vmr-prepare.yml
parameters:
vmrBranch: ${{ parameters.vmrBranch }}

- template: templates/steps/vmr-pull-updates.yml
- template: ../steps/vmr-pull-updates.yml
parameters:
vmrPath: $(vmrPath)
vmrBranch: ${{ parameters.vmrBranch }}
targetRef: ${{ parameters.targetRef }}
vmrToken: $(BotAccount-dotnet-bot-repo-PAT)

- ${{ if and(not(parameters.noPush), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal')) }}:
- script: |-
# For official builds, push the changes to the VMR
- ${{ if and(not(parameters.noPush), not(in(variables['Build.Reason'], 'PullRequest')), eq(variables['System.TeamProject'], 'internal')) }}:
- script: |
set -x
git config --global user.email 'dotnet-maestro[bot]@users.noreply.github.com' && git config --global user.name 'dotnet-maestro[bot]'
git remote add dotnet 'https://$(BotAccount-dotnet-bot-repo-PAT)@github.com/dotnet/dotnet.git'
git fetch dotnet
git branch ${{ parameters.vmrBranch }}
git branch --set-upstream-to=dotnet/${{ parameters.vmrBranch }} ${{ parameters.vmrBranch }} || echo 'Branch ${{ parameters.vmrBranch }} not found in remote'
git push dotnet ${{ parameters.vmrBranch }}

# Export the SHA as an artifact to be reused by the official VMR build
sha=`git rev-parse HEAD`
mkdir -p "$(Build.ArtifactStagingDirectory)/VmrRevision"
echo $sha > "$(Build.ArtifactStagingDirectory)/VmrRevision/VmrRevision.txt"
displayName: Push changes to dotnet/dotnet
workingDirectory: $(vmrPath)

- publish: $(Build.ArtifactStagingDirectory)/VmrRevision
artifact: VmrRevision
displayName: Publish new SHA
Loading