From cadaadf81644e5cc7db50b0e8f10233c09506cc0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 29 Sep 2022 06:24:53 +0200 Subject: [PATCH] Use generic lockResources in all pipelines --- ci-scripts/Jenkinsfile-gitlab | 23 ++++++++++--------- ci-scripts/Jenkinsfile-physim-deploy | 9 +++++--- ci-scripts/Jenkinsfile-poll-gNB-UE | 13 +++++++---- ci-scripts/Jenkinsfile-push-registry | 11 +++++---- ci-scripts/Jenkinsfile-tmp-full-ran | 18 ++++++--------- ci-scripts/Jenkinsfile-tmp-multi-enb | 15 ++++++------ ci-scripts/Jenkinsfile-tmp-multi-enb-benetel | 16 ++++++------- .../Jenkinsfile-tmp-multi-enb-benetel-long | 16 ++++++------- ci-scripts/Jenkinsfile-tmp-multi-enb-nsa | 18 +++++---------- ci-scripts/Jenkinsfile-tmp-ran | 17 +++++++------- ci-scripts/Jenkinsfile-tmp-ue | 12 ++++++---- 11 files changed, 82 insertions(+), 86 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index a5912f4609..4518af6cae 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -33,8 +33,9 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) { // Location of the executor node def nodeExecutor = params.nodeExecutor -// VM Lockable resources -def vmResource = params.vmLockableResource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Tags to shorten pipeline duration def doMandatoryTests = false @@ -138,7 +139,7 @@ pipeline { stage ("Start VM -- gnb-usrp") { steps { - lock (vmResource) { + lock (extra: lockResources) { timeout (time: 5, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } @@ -148,7 +149,7 @@ pipeline { stage ("Start VM -- nr-ue-usrp") { steps { - lock (vmResource) { + lock (extra: lockResources) { timeout (time: 5, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant nr-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } @@ -158,7 +159,7 @@ pipeline { stage ("Start VM -- enb-ethernet") { steps { - lock (vmResource) { + lock (extra: lockResources) { timeout (time: 7, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } @@ -168,7 +169,7 @@ pipeline { stage ("Start VM -- ue-ethernet") { steps { - lock (vmResource) { + lock (extra: lockResources) { timeout (time: 7, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } @@ -208,7 +209,7 @@ pipeline { stage ("Build UE-ethernet") { steps { // This is typically the last one to finish. - lock (vmResource) { + lock (extra: lockResources) { gitlabCommitStatus(name: "Build UE-ethernet") { timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" @@ -269,7 +270,7 @@ pipeline { expression {doMandatoryTests} } steps { - lock (vmResource) { + lock (extra: lockResources) { script { timeout (time: 30, unit: 'MINUTES') { try { @@ -289,7 +290,7 @@ pipeline { expression {doMandatoryTests} } steps { - lock (vmResource) { + lock (extra: lockResources) { script { timeout (time: 40, unit: 'MINUTES') { try { @@ -309,7 +310,7 @@ pipeline { expression {doMandatoryTests} } steps { - lock (vmResource) { + lock (extra: lockResources) { script { timeout (time: 40, unit: 'MINUTES') { try { @@ -329,7 +330,7 @@ pipeline { expression {doMandatoryTests} } steps { - lock (vmResource) { + lock (extra: lockResources) { sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } diff --git a/ci-scripts/Jenkinsfile-physim-deploy b/ci-scripts/Jenkinsfile-physim-deploy index eac572e6cd..b57b842f6e 100644 --- a/ci-scripts/Jenkinsfile-physim-deploy +++ b/ci-scripts/Jenkinsfile-physim-deploy @@ -32,7 +32,9 @@ def buildStageStatus = true def testStageName = params.pipelineTestStageName // Name of the resource -def ciEpcResource = params.epcResource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Global Parameters. Normally they should be populated when the master job // triggers the slave job with parameters @@ -56,7 +58,7 @@ pipeline { disableConcurrentBuilds() timestamps() ansiColor('xterm') - lock(ciEpcResource) + lock(lockResources) } stages { @@ -80,7 +82,8 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.smartphonesResource == null) { + if (params.LockResources == null) { + echo "no LockResources given" allParametersPresent = false } if (params.eNB_IPAddress == null) { diff --git a/ci-scripts/Jenkinsfile-poll-gNB-UE b/ci-scripts/Jenkinsfile-poll-gNB-UE index 88dff2b102..b85f7e26ce 100644 --- a/ci-scripts/Jenkinsfile-poll-gNB-UE +++ b/ci-scripts/Jenkinsfile-poll-gNB-UE @@ -36,8 +36,10 @@ def testXMLFile = params.pythonTestXmlFile def mainPythonAllXmlFiles = "" def buildStageStatus = true -// Name of the phone resource -def ciUSRPsResource = params.USRPsResource +// Name of the resource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Terminate Status def termUE = 0 @@ -73,7 +75,7 @@ pipeline { disableConcurrentBuilds() gitLabConnection('OAI GitLab') ansiColor('xterm') - lock (ciUSRPsResource) + lock(extra: lockResources) } stages { @@ -135,8 +137,9 @@ pipeline { testStageName = params.pipelineTestStageName } - if (params.USRPsResource == null) { - allParametersPresent = false + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false } if (params.eNB_IPAddress == null) { diff --git a/ci-scripts/Jenkinsfile-push-registry b/ci-scripts/Jenkinsfile-push-registry index feb1807c91..9442e9c78a 100644 --- a/ci-scripts/Jenkinsfile-push-registry +++ b/ci-scripts/Jenkinsfile-push-registry @@ -23,8 +23,10 @@ // Location of the python executor node shall be in the same subnet as the others servers def nodeExecutor = params.nodeExecutor -// Name of the phone resource -def ciServerResource = params.serverResource +// Name of the resource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Docker Hub account to push to def DH_Account = "oaisoftwarealliance" @@ -36,7 +38,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock (ciServerResource) + lock(extra: lockResources) } stages { stage ("Verify Parameters") { @@ -49,7 +51,8 @@ pipeline { if (params.nodeExecutor != null) { echo "Docker Push executor node : ${nodeExecutor}" } - if (params.serverResource == null) { + if (params.LockResources == null) { + echo "no LockResources given" allParametersPresent = false } } diff --git a/ci-scripts/Jenkinsfile-tmp-full-ran b/ci-scripts/Jenkinsfile-tmp-full-ran index c3323f792d..e4564d777e 100644 --- a/ci-scripts/Jenkinsfile-tmp-full-ran +++ b/ci-scripts/Jenkinsfile-tmp-full-ran @@ -33,11 +33,9 @@ def buildStageStatus = true // Name of the test stage def testStageName = params.pipelineTestStageName -// Name of the phone resource -def ciSmartPhoneResource = params.smartphonesResource - -// Name of the phone resource -def oaiUEResource = params.oaiUEResource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Terminate Status def termENB = 0 @@ -65,7 +63,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: oaiUEResource]], resource: ciSmartPhoneResource) + lock(extra: lockResources) } stages { @@ -85,11 +83,9 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.smartphonesResource == null) { - allParametersPresent = false - } - if (params.oaiUEResource == null) { - allParametersPresent = false + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false } if (params.eNB_IPAddress == null) { allParametersPresent = false diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb b/ci-scripts/Jenkinsfile-tmp-multi-enb index fb52316920..e0c756befb 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb @@ -33,11 +33,9 @@ def buildStageStatus = true // Name of the test stage def testStageName = params.pipelineTestStageName -// Name of the phone resource -def ciSmartPhoneResource = params.smartphonesResource - -// Name of the phone resource -def ciEpcResource = params.epcResource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Global Parameters. Normally they should be populated when the master job // triggers the slave job with parameters @@ -54,7 +52,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: ciEpcResource]], resource: ciSmartPhoneResource) + lock(extra: lockResources) } stages { stage ("Verify Parameters") { @@ -73,8 +71,9 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.smartphonesResource == null) { - allParametersPresent = false + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false } // 1st eNB parameters if (params.eNB_IPAddress == null) { diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel index 195456da11..2f56b0b691 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel @@ -33,9 +33,9 @@ def buildStageStatus = true // Name of the test stage def testStageName = params.pipelineTestStageName -// Name of the phone resource -def ciSmartPhonesResource1 = params.SmartPhonesResource1 -def ciSmartPhonesResource2 = params.SmartPhonesResource2 +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Global Parameters. Normally they should be populated when the master job // triggers the slave job with parameters @@ -52,7 +52,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) + lock(extra: lockResources) } stages { stage("Build Init") { @@ -78,11 +78,9 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.SmartPhonesResource1 == null) { - allParametersPresent = false - } - if (params.SmartPhonesResource2 == null) { - allParametersPresent = false + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false } // 1st eNB parameters if (params.eNB_IPAddress == null) { diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long index 3a002b3748..e1104ccf00 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long @@ -33,9 +33,9 @@ def buildStageStatus = true // Name of the test stage def testStageName = params.pipelineTestStageName -// Name of the phone resource -def ciSmartPhonesResource1 = params.SmartPhonesResource1 -def ciSmartPhonesResource2 = params.SmartPhonesResource2 +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Global Parameters. Populated when the master job // triggers the slave job with parameters @@ -53,7 +53,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) + lock(extra: lockResources) } stages { stage("Build Init") { @@ -89,11 +89,9 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.SmartPhonesResource1 == null) { - allParametersPresent = false - } - if (params.SmartPhonesResource2 == null) { - allParametersPresent = false + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false } // 1st eNB parameters if (params.eNB_IPAddress == null) { diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index 6e987a5e38..1d977f00d3 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -34,10 +34,9 @@ def buildStageStatus = true // Name of the test stage def testStageName = params.pipelineTestStageName -// Name of the phone/server resource -def ciSmartPhonesResource1 = params.SmartPhonesResource1 -def ciSmartPhonesResource2 = params.SmartPhonesResource2 -def ciSmartPhonesResource3 = params.SmartPhonesResource3 +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Global Parameters. Normally they should be populated when the master job // triggers the slave job with parameters @@ -56,7 +55,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: ciSmartPhonesResource2],[resource: ciSmartPhonesResource1]],resource: ciSmartPhonesResource3) + lock(extra: lockResources) } stages { stage("Build Init") { @@ -82,15 +81,10 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.SmartPhonesResource1 == null) { + if (params.LockResources == null) { + echo "no LockResources given" allParametersPresent = false } - if (params.SmartPhonesResource2 == null) { - allParametersPresent = false - } - if (params.SmartPhonesResource3 == null) { - allParametersPresent = false - } // 1st eNB parameters if (params.eNB_IPAddress == null) { allParametersPresent = false diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index a0d0f13871..271b9d042a 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -33,11 +33,9 @@ def buildStageStatus = true // Name of the test stage def testStageName = params.pipelineTestStageName -// Name of the phone resource -def ciSmartPhoneResource = params.smartphonesResource - -// Name of the phone resource -def ciEpcResource = params.epcResource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Terminate Status def termUE = 0 @@ -67,7 +65,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock(extra: [[resource: ciEpcResource]], resource: ciSmartPhoneResource) + lock(extra: lockResources) } // the following parameter options are commented out so it shows the ones // that you SHALL have to run the job. @@ -79,7 +77,7 @@ pipeline { string(name: 'pythonTestXmlFile', defaultValue: 'enb_usrpB210_band7_50PRB.xml', description: 'Location of the Test XML to be run') string(name: 'pipelineTestStageName', defaultValue: 'Test COTS-UE - OAI eNB - LTEBOX EPC', description: 'Naming of the Test Stage') booleanParam(name: 'pipelineZipsConsoleLog', defaultValue: 'True', description: 'If true, the pipeline script retrieves the job console log, zips it and archives it as artifact') - string(name: 'smartphonesResource', defaultValue: 'CI-Bench-1-Phones', description: 'Lockeable Resource to prevent multiple jobs to run simultaneously with the same resource') + string(name: 'lockResources', defaultValue: 'CI-Bench-1-Phones', description: 'Lockeable Resource to prevent multiple jobs to run simultaneously with the same resource') //eNB parameters string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB') @@ -115,8 +113,9 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.smartphonesResource == null) { - allParametersPresent = false + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false } if (params.eNB_IPAddress == null) { allParametersPresent = false diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index e5e456cf7f..5a1e28d9f9 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -33,8 +33,9 @@ def buildStageStatus = true // Name of the test stage def testStageName = params.pipelineTestStageName -// Name of the phone resource -def ciSmartPhoneResource = params.smartphonesResource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} // Terminate Status def termUE = 0 @@ -64,7 +65,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') - lock (ciSmartPhoneResource) + lock(extra: lockResources) } stages { stage ("Verify Parameters") { @@ -83,8 +84,9 @@ pipeline { testStageName = 'Template Test Stage' } - if (params.smartphonesResource == null) { - allParametersPresent = false + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false } if (params.UE_IPAddress == null) { allParametersPresent = false