CBL-Mariner/.pipelines/prchecks/PackageBuildPRCheck.yml

187 строки
8.9 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# The "agentPool" parameter is defined in the "Agent pools (DEV)" variable group.
# The "rawToolchain*" parameters are defined in the "Raw toolchain info" variable group.
trigger: none
parameters:
- name: buildConfiguration
type: object
default:
- name: "AMD64"
agentPool: "$(DEV_AMD64_Managed)"
maxCPUs: "$(($(nproc) / 2))"
rawToolchainCacheURL: "$(rawToolchainCacheURL_AMD64_3.0)"
rawToolchainExpectedHash: "$(rawToolchainCacheHash_AMD64_3.0)"
- name: "ARM64"
agentPool: "$(DEV_ARM64_Managed)"
maxCPUs: "$(($(nproc) / 3))"
rawToolchainCacheURL: "$(rawToolchainCacheURL_ARM64_3.0)"
rawToolchainExpectedHash: "$(rawToolchainCacheHash_ARM64_3.0)"
- name: debug
type: boolean
default: false
displayName: "Run in debug mode"
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
variables:
- group: "Agent pools (DEV)"
- group: "Raw toolchain info"
- name: rpmsArtifactNameBase
value: RPMs
- name: toolchainArtifactNameBase
value: Toolchain
- name: toolchainTestsArtifactNameBase
value: Toolchain_tests
- name: system.debug
value: "${{ parameters.debug }}"
extends:
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates
parameters:
globalSdl:
credscan:
suppressionsFile: .config/CredScanSuppressions.json
stages:
- ${{ each configuration in parameters.buildConfiguration }}:
- stage: Toolchain_${{ configuration.name }}
jobs:
- job: Build
pool:
type: linux
isCustom: true
name: ${{ configuration.agentPool }}
variables:
ob_artifactBaseName: $(toolchainArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
steps:
- template: .pipelines/templates/RawToolchainDownload.yml@self
parameters:
rawToolchainCacheURL: ${{ configuration.rawToolchainCacheURL }}
rawToolchainExpectedHash: ${{ configuration.rawToolchainExpectedHash }}
- template: .pipelines/templates/ToolchainBuild.yml@self
parameters:
outputArtifactsFolder: $(ob_outputDirectory)
selfRepoName: self
# Toolchain package tests should be run through the full package build, calculate the list of packages that should be re-tested
# and make it available to the next stage via an output variable: 'CalculateToolchainPackageRetestList.toolchainPackageRetestList'
- template: .pipelines/templates/ToolchainCalculatePackageRetests.yml@self
parameters:
# GCC fails to build as a regular package.
ignoredSpecs: ["gcc"]
- script: echo "##vso[task.setvariable variable=toolchainArtifactName;isOutput=true]$(ob_artifactBaseName)"
name: "ToolchainArtifactName"
displayName: "Set variable for published artifact name"
# 1. Automatic publishing won't work if 'isCustom: true' is set on the pool. We cannot do 'isCustom: false' because
# then OneBranch attempts to perform additional actions (adding build tags for instance), which require additional permissions
# that the PR check pipeline does not have.
# 2. The value for 'artifact' must equal $(ob_artifactBaseName), as this is the only value OneBranch accepts.
- task: PublishPipelineArtifact@1
inputs:
artifact: $(toolchainArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
targetPath: $(ob_outputDirectory)
condition: always()
displayName: "Publish toolchain artifacts"
- stage: RPMs_${{ configuration.name }}
dependsOn: Toolchain_${{ configuration.name }}
jobs:
- job: BuildAndTest
pool:
type: linux
isCustom: true
name: ${{ configuration.agentPool }}
variables:
ob_artifactBaseName: $(rpmsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
toolchainArtifactName: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['ToolchainArtifactName.toolchainArtifactName'] ]
steps:
- template: .pipelines/templates/PackageBuild.yml@self
parameters:
checkBuildRetries: "1"
customToolchainArtifactName: $(toolchainArtifactName)
isCheckBuild: true
isQuickRebuildPackages: true
isUseCCache: true
maxCPU: "${{ configuration.maxCPUs }}"
outputArtifactsFolder: $(ob_outputDirectory)
pipArtifactFeeds: "mariner/Mariner-Pypi-Feed"
selfRepoName: self
testSuiteName: "[${{ configuration.name }}] Package test"
- script: echo "##vso[task.setvariable variable=rpmsArtifactName;isOutput=true]$(ob_artifactBaseName)"
name: "RPMsArtifactName"
displayName: "Set variable for published artifact name"
- task: PublishPipelineArtifact@1
inputs:
artifact: $(rpmsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
targetPath: $(ob_outputDirectory)
condition: always()
displayName: "Publish packages build artifacts"
- stage: Toolchain_tests_${{ configuration.name }}
dependsOn: Toolchain_${{ configuration.name }}
jobs:
- job: TestToolchainPackages
condition: stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList']
pool:
type: linux
isCustom: true
name: ${{ configuration.agentPool }}
variables:
ob_artifactBaseName: $(toolchainTestsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
testListFromToolchain: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['CalculateToolchainPackageRetestList.toolchainPackageRetestList'] ]
toolchainArtifactName: $[ stageDependencies.Toolchain_${{ configuration.name }}.Build.outputs['ToolchainArtifactName.toolchainArtifactName'] ]
steps:
- template: .pipelines/templates/PackageBuild.yml@self
parameters:
checkBuildRetries: "1"
customToolchainArtifactName: $(toolchainArtifactName)
isAllowToolchainRebuilds: true
isCheckBuild: true
isQuickRebuildPackages: true
isUseCCache: true
maxCPU: "${{ configuration.maxCPUs }}"
outputArtifactsFolder: $(ob_outputDirectory)
pipArtifactFeeds: "mariner/Mariner-Pypi-Feed"
selfRepoName: self
srpmPackList: "$(testListFromToolchain)"
testRerunList: "$(testListFromToolchain)"
testSuiteName: "[${{ configuration.name }}] Toolchain test"
- task: PublishPipelineArtifact@1
inputs:
artifact: $(toolchainTestsArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
targetPath: $(ob_outputDirectory)
condition: always()
displayName: "Publish toolchain build artifacts"
- stage: Sodiff_${{ configuration.name }}
dependsOn: RPMs_${{ configuration.name }}
jobs:
- job: Sodiff_Check
pool:
type: linux
isCustom: true
name: ${{ configuration.agentPool }}
variables:
rpmsArtifactName: $[ stageDependencies.RPMs_${{ configuration.name }}.BuildAndTest.outputs['RPMsArtifactName.rpmsArtifactName'] ]
steps:
- template: .pipelines/templatesWithCheckout/SodiffCheck.yml@self
parameters:
inputArtifactName: $(rpmsArtifactName)