Bug 1877: Artifactory times out 26/11626/1
authorbeierlm <mark.beierl@canonical.com>
Tue, 1 Feb 2022 21:46:40 +0000 (16:46 -0500)
committerbeierlm <mark.beierl@canonical.com>
Thu, 3 Feb 2022 20:04:04 +0000 (21:04 +0100)
Added a lockable resource semaphore around queries to artifactory
to prevent overloading the server.

Fixes Bug 1877

Change-Id: I17979e7fa5d2ed2405873e7dda588d7104741817
Signed-off-by: beierlm <mark.beierl@canonical.com>
(cherry picked from commit f83c20ab3304291aca8224ebe2dd88b58b5dc1b4)

jenkins/ci-pipelines/ci_stage_3.groovy

index 8b43992..4141f8d 100644 (file)
@@ -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