podyaml now allows custom pod definations

This commit is contained in:
Hyatt 2022-01-27 11:41:02 -06:00
parent eb06251e85
commit 47cf7ca86d

View File

@ -1,6 +1,6 @@
#!groovy
def podYaml (Map config) {
def podYaml (Map config, List customImages = [[:]]) {
def output = """
---
apiVersion: v1
@ -8,8 +8,7 @@ kind: Pod
metadata:
name: ${config.templateName}
spec:
containers:
"""
containers:"""
if (config.kaniko == true) {
output += """
- name: kaniko
@ -17,24 +16,35 @@ spec:
image: ${config.repo}/library/kaniko:latest
tty: true
command:
- /busybox/sh
"""
- /busybox/sh"""
}
if (config.alpine == true) {
output += """
- name: alpine
imagePullPolicy: Always
image: ${config.repo}/library/alpine:latest
tty: true
"""
tty: true"""
}
if (config.fedora == true) {
output += """
- name: fedora
imagePullPolicy: Always
image: ${config.repo}/dockerhub/library/fedora:latest
tty: true
"""
tty: true"""
}
for (image in customImages) {
if (image.name && image.name != "" && image.path && image.path != "") {
output += """
- name: ${image.name}
imagePullPolicy: Always
image: ${image.path}
tty: true"""
if (image.command && image.command != "") {
output += """
command:
- ${image.command}"""
}
}
}
return output
}