inital usage of common functions
This commit is contained in:
40
functions/PodTemplates.groovy
Normal file
40
functions/PodTemplates.groovy
Normal 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
|
||||
}
|
Reference in New Issue
Block a user