moves to declarative pipeline

This commit is contained in:
Hyatt 2022-03-29 16:42:27 -05:00
parent 427774a7d1
commit d8ee5d9a20
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

View File

@ -12,6 +12,8 @@
def repository = "registry.c.test-chamber-13.lan"
def repositoryCreds = "harbor-repository-creds"
def workspace
def dockerFile = """FROM ${repository}/dockerhub/library/alpine:latest
LABEL maintainer="The_Spider <spider@smoothnet.org>"
@ -25,25 +27,46 @@ RUN apk add --no-cache --virtual=.packagecache ca-certificates && \\
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
podTemplate(
label: label,
name: templateName,
yaml: functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true
)
) {
node (label) {
def workspace = pwd()
writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA())
functions.buildContainer(
repository: repository,
imageDest: "${repository}/library/alpine:latest",
dockerFile: dockerFile,
repoCreds: repositoryCreds,
)
pipeline {
agent {
kubernetes {
yaml functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true
)
}
}
}
stages {
stage ('Initalize Jenkins') {
steps {
script {
workspace = pwd()
writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA())
}
}
}
stage ('Build & Push') {
steps {
container ('kaniko') {
script {
declarativeFunctions.buildContainerMultipleDestinations(
dockerFile: dockerFile,
repositoryAccess: [
[
repository: repository,
credentials: repositoryCreds
],
],
destination: [
"${repository}/library/alpine:latest",
]
)
}
}
}
}
}
}