Skip to content

Commit

Permalink
Enabled ccache and set ptest retries to 1 for PR checks (CP: #8503, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelWMS authored Sep 9, 2024
1 parent 115c5e3 commit f97819a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 16 deletions.
27 changes: 20 additions & 7 deletions .pipelines/prchecks/PackageBuildPRCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extends:
isCustom: true
name: ${{ configuration.agentPool }}
variables:
ob_artifactBaseName: $(toolchainArtifactNameBase)_${{ configuration.name }}
ob_artifactBaseName: $(toolchainArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
steps:
- template: .pipelines/templates/RawToolchainDownload.yml@self
Expand All @@ -75,13 +75,17 @@ extends:
# and make it available to the next stage via an output variable: 'CalculateToolchainPackageRetestList.toolchainPackageRetestList'
- template: .pipelines/templates/ToolchainCalculatePackageRetests.yml@self

- 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 }}
artifact: $(toolchainArtifactNameBase)_${{ configuration.name }}_$(System.JobAttempt)
targetPath: $(ob_outputDirectory)
condition: always()
displayName: "Publish toolchain artifacts"
Expand All @@ -95,25 +99,32 @@ extends:
isCustom: true
name: ${{ configuration.agentPool }}
variables:
ob_artifactBaseName: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}
ob_artifactBaseName: ${{ variables.rpmsArtifactNameBase }}_${{ 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:
customToolchainArtifactName: $(toolchainArtifactNameBase)_${{ configuration.name }}
checkBuildRetries: "1"
customToolchainArtifactName: $(toolchainArtifactName)
isCheckBuild: true
isQuickRebuildPackages: true
isUseCCache: true
outputArtifactsFolder: $(ob_outputDirectory)
maxCPU: "${{ configuration.maxCPUs }}"
pipArtifactFeeds: "mariner/Mariner-Pypi-Feed"
selfRepoName: self
testSuiteName: "[${{ configuration.name }}] Package test"
testRerunList: "$(testListFromToolchain)"
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: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}
artifact: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}_$(System.JobAttempt)
targetPath: $(ob_outputDirectory)
condition: always()
displayName: "Publish packages build artifacts"
Expand All @@ -126,7 +137,9 @@ extends:
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: ${{ variables.rpmsArtifactNameBase }}_${{ configuration.name }}
inputArtifactName: $(rpmsArtifactName)
17 changes: 13 additions & 4 deletions .pipelines/templates/PackageBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ parameters:
type: string
default: "$(Build.SourcesDirectory)"

- name: checkBuildRetries
type: string
default: ""

- name: concurrentPackageBuilds
type: number
default: 12
Expand All @@ -22,10 +26,6 @@ parameters:
type: string
default: ""

- name: testRerunList
type: string
default: ""

- name: failOnTestFailures
type: boolean
default: true
Expand Down Expand Up @@ -125,6 +125,10 @@ parameters:
type: string
default: ""

- name: testRerunList
type: string
default: ""

- name: testSuiteName
type: string
default: "Package test"
Expand Down Expand Up @@ -176,6 +180,10 @@ steps:
displayName: "Populate cache RPMs"
- script: |
if [[ -n "${{ parameters.checkBuildRetries }}" ]]; then
check_build_retries_arg="CHECK_BUILD_RETRIES=${{ parameters.checkBuildRetries }}"
fi
if [[ ${{ parameters.isDeltaBuild }} == "true" ]]; then
delta_fetch_arg="DELTA_FETCH=y"
elif [[ ${{ parameters.isDeltaBuild }} == "false" ]]; then
Expand Down Expand Up @@ -217,6 +225,7 @@ steps:
SPECS_DIR="${{ parameters.buildRepoRoot }}/${{ parameters.specsFolderPath }}" \
SRPM_PACK_LIST="${{ parameters.srpmPackList }}" \
TEST_RERUN_LIST="${{ parameters.testRerunList }}" \
$check_build_retries_arg \
$delta_fetch_arg \
$max_cascading_rebuilds_arg \
$quick_rebuild_packages_arg \
Expand Down
4 changes: 2 additions & 2 deletions toolkit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ PACKAGE_CACHE_SUMMARY ?=
IMAGE_CACHE_SUMMARY ?=
INITRD_CACHE_SUMMARY ?=
PACKAGE_ARCHIVE ?=
PACKAGE_BUILD_RETRIES ?= 1
CHECK_BUILD_RETRIES ?= 1
PACKAGE_BUILD_RETRIES ?= 0
CHECK_BUILD_RETRIES ?= 0
EXTRA_BUILD_LAYERS ?= 0
REFRESH_WORKER_CHROOT ?= y
# Set to 0 to use the number of logical CPUs.
Expand Down
4 changes: 2 additions & 2 deletions toolkit/scripts/pkggen.mk
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ $(STATUS_FLAGS_DIR)/build-rpms.flag: $(no_repo_acl) $(preprocessed_file) $(chroo
--distro-release-version="$(RELEASE_VERSION)" \
--distro-build-number="$(BUILD_NUMBER)" \
--rpmmacros-file="$(TOOLCHAIN_MANIFESTS_DIR)/macros.override" \
--build-attempts="$(PACKAGE_BUILD_RETRIES)" \
--check-attempts="$(CHECK_BUILD_RETRIES)" \
--build-attempts="$$(($(PACKAGE_BUILD_RETRIES)+1))" \
--check-attempts="$$(($(CHECK_BUILD_RETRIES)+1))" \
$(if $(MAX_CASCADING_REBUILDS),--max-cascading-rebuilds="$(MAX_CASCADING_REBUILDS)") \
--extra-layers="$(EXTRA_BUILD_LAYERS)" \
--build-agent="chroot-agent" \
Expand Down
2 changes: 1 addition & 1 deletion toolkit/tools/scheduler/schedulerutils/buildworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func testSRPMFile(agent buildagents.BuildAgent, checkAttempts int, basePackageNa
}, checkAttempts, retryDuration)

if checkFailed {
logger.Log.Debugf("Tests failed for '%s' after %d retries.", basePackageName, checkAttempts)
logger.Log.Debugf("Tests failed for '%s' after %d attempt(s).", basePackageName, checkAttempts)
err = nil
}
return
Expand Down

0 comments on commit f97819a

Please sign in to comment.