diff --git a/build-k8s-lenz.jenkins b/build-k8s-lenz.jenkins new file mode 100644 index 0000000..ab91d23 --- /dev/null +++ b/build-k8s-lenz.jenkins @@ -0,0 +1,106 @@ +#!groovy + +def repository = "registry.c.test-chamber-13.lan" +def repositoryCreds = "harbor-repository-creds" + +def workspace +//def k8slensVersion = "refs/tags/v5.5.1" + +def label = "kubernetes-${UUID.randomUUID().toString()}" +def templateName = "pipeline-worker" +pipeline { + agent { + kubernetes { + yaml functions.podYaml( + repo: repository, + templateName: templateName, + alpine: true, + [ + [ + name: "node", + path: "${repository}/dockerhub/library/node:14", + command: "/bin/sh" + ] + ] + ) + } + } + + stages { + stage ('Initalize Jenkins') { + steps { + script { + workspace = pwd() + } + } + } + + stage('Pull K8S Lens Source Code') { + steps { + script { + dir("lens") { + checkout ([ + $class: "GitSCM", + branches: [ + [ + name: k8slensVersion, + ], + ], + userRemoteConfigs: [ + [ + url: "https://github.com/lensapp/lens.git", + ], + ], + extensions: [ + [ + $class: "CloneOption", + shallow: true, + ], + [ + $class: "CheckoutOption", + timeout: 2, + ], + ], + ]) + } + } + } + } + + stage ('Build K8S Lens') { + steps { + container ('node') { + script { + sh """ + apt-get update + apt-get install -y rpm + cd lens + make build + """ + } + } + } + } + + stage ('Push Artifacts') { + steps { + container('alpine') { + script { + def appName = sh ( + script: """ + printf '%s\\n' "\$(basename "\$(find ./ -name "*.AppImage")")" + """, + returnStdout: true + ).trim() + functions.pushArtifact( + repoCreds: "nexus-generic-upload-bot", + fileName: appName, + filePath: workspace + "/lens/dist/", + fileURL: "https://nexus.c.test-chamber-13.lan/repository/generic/appimage/" + ) + } + } + } + } + } +}