diff --git a/build-alpine.jenkins b/build-alpine.jenkins index 1b757b4..7a4627c 100644 --- a/build-alpine.jenkins +++ b/build-alpine.jenkins @@ -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 " @@ -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 + ) + } } -} \ No newline at end of file + + 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", + ] + ) + } + } + } + } + } +}