inital usage of common functions

This commit is contained in:
2022-01-06 10:48:44 -06:00
parent 5b3a49be63
commit 959d4cbd2b
2 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,40 @@
#!groovy
// Return random label for runner
def podLabel() {
return "jenkins-${UUID.randomUUID().toString()}"
}
// return kubernetes pod defination
def podYaml(def requiredContainers){
def dockerRepo = "registry.c.test-chamber-13.lan"
def output = """
---
apiVersion: v1
kind: Pod
metadata:
name: pipeline-worker
spec:
containers:
"""
if requiredContainers['kaniko'] == true {
output += """
- name: kaniko
imagePullPolicy: Always
image: ${dockerRepo}/library/kaniko:latest
tty: true
command:
- /busybox/sh
"""
}
if requiredContainer['alpine'] == true {
output += """
- name: alpine
imagePullPolicy: Always
image: ${dockerRepo}/library/alpine:latest
tty: true
"""
}
return output
}