switches to declarative pipeline
This commit is contained in:
parent
d2d5c5d5ba
commit
30e9b8ae77
@ -3,7 +3,30 @@
|
|||||||
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/gitea/gitea:latest-rootless
|
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,
|
||||||
|
alpine: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage ('Initalize Jenkins') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
workspace = pwd()
|
||||||
|
writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA())
|
||||||
|
dockerFile = """FROM ${repository}/dockerhub/gitea/gitea:latest-rootless
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
@ -15,38 +38,47 @@ RUN apk add --no-cache --virtual=.packagecache ca-certificates && \\
|
|||||||
|
|
||||||
USER git
|
USER git
|
||||||
"""
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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(
|
dockerFile: dockerFile,
|
||||||
repo: repository,
|
repositoryAccess: [
|
||||||
templateName: templateName,
|
[
|
||||||
kaniko: true,
|
repository: repository,
|
||||||
alpine: true
|
credentials: repositoryCreds
|
||||||
)
|
],
|
||||||
) {
|
],
|
||||||
node (label) {
|
destination: [
|
||||||
def workspace = pwd()
|
"${repository}/library/gitea:latest-rootless",
|
||||||
|
],
|
||||||
stage ('Write cert to local file') {
|
[
|
||||||
writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA())
|
"LANG=${GlibcLanguage}",
|
||||||
|
"TZ=${TimeZone}"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
functions.buildContainer(
|
stage ('Delete Running Container') {
|
||||||
repository: repository,
|
steps {
|
||||||
imageDest: "${repository}/library/gitea:latest-rootless",
|
container ('alpine') {
|
||||||
dockerFile: dockerFile,
|
script {
|
||||||
repoCreds: repositoryCreds
|
declarativeFunctions.deletePod(
|
||||||
)
|
kubeAuth: "k8s-development-access",
|
||||||
|
kubeURL: "https://kubernetes.test-chamber-13.lan:6443",
|
||||||
functions.deletePod(
|
namespace: "development",
|
||||||
kubeAuth: "k8s-development-access",
|
selector: "app=gitea,app.kubernetes.io/name=gitea"
|
||||||
kubeURL: "https://kubernetes.test-chamber-13.lan:6443",
|
)
|
||||||
namespace: "development",
|
}
|
||||||
selector: "app=gitea,app.kubernetes.io/name=gitea"
|
}
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user