build with different versions of node

This commit is contained in:
Hyatt 2022-06-15 12:14:27 -05:00
parent 0ee4b109be
commit 3d457b1d14
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

View File

@ -5,6 +5,7 @@ def repositoryCreds = "harbor-repository-creds"
def workspace def workspace
def k8slensVersion def k8slensVersion
def jsNodeID
def label = "kubernetes-${UUID.randomUUID().toString()}" def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker" def templateName = "pipeline-worker"
@ -17,9 +18,14 @@ pipeline {
alpine: true, alpine: true,
[ [
[ [
name: "node", name: "node-14",
path: "${repository}/dockerhub/library/node:14", path: "${repository}/dockerhub/library/node:14",
command: "/bin/sh" command: "/bin/sh"
],
[
name: "node-16",
path: "${repository}/dockerhub/library/node:16",
command: "/bin/sh"
] ]
] ]
) )
@ -97,9 +103,18 @@ pipeline {
} }
} }
if (k8slensVersion ==~ 'refs\/tags\/([5-9]|[0-9]{2,})\.[0-9]+\.[0-9]+$') {
if (k8slensVersion ==~ 'refs\/tags\/5\.5\.[0-9]+$') {
jsNodeID = 'node-14'
} else if (k8slensVersion ==~ 'refs\/tags\/5\.6\.[0-9]+$') {
jsNodeID = 'node-16'
} else {
jsNodeID = 'node-18'
}
stage ('Build K8S Lens') { stage ('Build K8S Lens') {
steps { steps {
container ('node') { container (jsNodeID) {
script { script {
sh """ sh """
apt-get update apt-get update
@ -134,3 +149,4 @@ pipeline {
} }
} }
} }
}