From 318551148eb32854ea4959e340eaba56f1f2de5f Mon Sep 17 00:00:00 2001 From: beierlm Date: Tue, 1 Feb 2022 16:46:40 -0500 Subject: [PATCH] Bug 1877: Artifactory times out Added a lockable resource semaphore around queries to artifactory to prevent overloading the server. Fixes Bug 1877 Change-Id: I17979e7fa5d2ed2405873e7dda588d7104741817 Signed-off-by: beierlm (cherry picked from commit f83c20ab3304291aca8224ebe2dd88b58b5dc1b4) --- jenkins/ci-pipelines/ci_stage_3.groovy | 47 ++++++++++++++------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 8b43992d..4141f8d4 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -212,28 +212,29 @@ node("${params.NODE}") { def upstreamComponent="" if ( params.UPSTREAM_JOB_NAME ) { println("Fetching upstream job artifact from ${params.UPSTREAM_JOB_NAME}") + lock('Artifactory') { + step ([$class: 'CopyArtifact', + projectName: "${params.UPSTREAM_JOB_NAME}", + selector: [$class: 'SpecificBuildSelector', + buildNumber: "${params.UPSTREAM_JOB_NUMBER}"] + ]) + + upstreamComponent = ci_helper.get_mdg_from_project( + ci_helper.get_env_value('build.env','GERRIT_PROJECT')) + def buildNumber = ci_helper.get_env_value('build.env','BUILD_NUMBER') + dir("$upstreamComponent") { + // the upstream job name contains suffix with the project. Need this stripped off + def project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0] + def packages = ci_helper.get_archive(params.ARTIFACTORY_SERVER, + upstreamComponent, + GERRIT_BRANCH, + "${project_without_branch} :: ${GERRIT_BRANCH}", + buildNumber) - step ([$class: 'CopyArtifact', - projectName: "${params.UPSTREAM_JOB_NAME}", - selector: [$class: 'SpecificBuildSelector', - buildNumber: "${params.UPSTREAM_JOB_NUMBER}"] - ]) - - upstreamComponent = ci_helper.get_mdg_from_project( - ci_helper.get_env_value('build.env','GERRIT_PROJECT')) - def buildNumber = ci_helper.get_env_value('build.env','BUILD_NUMBER') - dir("$upstreamComponent") { - // the upstream job name contains suffix with the project. Need this stripped off - def project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0] - def packages = ci_helper.get_archive(params.ARTIFACTORY_SERVER, - upstreamComponent, - GERRIT_BRANCH, - "${project_without_branch} :: ${GERRIT_BRANCH}", - buildNumber) - - packageList.addAll(packages) - println("Fetched pre-merge ${params.UPSTREAM_JOB_NAME}: ${packages}") - } + packageList.addAll(packages) + println("Fetched pre-merge ${params.UPSTREAM_JOB_NAME}: ${packages}") + } + } // lock artifactory } parallelSteps = [:] @@ -262,7 +263,9 @@ node("${params.NODE}") { } } } - parallel parallelSteps + lock('Artifactory') { + parallel parallelSteps + } /////////////////////////////////////////////////////////////////////////////////////// // Create Devops APT repository -- 2.25.1