corrects if logic

This commit is contained in:
Hyatt 2022-06-15 12:48:53 -05:00
parent a1b6f3d9f7
commit a0dcf040d9
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

View File

@ -6,7 +6,7 @@ def repositoryCreds = "harbor-repository-creds"
def workspace
def k8slensVersion
def jsNodeID
def skipBuild = true
def doBuild = false
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
@ -67,17 +67,23 @@ pipeline {
""",
returnStdout: true
).trim()
}
}
script {
if (k8slensVersion ==~ 'refs\\/tags\\/([5-9]|[0-9]{2,})\\.[0-9]+\\.[0-9]+$') {
if (k8slensVersion ==~ 'refs\\/tags\\/5\\.5\\.[0-9]+$') {
echo "Version (${k8slensVersion}) is valid, we will build it with node 14."
doBuild = true
jsNodeID = 'node-14'
} else if (k8slensVersion ==~ 'refs\\/tags\\/5\\.6\\.[0-9]+$') {
echo "Version (${k8slensVersion}) is valid, we will build it with node 16."
doBuild = true
jsNodeID = 'node-16'
}
} else {
echo "Version (${k8slensVersion}) is not valid, we will not build it."
skipBuild = false
}
} else {
echo "Version (${k8slensVersion}) is not valid, we will not build it."
}
}
}
@ -86,7 +92,7 @@ pipeline {
stage('Pull K8S Lens Source Code') {
when {
expression {
return skipBuild
return doBuild
}
}
steps {
@ -123,7 +129,7 @@ pipeline {
stage ('Build K8S Lens') {
when {
expression {
return skipBuild
return doBuild
}
}
steps {
@ -143,7 +149,7 @@ pipeline {
stage ('Push Artifacts') {
when {
expression {
return skipbuild
return doBuild
}
}
steps {