Commit cadaadf8 authored by Robert Schmidt's avatar Robert Schmidt

Use generic lockResources in all pipelines

parent a1de5e3d
...@@ -33,8 +33,9 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) { ...@@ -33,8 +33,9 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
// Location of the executor node // Location of the executor node
def nodeExecutor = params.nodeExecutor def nodeExecutor = params.nodeExecutor
// VM Lockable resources def lockResources = []
def vmResource = params.vmLockableResource if (params.LockResources != null && params.LockResources.trim().length() > 0)
params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Tags to shorten pipeline duration // Tags to shorten pipeline duration
def doMandatoryTests = false def doMandatoryTests = false
...@@ -138,7 +139,7 @@ pipeline { ...@@ -138,7 +139,7 @@ pipeline {
stage ("Start VM -- gnb-usrp") { stage ("Start VM -- gnb-usrp") {
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
timeout (time: 5, unit: 'MINUTES') { 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" 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 { ...@@ -148,7 +149,7 @@ pipeline {
stage ("Start VM -- nr-ue-usrp") { stage ("Start VM -- nr-ue-usrp") {
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
timeout (time: 5, unit: 'MINUTES') { 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" 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 { ...@@ -158,7 +159,7 @@ pipeline {
stage ("Start VM -- enb-ethernet") { stage ("Start VM -- enb-ethernet") {
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
timeout (time: 7, unit: 'MINUTES') { 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" 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 { ...@@ -168,7 +169,7 @@ pipeline {
stage ("Start VM -- ue-ethernet") { stage ("Start VM -- ue-ethernet") {
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
timeout (time: 7, unit: 'MINUTES') { 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" 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 { ...@@ -208,7 +209,7 @@ pipeline {
stage ("Build UE-ethernet") { stage ("Build UE-ethernet") {
steps { steps {
// This is typically the last one to finish. // This is typically the last one to finish.
lock (vmResource) { lock (extra: lockResources) {
gitlabCommitStatus(name: "Build UE-ethernet") { gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 45, unit: 'MINUTES') { 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" 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 { ...@@ -269,7 +270,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
script { script {
timeout (time: 30, unit: 'MINUTES') { timeout (time: 30, unit: 'MINUTES') {
try { try {
...@@ -289,7 +290,7 @@ pipeline { ...@@ -289,7 +290,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
script { script {
timeout (time: 40, unit: 'MINUTES') { timeout (time: 40, unit: 'MINUTES') {
try { try {
...@@ -309,7 +310,7 @@ pipeline { ...@@ -309,7 +310,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
script { script {
timeout (time: 40, unit: 'MINUTES') { timeout (time: 40, unit: 'MINUTES') {
try { try {
...@@ -329,7 +330,7 @@ pipeline { ...@@ -329,7 +330,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (vmResource) { lock (extra: lockResources) {
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
......
...@@ -32,7 +32,9 @@ def buildStageStatus = true ...@@ -32,7 +32,9 @@ def buildStageStatus = true
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the resource // 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 // Global Parameters. Normally they should be populated when the master job
// triggers the slave job with parameters // triggers the slave job with parameters
...@@ -56,7 +58,7 @@ pipeline { ...@@ -56,7 +58,7 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
timestamps() timestamps()
ansiColor('xterm') ansiColor('xterm')
lock(ciEpcResource) lock(lockResources)
} }
stages { stages {
...@@ -80,7 +82,8 @@ pipeline { ...@@ -80,7 +82,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.smartphonesResource == null) { if (params.LockResources == null) {
echo "no LockResources given"
allParametersPresent = false allParametersPresent = false
} }
if (params.eNB_IPAddress == null) { if (params.eNB_IPAddress == null) {
......
...@@ -36,8 +36,10 @@ def testXMLFile = params.pythonTestXmlFile ...@@ -36,8 +36,10 @@ def testXMLFile = params.pythonTestXmlFile
def mainPythonAllXmlFiles = "" def mainPythonAllXmlFiles = ""
def buildStageStatus = true def buildStageStatus = true
// Name of the phone resource // Name of the resource
def ciUSRPsResource = params.USRPsResource def lockResources = []
if (params.LockResources != null && params.LockResources.trim().length() > 0)
params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Terminate Status // Terminate Status
def termUE = 0 def termUE = 0
...@@ -73,7 +75,7 @@ pipeline { ...@@ -73,7 +75,7 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
gitLabConnection('OAI GitLab') gitLabConnection('OAI GitLab')
ansiColor('xterm') ansiColor('xterm')
lock (ciUSRPsResource) lock(extra: lockResources)
} }
stages { stages {
...@@ -135,7 +137,8 @@ pipeline { ...@@ -135,7 +137,8 @@ pipeline {
testStageName = params.pipelineTestStageName testStageName = params.pipelineTestStageName
} }
if (params.USRPsResource == null) { if (params.LockResources == null) {
echo "no LockResources given"
allParametersPresent = false allParametersPresent = false
} }
......
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
// Location of the python executor node shall be in the same subnet as the others servers // Location of the python executor node shall be in the same subnet as the others servers
def nodeExecutor = params.nodeExecutor def nodeExecutor = params.nodeExecutor
// Name of the phone resource // Name of the resource
def ciServerResource = params.serverResource 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 // Docker Hub account to push to
def DH_Account = "oaisoftwarealliance" def DH_Account = "oaisoftwarealliance"
...@@ -36,7 +38,7 @@ pipeline { ...@@ -36,7 +38,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock (ciServerResource) lock(extra: lockResources)
} }
stages { stages {
stage ("Verify Parameters") { stage ("Verify Parameters") {
...@@ -49,7 +51,8 @@ pipeline { ...@@ -49,7 +51,8 @@ pipeline {
if (params.nodeExecutor != null) { if (params.nodeExecutor != null) {
echo "Docker Push executor node : ${nodeExecutor}" echo "Docker Push executor node : ${nodeExecutor}"
} }
if (params.serverResource == null) { if (params.LockResources == null) {
echo "no LockResources given"
allParametersPresent = false allParametersPresent = false
} }
} }
......
...@@ -33,11 +33,9 @@ def buildStageStatus = true ...@@ -33,11 +33,9 @@ def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone resource def lockResources = []
def ciSmartPhoneResource = params.smartphonesResource if (params.LockResources != null && params.LockResources.trim().length() > 0)
params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Name of the phone resource
def oaiUEResource = params.oaiUEResource
// Terminate Status // Terminate Status
def termENB = 0 def termENB = 0
...@@ -65,7 +63,7 @@ pipeline { ...@@ -65,7 +63,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock(extra: [[resource: oaiUEResource]], resource: ciSmartPhoneResource) lock(extra: lockResources)
} }
stages { stages {
...@@ -85,10 +83,8 @@ pipeline { ...@@ -85,10 +83,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.smartphonesResource == null) { if (params.LockResources == null) {
allParametersPresent = false echo "no LockResources given"
}
if (params.oaiUEResource == null) {
allParametersPresent = false allParametersPresent = false
} }
if (params.eNB_IPAddress == null) { if (params.eNB_IPAddress == null) {
......
...@@ -33,11 +33,9 @@ def buildStageStatus = true ...@@ -33,11 +33,9 @@ def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone resource def lockResources = []
def ciSmartPhoneResource = params.smartphonesResource if (params.LockResources != null && params.LockResources.trim().length() > 0)
params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Name of the phone resource
def ciEpcResource = params.epcResource
// Global Parameters. Normally they should be populated when the master job // Global Parameters. Normally they should be populated when the master job
// triggers the slave job with parameters // triggers the slave job with parameters
...@@ -54,7 +52,7 @@ pipeline { ...@@ -54,7 +52,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock(extra: [[resource: ciEpcResource]], resource: ciSmartPhoneResource) lock(extra: lockResources)
} }
stages { stages {
stage ("Verify Parameters") { stage ("Verify Parameters") {
...@@ -73,7 +71,8 @@ pipeline { ...@@ -73,7 +71,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.smartphonesResource == null) { if (params.LockResources == null) {
echo "no LockResources given"
allParametersPresent = false allParametersPresent = false
} }
// 1st eNB parameters // 1st eNB parameters
......
...@@ -33,9 +33,9 @@ def buildStageStatus = true ...@@ -33,9 +33,9 @@ def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone resource def lockResources = []
def ciSmartPhonesResource1 = params.SmartPhonesResource1 if (params.LockResources != null && params.LockResources.trim().length() > 0)
def ciSmartPhonesResource2 = params.SmartPhonesResource2 params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Global Parameters. Normally they should be populated when the master job // Global Parameters. Normally they should be populated when the master job
// triggers the slave job with parameters // triggers the slave job with parameters
...@@ -52,7 +52,7 @@ pipeline { ...@@ -52,7 +52,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) lock(extra: lockResources)
} }
stages { stages {
stage("Build Init") { stage("Build Init") {
...@@ -78,10 +78,8 @@ pipeline { ...@@ -78,10 +78,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.SmartPhonesResource1 == null) { if (params.LockResources == null) {
allParametersPresent = false echo "no LockResources given"
}
if (params.SmartPhonesResource2 == null) {
allParametersPresent = false allParametersPresent = false
} }
// 1st eNB parameters // 1st eNB parameters
......
...@@ -33,9 +33,9 @@ def buildStageStatus = true ...@@ -33,9 +33,9 @@ def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone resource def lockResources = []
def ciSmartPhonesResource1 = params.SmartPhonesResource1 if (params.LockResources != null && params.LockResources.trim().length() > 0)
def ciSmartPhonesResource2 = params.SmartPhonesResource2 params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Global Parameters. Populated when the master job // Global Parameters. Populated when the master job
// triggers the slave job with parameters // triggers the slave job with parameters
...@@ -53,7 +53,7 @@ pipeline { ...@@ -53,7 +53,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) lock(extra: lockResources)
} }
stages { stages {
stage("Build Init") { stage("Build Init") {
...@@ -89,10 +89,8 @@ pipeline { ...@@ -89,10 +89,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.SmartPhonesResource1 == null) { if (params.LockResources == null) {
allParametersPresent = false echo "no LockResources given"
}
if (params.SmartPhonesResource2 == null) {
allParametersPresent = false allParametersPresent = false
} }
// 1st eNB parameters // 1st eNB parameters
......
...@@ -34,10 +34,9 @@ def buildStageStatus = true ...@@ -34,10 +34,9 @@ def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone/server resource def lockResources = []
def ciSmartPhonesResource1 = params.SmartPhonesResource1 if (params.LockResources != null && params.LockResources.trim().length() > 0)
def ciSmartPhonesResource2 = params.SmartPhonesResource2 params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
def ciSmartPhonesResource3 = params.SmartPhonesResource3
// Global Parameters. Normally they should be populated when the master job // Global Parameters. Normally they should be populated when the master job
// triggers the slave job with parameters // triggers the slave job with parameters
...@@ -56,7 +55,7 @@ pipeline { ...@@ -56,7 +55,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock(extra: [[resource: ciSmartPhonesResource2],[resource: ciSmartPhonesResource1]],resource: ciSmartPhonesResource3) lock(extra: lockResources)
} }
stages { stages {
stage("Build Init") { stage("Build Init") {
...@@ -82,13 +81,8 @@ pipeline { ...@@ -82,13 +81,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.SmartPhonesResource1 == null) { if (params.LockResources == null) {
allParametersPresent = false echo "no LockResources given"
}
if (params.SmartPhonesResource2 == null) {
allParametersPresent = false
}
if (params.SmartPhonesResource3 == null) {
allParametersPresent = false allParametersPresent = false
} }
// 1st eNB parameters // 1st eNB parameters
......
...@@ -33,11 +33,9 @@ def buildStageStatus = true ...@@ -33,11 +33,9 @@ def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone resource def lockResources = []
def ciSmartPhoneResource = params.smartphonesResource if (params.LockResources != null && params.LockResources.trim().length() > 0)
params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Name of the phone resource
def ciEpcResource = params.epcResource
// Terminate Status // Terminate Status
def termUE = 0 def termUE = 0
...@@ -67,7 +65,7 @@ pipeline { ...@@ -67,7 +65,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock(extra: [[resource: ciEpcResource]], resource: ciSmartPhoneResource) lock(extra: lockResources)
} }
// the following parameter options are commented out so it shows the ones // the following parameter options are commented out so it shows the ones
// that you SHALL have to run the job. // that you SHALL have to run the job.
...@@ -79,7 +77,7 @@ pipeline { ...@@ -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: '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') 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') 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 //eNB parameters
string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB') string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB')
...@@ -115,7 +113,8 @@ pipeline { ...@@ -115,7 +113,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.smartphonesResource == null) { if (params.LockResources == null) {
echo "no LockResources given"
allParametersPresent = false allParametersPresent = false
} }
if (params.eNB_IPAddress == null) { if (params.eNB_IPAddress == null) {
......
...@@ -33,8 +33,9 @@ def buildStageStatus = true ...@@ -33,8 +33,9 @@ def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone resource def lockResources = []
def ciSmartPhoneResource = params.smartphonesResource if (params.LockResources != null && params.LockResources.trim().length() > 0)
params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]}
// Terminate Status // Terminate Status
def termUE = 0 def termUE = 0
...@@ -64,7 +65,7 @@ pipeline { ...@@ -64,7 +65,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
ansiColor('xterm') ansiColor('xterm')
lock (ciSmartPhoneResource) lock(extra: lockResources)
} }
stages { stages {
stage ("Verify Parameters") { stage ("Verify Parameters") {
...@@ -83,7 +84,8 @@ pipeline { ...@@ -83,7 +84,8 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.smartphonesResource == null) { if (params.LockResources == null) {
echo "no LockResources given"
allParametersPresent = false allParametersPresent = false
} }
if (params.UE_IPAddress == null) { if (params.UE_IPAddress == null) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment