This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
build-containers/vars/podTemplates.groovy
2022-01-06 11:56:38 -06:00

41 lines
770 B
Groovy

#!groovy
// Return random label for runner
def podLabel() {
return "jenkins-${UUID.randomUUID().toString()}"
}
// return kubernetes pod defination
def podYaml(Map 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 (requiredContainers.alpine == true) {
output += """
- name: alpine
imagePullPolicy: Always
image: ${dockerRepo}/library/alpine:latest
tty: true
"""
}
return output
}