Changes to declarative pipeline
This commit is contained in:
@ -3,7 +3,28 @@
|
|||||||
def repository = "registry.c.test-chamber-13.lan"
|
def repository = "registry.c.test-chamber-13.lan"
|
||||||
def repositoryCreds = "harbor-repository-creds"
|
def repositoryCreds = "harbor-repository-creds"
|
||||||
|
|
||||||
def dockerFile = """FROM ${repository}/dockerhub/library/alpine:latest
|
def workspace
|
||||||
|
def dockerFile
|
||||||
|
|
||||||
|
def label = "kubernetes-${UUID.randomUUID().toString()}"
|
||||||
|
def templateName = "pipeline-worker"
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
kubernetes {
|
||||||
|
yaml functions.podYaml(
|
||||||
|
repo: repository,
|
||||||
|
templateName: templateName,
|
||||||
|
kaniko: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage ('Initalize Jenkins') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
workspace = pwd()
|
||||||
|
dockerFile = """FROM ${repository}/dockerhub/library/alpine: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="icecast"
|
LABEL org.opencontainers.image.title="icecast"
|
||||||
@ -19,26 +40,29 @@ RUN apk add --no-cache icecast && \\
|
|||||||
USER icecast
|
USER icecast
|
||||||
CMD ["/bin/sh", "-c", "icecast -c \\"\${CONFIG_FILE}\\""]
|
CMD ["/bin/sh", "-c", "icecast -c \\"\${CONFIG_FILE}\\""]
|
||||||
"""
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def label = "kubernetes-${UUID.randomUUID().toString()}"
|
stage ('Build & Push') {
|
||||||
def templateName = "pipeline-worker"
|
steps {
|
||||||
podTemplate(
|
container ('kaniko') {
|
||||||
label: label,
|
script {
|
||||||
name: templateName,
|
declarativeFunctions.buildContainerMultipleDestinations(
|
||||||
yaml: functions.podYaml(
|
|
||||||
repo: repository,
|
|
||||||
templateName: templateName,
|
|
||||||
kaniko: true
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
node (label) {
|
|
||||||
def workspace = pwd()
|
|
||||||
|
|
||||||
functions.buildContainer(
|
|
||||||
repository: "registry.hub.docker.com",
|
|
||||||
imageDest: "registry.hub.docker.com/thespider/icecast:latest",
|
|
||||||
dockerFile: dockerFile,
|
dockerFile: dockerFile,
|
||||||
repoCreds: "dockerhub-repository-creds",
|
repositoryAccess: [
|
||||||
|
[
|
||||||
|
repository: "registry.hub.docker.com",
|
||||||
|
credentials: "dockerhub-repository-creds"
|
||||||
|
],
|
||||||
|
],
|
||||||
|
destination: [
|
||||||
|
"registry.hub.docker.com/thespider/icecast:latest",
|
||||||
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user