diff --git a/build-k8s-lenz.jenkins b/build-k8s-lenz.jenkins index 89e0827..04ca56a 100644 --- a/build-k8s-lenz.jenkins +++ b/build-k8s-lenz.jenkins @@ -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() - 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." - jsNodeID = 'node-14' - } else if (k8slensVersion ==~ 'refs\\/tags\\/5\\.6\\.[0-9]+$') { - echo "Version (${k8slensVersion}) is valid, we will build it with node 16." - jsNodeID = 'node-16' - } + } + } + 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 {