Add Mariner cross-compile VMR builds (#17891)
Co-authored-by: Matt Mitchell <mmitche@microsoft.com>
This commit is contained in:
		
					parent
					
						
							
								42ace91ba7
							
						
					
				
			
			
				commit
				
					
						c01b62c0fc
					
				
			
		
					 3 changed files with 171 additions and 14 deletions
				
			
		| 
						 | 
					@ -61,6 +61,14 @@ parameters:
 | 
				
			||||||
  type: boolean
 | 
					  type: boolean
 | 
				
			||||||
  default: false
 | 
					  default: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: crossRootFS
 | 
				
			||||||
 | 
					  type: string
 | 
				
			||||||
 | 
					  default: ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: targetRid
 | 
				
			||||||
 | 
					  type: string
 | 
				
			||||||
 | 
					  default: ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
- job: ${{ parameters.buildName }}_${{ parameters.architecture }}
 | 
					- job: ${{ parameters.buildName }}_${{ parameters.architecture }}
 | 
				
			||||||
  timeoutInMinutes: 150
 | 
					  timeoutInMinutes: 150
 | 
				
			||||||
| 
						 | 
					@ -231,9 +239,24 @@ jobs:
 | 
				
			||||||
        customBuildArgs="$customBuildArgs --use-mono-runtime"
 | 
					        customBuildArgs="$customBuildArgs --use-mono-runtime"
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      docker run --rm -v "$(sourcesPath):/vmr" -w /vmr $customRunArgs ${{ parameters.container }} ./build.sh --clean-while-building $(additionalBuildArgs) $customBuildArgs
 | 
					      if [[ ! -z '${{ parameters.crossRootFs }}' || ! -z '${{ parameters.targetRid }}' ]]; then
 | 
				
			||||||
 | 
					        extraBuildProperties="--"
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if [[ ! -z '${{ parameters.crossRootFs }}' ]]; then
 | 
				
			||||||
 | 
					        customRunArgs="$customRunArgs -e CROSSCOMPILE=1 -e ROOTFS_DIR=${{ parameters.crossRootFs}}"
 | 
				
			||||||
 | 
					        extraBuildProperties="$extraBuildProperties /p:PortableBuild=true /p:DotNetBuildVertical=true"
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if [[ ! -z '${{ parameters.targetRid }}' ]]; then
 | 
				
			||||||
 | 
					        extraBuildProperties="$extraBuildProperties /p:OverrideTargetRid=${{ parameters.targetRid }}"
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      docker run --rm -v "$(sourcesPath):/vmr" -w /vmr $customRunArgs ${{ parameters.container }} ./build.sh --clean-while-building $(additionalBuildArgs) $customBuildArgs $extraBuildProperties
 | 
				
			||||||
    displayName: Build
 | 
					    displayName: Build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Don't run tests if overriding RID, we don't support that for now
 | 
				
			||||||
 | 
					  - ${{ if eq(parameters.targetRid, '') }}:
 | 
				
			||||||
    - script: |
 | 
					    - script: |
 | 
				
			||||||
        set -x
 | 
					        set -x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										107
									
								
								eng/pipelines/templates/stages/vmr-cross-build.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								eng/pipelines/templates/stages/vmr-cross-build.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,107 @@
 | 
				
			||||||
 | 
					### This stage source-builds https://github.com/dotnet/dotnet with varying 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:
 | 
				
			||||||
 | 
					  dependsOn: []
 | 
				
			||||||
 | 
					  condition: always()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Branch of the VMR to use (to push to for internal builds)
 | 
				
			||||||
 | 
					  vmrBranch: $(Build.SourceBranch)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # True when the build is a lite build
 | 
				
			||||||
 | 
					  isLiteBuild:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # True when build is running from dotnet/dotnet directly
 | 
				
			||||||
 | 
					  isBuiltFromVmr:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # The following parameters aren't expected to be passed in rather they are used for encapsulation
 | 
				
			||||||
 | 
					  # -----------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					  marinerX64CrossContainer: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64
 | 
				
			||||||
 | 
					  marinerArm64CrossContainer: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Internal builds
 | 
				
			||||||
 | 
					  poolInternalAmd64:
 | 
				
			||||||
 | 
					    name: NetCore1ESPool-Svc-Internal
 | 
				
			||||||
 | 
					    demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
 | 
				
			||||||
 | 
					  poolInternalAmd64PR:
 | 
				
			||||||
 | 
					    name: NetCore1ESPool-Internal-XL
 | 
				
			||||||
 | 
					    demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
 | 
				
			||||||
 | 
					  poolInternalArm64:
 | 
				
			||||||
 | 
					    name: Docker-Linux-Arm-Internal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Public builds / PRs
 | 
				
			||||||
 | 
					  poolPublicAmd64:
 | 
				
			||||||
 | 
					    name: NetCore-Public-XL
 | 
				
			||||||
 | 
					    demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stages:
 | 
				
			||||||
 | 
					- stage: VMR_PoC_Build
 | 
				
			||||||
 | 
					  displayName: VMR PoC-Build
 | 
				
			||||||
 | 
					  dependsOn: ${{ parameters.dependsOn }}
 | 
				
			||||||
 | 
					  condition: ${{ parameters.condition }}
 | 
				
			||||||
 | 
					  variables:
 | 
				
			||||||
 | 
					  - ${{ if eq(variables['System.TeamProject'], 'public') }}:
 | 
				
			||||||
 | 
					    - name: defaultPoolName
 | 
				
			||||||
 | 
					      value: ${{ parameters.poolPublicAmd64.name }}
 | 
				
			||||||
 | 
					    - name: defaultPoolDemands
 | 
				
			||||||
 | 
					      value: ${{ parameters.poolPublicAmd64.demands }}
 | 
				
			||||||
 | 
					  - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
 | 
				
			||||||
 | 
					    - ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
 | 
				
			||||||
 | 
					      - name: defaultPoolName
 | 
				
			||||||
 | 
					        value: ${{ parameters.poolInternalAmd64PR.name }}
 | 
				
			||||||
 | 
					      - name: defaultPoolDemands
 | 
				
			||||||
 | 
					        value: ${{ parameters.poolInternalAmd64PR.demands }}
 | 
				
			||||||
 | 
					    - ${{ else }}:
 | 
				
			||||||
 | 
					      - name: defaultPoolName
 | 
				
			||||||
 | 
					        value: ${{ parameters.poolInternalAmd64.name }}
 | 
				
			||||||
 | 
					      - name: defaultPoolDemands
 | 
				
			||||||
 | 
					        value: ${{ parameters.poolInternalAmd64.demands }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - ${{ if ne(parameters.vmrBranch, '') }}:
 | 
				
			||||||
 | 
					    - name: VmrBranch
 | 
				
			||||||
 | 
					      value: ${{ parameters.vmrBranch }}
 | 
				
			||||||
 | 
					  - ${{ else }}:
 | 
				
			||||||
 | 
					    - name: VmrBranch
 | 
				
			||||||
 | 
					      value: ${{ replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'refs/pull/', '') }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  jobs:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - template: ../jobs/vmr-build.yml
 | 
				
			||||||
 | 
					    parameters:
 | 
				
			||||||
 | 
					      # Changing the build name requires updating the referenced name in the source-build-sdk-diff-tests.yml pipeline
 | 
				
			||||||
 | 
					      buildName: MarinerCrossX64_Online_MsftSdk
 | 
				
			||||||
 | 
					      isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
 | 
				
			||||||
 | 
					      vmrBranch: ${{ variables.VmrBranch }}
 | 
				
			||||||
 | 
					      architecture: x64
 | 
				
			||||||
 | 
					      pool:
 | 
				
			||||||
 | 
					        name: ${{ variables.defaultPoolName }}
 | 
				
			||||||
 | 
					        demands: ${{ variables.defaultPoolDemands }}
 | 
				
			||||||
 | 
					      container: ${{ parameters.marinerx64CrossContainer }}
 | 
				
			||||||
 | 
					      buildFromArchive: false            # 🚫
 | 
				
			||||||
 | 
					      enablePoison: false                # 🚫
 | 
				
			||||||
 | 
					      excludeOmniSharpTests: true        # ✅
 | 
				
			||||||
 | 
					      runOnline: true                    # ✅
 | 
				
			||||||
 | 
					      useMonoRuntime: true               # ✅
 | 
				
			||||||
 | 
					      withPreviousSDK: false             # 🚫
 | 
				
			||||||
 | 
					      crossRootFs: '/crossrootfs/x64'    # 📝
 | 
				
			||||||
 | 
					      targetRid: 'linux-x64'             # 📝
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - template: ../jobs/vmr-build.yml
 | 
				
			||||||
 | 
					    parameters:
 | 
				
			||||||
 | 
					      # Changing the build name requires updating the referenced name in the source-build-sdk-diff-tests.yml pipeline
 | 
				
			||||||
 | 
					      buildName: MarinerCrossArm64_Online_MsftSdk
 | 
				
			||||||
 | 
					      isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
 | 
				
			||||||
 | 
					      vmrBranch: ${{ variables.VmrBranch }}
 | 
				
			||||||
 | 
					      architecture: x64
 | 
				
			||||||
 | 
					      pool:
 | 
				
			||||||
 | 
					        name: ${{ variables.defaultPoolName }}
 | 
				
			||||||
 | 
					        demands: ${{ variables.defaultPoolDemands }}
 | 
				
			||||||
 | 
					      container: ${{ parameters.marinerArm64CrossContainer }}
 | 
				
			||||||
 | 
					      buildFromArchive: false            # 🚫
 | 
				
			||||||
 | 
					      enablePoison: false                # 🚫
 | 
				
			||||||
 | 
					      excludeOmniSharpTests: true        # ✅
 | 
				
			||||||
 | 
					      runOnline: true                    # ✅
 | 
				
			||||||
 | 
					      useMonoRuntime: true               # ✅
 | 
				
			||||||
 | 
					      withPreviousSDK: false             # 🚫
 | 
				
			||||||
 | 
					      crossRootFs: '/crossrootfs/arm64'  # 📝
 | 
				
			||||||
 | 
					      targetRid: 'linux-arm64'           # 📝
 | 
				
			||||||
							
								
								
									
										27
									
								
								src/SourceBuild/content/eng/pipelines/ci-crossbuild.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/SourceBuild/content/eng/pipelines/ci-crossbuild.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,27 @@
 | 
				
			||||||
 | 
					# This is the dotnet/dotnet pipeline that is triggered every weekday at midnight PST (08:00 UTC) for "main" and when changes are pushed to release/* and internal/release/* branches.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					schedules:
 | 
				
			||||||
 | 
					- cron: '0 8 * * Mon-Fri'
 | 
				
			||||||
 | 
					  displayName: Weekday midnight build
 | 
				
			||||||
 | 
					  branches:
 | 
				
			||||||
 | 
					    include:
 | 
				
			||||||
 | 
					    - main
 | 
				
			||||||
 | 
					  batch: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					trigger:
 | 
				
			||||||
 | 
					  batch: true
 | 
				
			||||||
 | 
					  branches:
 | 
				
			||||||
 | 
					   include:
 | 
				
			||||||
 | 
					   - release/*
 | 
				
			||||||
 | 
					   - internal/release/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pr: none
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stages:
 | 
				
			||||||
 | 
					- ${{ if ne(variables['Build.Reason'], 'Schedule') }}:
 | 
				
			||||||
 | 
					  - template: templates/stages/vmr-scan.yml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- template: /src/installer/eng/pipelines/templates/stages/vmr-cross-build.yml
 | 
				
			||||||
 | 
					  parameters:
 | 
				
			||||||
 | 
					    isBuiltFromVmr: true
 | 
				
			||||||
 | 
					    isLiteBuild: false
 | 
				
			||||||
		Reference in a new issue