|
| 1 | +parameters: |
| 2 | +# Stages that build individual verticals |
| 3 | +- name: verticalsStages |
| 4 | + type: stageList |
| 5 | +# Stages that need to run after the final artifacts are determined after joining all verticals. |
| 6 | +- name: postJoinStages |
| 7 | + type: stageList |
| 8 | + default: [] |
| 9 | +# When we should run the final join stage and the stages that depend on it. |
| 10 | +- name: finalJoinCondition |
| 11 | + type: boolean |
| 12 | + |
| 13 | +#### sdk parameters #### |
| 14 | +- name: isBuiltFromVmr |
| 15 | + displayName: True when build is running from dotnet/dotnet directly |
| 16 | + type: boolean |
| 17 | + |
| 18 | +- name: vmrBranch |
| 19 | + displayName: dotnet/dotnet branch to use |
| 20 | + type: string |
| 21 | + |
| 22 | +# These are not expected to be passed it but rather just object variables reused below |
| 23 | +- name: pool_Linux |
| 24 | + type: object |
| 25 | + default: |
| 26 | + name: $(defaultPoolName) |
| 27 | + image: $(poolImage_Linux) |
| 28 | + demands: ImageOverride -equals $(poolImage_Linux) |
| 29 | + os: linux |
| 30 | + |
| 31 | +- name: pool_Windows |
| 32 | + type: object |
| 33 | + default: |
| 34 | + name: $(defaultPoolName) |
| 35 | + image: $(poolImage_Windows) |
| 36 | + demands: ImageOverride -equals $(poolImage_Windows) |
| 37 | + os: windows |
| 38 | + |
| 39 | +- name: pool_LinuxArm64 |
| 40 | + type: object |
| 41 | + default: |
| 42 | + name: $(poolName_LinuxArm64) |
| 43 | + image: $(poolImage_LinuxArm64) |
| 44 | + demands: ImageOverride -equals $(poolImage_LinuxArm64) |
| 45 | + hostArchitecture: Arm64 |
| 46 | + os: linux |
| 47 | + |
| 48 | +- name: pool_Mac |
| 49 | + type: object |
| 50 | + default: |
| 51 | + name: Azure Pipelines |
| 52 | + vmImage: $(poolImage_Mac) |
| 53 | + os: macOS |
| 54 | + |
| 55 | + |
| 56 | +- name: pool_Linux_Shortstack |
| 57 | + type: object |
| 58 | + default: |
| 59 | + name: $(shortStackPoolName) |
| 60 | + image: $(poolImage_Linux) |
| 61 | + demands: ImageOverride -equals $(poolImage_Linux) |
| 62 | + os: linux |
| 63 | + |
| 64 | +stages: |
| 65 | +# Insert all stages that build verticals |
| 66 | +# and publish artifacts for each vertical |
| 67 | +- ${{ each stage in parameters.verticalsStages }}: |
| 68 | + - ${{ insert }}: ${{ stage }} |
| 69 | +- ${{ if parameters.finalJoinCondition }}: |
| 70 | + # This stage should contain all jobs that take inputs from all verticals and determine the exact final outputs. |
| 71 | + - stage: VMR_Final_Join |
| 72 | + displayName: 'VMR Final Join' |
| 73 | + dependsOn: |
| 74 | + - ${{ each stage in parameters.verticalsStages }}: |
| 75 | + - ${{ if ne(stage.templateContext.validationOnly, 'true') }}: |
| 76 | + - ${{ stage.stage }} |
| 77 | + variables: |
| 78 | + - ${{ if parameters.isBuiltFromVmr }}: |
| 79 | + - name: vmrPath |
| 80 | + value: $(Build.SourcesDirectory) |
| 81 | + - ${{ else }}: |
| 82 | + - name: vmrPath |
| 83 | + value: $(Agent.BuildDirectory)/vmr |
| 84 | + - template: ../variables/vmr-build.yml |
| 85 | + parameters: |
| 86 | + vmrBranch: ${{ parameters.vmrBranch }} |
| 87 | + jobs: |
| 88 | + - job: FinalJoin |
| 89 | + displayName: Final Build Pass |
| 90 | + pool: ${{ parameters.pool_Windows }} |
| 91 | + timeoutInMinutes: 240 |
| 92 | + templateContext: |
| 93 | + outputParentDirectory: $(Build.ArtifactStagingDirectory)/artifacts |
| 94 | + inputs: |
| 95 | + # Download the artifacts from every job in every vertical stage under VerticalArtifacts |
| 96 | + - ${{ each stage in parameters.verticalsStages }}: |
| 97 | + - ${{ if ne(stage.templateContext.validationOnly, 'true') }}: |
| 98 | + - ${{ each vertical in stage.jobs }}: |
| 99 | + - input: pipelineArtifact |
| 100 | + path: $(Build.ArtifactStagingDirectory)/VerticalArtifacts/${{ vertical.job }} |
| 101 | + artifactName: ${{ vertical.job }}_Artifacts |
| 102 | + - input: pipelineArtifact |
| 103 | + path: $(Build.ArtifactStagingDirectory)/VerticalManifests |
| 104 | + artifactName: VerticalManifests |
| 105 | + outputs: |
| 106 | + - output: pipelineArtifact |
| 107 | + path: $(Build.ArtifactStagingDirectory)/artifacts/MergedManifest.xml |
| 108 | + artifact: AssetManifests |
| 109 | + displayName: Publish Merged Manifest |
| 110 | + sbomEnabled: false |
| 111 | + - output: buildArtifacts |
| 112 | + PathtoPublish: $(Build.ArtifactStagingDirectory)/artifacts/assets |
| 113 | + ArtifactName: BlobArtifacts |
| 114 | + displayName: Publish Blob Artifacts |
| 115 | + sbomEnabled: false |
| 116 | + - output: buildArtifacts |
| 117 | + PathtoPublish: $(Build.ArtifactStagingDirectory)/artifacts/packages |
| 118 | + ArtifactName: PackageArtifacts |
| 119 | + displayName: Publish Package Artifacts |
| 120 | + sbomEnabled: false |
| 121 | + - output: pipelineArtifact |
| 122 | + path: $(Build.ArtifactStagingDirectory)/artifacts/log |
| 123 | + artifact: JoinVerticals_BuildLogs_Attempt$(System.JobAttempt) |
| 124 | + displayName: Publish Build Logs |
| 125 | + sbomEnabled: false |
| 126 | + condition: succeededOrFailed() |
| 127 | + steps: |
| 128 | + - ${{ if ne(variables['System.TeamProject'], 'internal') }}: |
| 129 | + - task: DownloadPipelineArtifact@2 |
| 130 | + displayName: Download asset manifests |
| 131 | + inputs: |
| 132 | + path: $(Build.ArtifactStagingDirectory)/VerticalManifests |
| 133 | + artifactName: VerticalManifests |
| 134 | + # Download the artifacts from every job in every vertical stage under VerticalArtifacts |
| 135 | + - ${{ each stage in parameters.verticalsStages }}: |
| 136 | + - ${{ if ne(stage.templateContext.validationOnly, 'true') }}: |
| 137 | + - ${{ each vertical in stage.jobs }}: |
| 138 | + - task: DownloadPipelineArtifact@2 |
| 139 | + displayName: Download Artifacts for ${{ vertical.job }} |
| 140 | + inputs: |
| 141 | + path: $(Build.ArtifactStagingDirectory)/VerticalArtifacts/${{ vertical.job }} |
| 142 | + artifactName: ${{ vertical.job }}_Artifacts |
| 143 | + - ${{ if not(parameters.isBuiltFromVmr) }}: |
| 144 | + - template: ../steps/vmr-prepare.yml@self |
| 145 | + parameters: |
| 146 | + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: |
| 147 | + vmrBranch: $(System.PullRequest.TargetBranch) |
| 148 | + ${{ else }}: |
| 149 | + vmrBranch: ${{ variables.VmrBranch }} |
| 150 | + |
| 151 | + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: |
| 152 | + - template: ../steps/vmr-pull-updates.yml@self |
| 153 | + parameters: |
| 154 | + vmrPath: ${{ variables.vmrPath }} |
| 155 | + vmrBranch: ${{ variables.VmrBranch }} |
| 156 | + targetRef: $(Build.SourceVersion) # Synchronize the current sdk commit |
| 157 | + - template: ../steps/vmr-join-verticals.yml |
| 158 | + parameters: |
| 159 | + dotNetBuildPass: final |
| 160 | + vmrPath: $(vmrPath) |
| 161 | + outputFolder: $(Build.ArtifactStagingDirectory)/artifacts |
| 162 | + # Insert all of the post-join stages. |
| 163 | + - ${{ each postJoinStage in parameters.postJoinStages }}: |
| 164 | + - stage: ${{ postJoinStage.stage }} |
| 165 | + ${{ each pair in postJoinStage }}: |
| 166 | + ${{ if notIn(pair.key, 'dependsOn', 'stage') }}: |
| 167 | + ${{ pair.key }}: ${{ pair.value }} |
| 168 | + dependsOn: |
| 169 | + # Inject a dependency on the final join stage |
| 170 | + - VMR_Final_Join |
| 171 | + # add any dependencies provided via root yaml |
| 172 | + - ${{ if ne(postJoinStage.dependsOn, '') }}: |
| 173 | + - ${{ each dependency in postJoinStage.dependsOn }}: |
| 174 | + - ${{ dependency }} |
0 commit comments