From f056ffd982fdd5605945a931bdeee836ce48bdf7 Mon Sep 17 00:00:00 2001 From: CBL-Mariner-Bot <75509084+CBL-Mariner-Bot@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:38:17 -0700 Subject: [PATCH] [AUTO-CHERRYPICK] Set ptest retries to 1 for PR package build check. - branch main (#10215) Co-authored-by: Pawel Winogrodzki --- .pipelines/prchecks/PackageBuildPRCheck.yml | 1 + .pipelines/templates/PackageBuild.yml | 17 +++++++++++++---- toolkit/Makefile | 4 ++-- toolkit/scripts/pkggen.mk | 4 ++-- .../scheduler/schedulerutils/buildworker.go | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.pipelines/prchecks/PackageBuildPRCheck.yml b/.pipelines/prchecks/PackageBuildPRCheck.yml index 4ddd05ce432..0bae7267320 100644 --- a/.pipelines/prchecks/PackageBuildPRCheck.yml +++ b/.pipelines/prchecks/PackageBuildPRCheck.yml @@ -107,6 +107,7 @@ extends: steps: - template: .pipelines/templates/PackageBuild.yml@self parameters: + checkBuildRetries: "1" customToolchainArtifactName: $(toolchainArtifactName) isCheckBuild: true isQuickRebuildPackages: true diff --git a/.pipelines/templates/PackageBuild.yml b/.pipelines/templates/PackageBuild.yml index 02964e0bc77..ca3038450a5 100644 --- a/.pipelines/templates/PackageBuild.yml +++ b/.pipelines/templates/PackageBuild.yml @@ -6,6 +6,10 @@ parameters: type: string default: "$(Build.SourcesDirectory)" + - name: checkBuildRetries + type: string + default: "" + - name: concurrentPackageBuilds type: number default: 12 @@ -22,10 +26,6 @@ parameters: type: string default: "" - - name: testRerunList - type: string - default: "" - - name: failOnTestFailures type: boolean default: true @@ -125,6 +125,10 @@ parameters: type: string default: "" + - name: testRerunList + type: string + default: "" + - name: testSuiteName type: string default: "Package test" @@ -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 @@ -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 \ diff --git a/toolkit/Makefile b/toolkit/Makefile index cd71b90273a..a0e9baba00e 100644 --- a/toolkit/Makefile +++ b/toolkit/Makefile @@ -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. diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 41beca8e905..15f71eca74b 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -285,8 +285,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" \ diff --git a/toolkit/tools/scheduler/schedulerutils/buildworker.go b/toolkit/tools/scheduler/schedulerutils/buildworker.go index 55591cbb886..d6a3ce5a21d 100644 --- a/toolkit/tools/scheduler/schedulerutils/buildworker.go +++ b/toolkit/tools/scheduler/schedulerutils/buildworker.go @@ -312,7 +312,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