Restore original lock in Jenkinsfile-gitlab

Inside a stage{}, the syntax differs and the lock() directive needs to
have a resource: (and not only extra:). Reverting earlier changes, as
this pipeline will soon be out of service anyway.
This commit is contained in:
Robert Schmidt
2022-10-10 13:42:00 +02:00
parent 5a9fe6d996
commit 8fbc15baba
+11 -12
View File
@@ -33,9 +33,8 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
// Location of the executor node // Location of the executor node
def nodeExecutor = params.nodeExecutor def nodeExecutor = params.nodeExecutor
def lockResources = [] // VM Lockable resources
if (params.LockResources != null && params.LockResources.trim().length() > 0) def vmResource = params.vmLockableResource
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
@@ -139,7 +138,7 @@ pipeline {
stage ("Start VM -- gnb-usrp") { stage ("Start VM -- gnb-usrp") {
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
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"
} }
@@ -149,7 +148,7 @@ pipeline {
stage ("Start VM -- nr-ue-usrp") { stage ("Start VM -- nr-ue-usrp") {
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
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"
} }
@@ -159,7 +158,7 @@ pipeline {
stage ("Start VM -- enb-ethernet") { stage ("Start VM -- enb-ethernet") {
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
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"
} }
@@ -169,7 +168,7 @@ pipeline {
stage ("Start VM -- ue-ethernet") { stage ("Start VM -- ue-ethernet") {
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
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"
} }
@@ -209,7 +208,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 (extra: lockResources) { lock (vmResource) {
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"
@@ -270,7 +269,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
script { script {
timeout (time: 30, unit: 'MINUTES') { timeout (time: 30, unit: 'MINUTES') {
try { try {
@@ -290,7 +289,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
script { script {
timeout (time: 40, unit: 'MINUTES') { timeout (time: 40, unit: 'MINUTES') {
try { try {
@@ -310,7 +309,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
script { script {
timeout (time: 40, unit: 'MINUTES') { timeout (time: 40, unit: 'MINUTES') {
try { try {
@@ -330,7 +329,7 @@ pipeline {
expression {doMandatoryTests} expression {doMandatoryTests}
} }
steps { steps {
lock (extra: lockResources) { lock (vmResource) {
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}"
} }
} }