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