playing around with stage/script tags

This commit is contained in:
Hyatt 2022-04-01 17:45:44 -05:00
parent 64bf567834
commit 8f86d83732
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

View File

@ -22,31 +22,26 @@ pipeline {
} }
stages { stages {
stage ('Initalize Jenkins') { steps {
steps { script {
script { stage ('Initalize Jenkins') {
workspace = pwd() workspace = pwd()
ubiOS = ["8"] ubiOS = ["8"]
ubiImages = ["ubi-minimal", "ubi"] ubiImages = ["ubi-minimal", "ubi"]
writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA()) writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA())
} }
}
}
stage ('Build Images') { for (rhOS in ubiOS) {
steps { for (image in ubiImages) {
script { stage ("Build ubi${rhOS}:${image}") {
for (rhOS in ubiOS) { def updateCmd
for (image in ubiImages) { if (image == "ubi-minimal") {
stage ("Build ubi${rhOS}:${image}") { updateCmd = "microdnf"
def updateCmd } else {
if (image == "ubi-minimal") { updateCmd = "dnf"
updateCmd = "microdnf" }
} else { dockerFile = """FROM registry.access.redhat.com/ubi${rhOS}/${image}:latest
updateCmd = "dnf"
}
dockerFile = """FROM registry.access.redhat.com/ubi${rhOS}/${image}:latest
LABEL org.opencontainers.image.authors="The_Spider <spider@smoothnet.org>" LABEL org.opencontainers.image.authors="The_Spider <spider@smoothnet.org>"
LABEL org.opencontainers.image.title="ubi${rhOS}/${image}" LABEL org.opencontainers.image.title="ubi${rhOS}/${image}"
@ -59,20 +54,19 @@ RUN update-ca-trust extract && \\
${updateCmd} update -y && \\ ${updateCmd} update -y && \\
${updateCmd} clean all ${updateCmd} clean all
""" """
container ("kaniko") { container ("kaniko") {
declarativeFunctions.buildContainerMultipleDestinations( declarativeFunctions.buildContainerMultipleDestinations(
dockerFile: dockerFile, dockerFile: dockerFile,
repositoryAccess: [ repositoryAccess: [
[ [
repository: repository, repository: repository,
credentials: repositoryCreds credentials: repositoryCreds
],
], ],
destination: [ ],
"${repository}/library/rhubi/${image}:${rhOS}", destination: [
] "${repository}/library/rhubi/${image}:${rhOS}",
) ]
} )
} }
} }
} }