Moves to declarative pipeline
This commit is contained in:
@ -3,16 +3,56 @@
|
|||||||
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 AlpineGlibcBaseURL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download"
|
def workspace
|
||||||
def AlpineGlibcPackageVersion = "2.34-r0"
|
def dockerFile
|
||||||
def AlpineGlibcBasePackageFilename = "glibc-${AlpineGlibcPackageVersion}.apk"
|
|
||||||
def AlpineGlibcBinPackageFilename = "glibc-bin-${AlpineGlibcPackageVersion}.apk"
|
def AlpineGlibcBaseURL="https://nexus.c.test-chamber-13.lan/repository/github-releases/sgerrand/alpine-pkg-glibc/releases/download"
|
||||||
def AlpineGlibcI18nPackageFilename = "glibc-i18n-${AlpineGlibcPackageVersion}.apk"
|
def AlpineGlibcPackageVersion
|
||||||
|
def AlpineGlibcBasePackageFilename
|
||||||
|
def AlpineGlibcBinPackageFilename
|
||||||
|
def AlpineGlibcI18nPackageFilename
|
||||||
|
|
||||||
def GlibcLanguage = "C.UTF-8"
|
def GlibcLanguage = "C.UTF-8"
|
||||||
def TimeZone = "America/Chicago"
|
def TimeZone = "America/Chicago"
|
||||||
|
|
||||||
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 {
|
||||||
|
workspace = pwd()
|
||||||
|
container ('alpine') {
|
||||||
|
script {
|
||||||
|
sh """
|
||||||
|
if [ ! -f "/usr/bin/curl" ] || [ ! -x "/usr/bin/curl" ]; then
|
||||||
|
apk add --no-cache curl
|
||||||
|
fi
|
||||||
|
if [ ! -f "/usr/bin/jq" ] || [ ! -x "/usr/bin/jq" ]; then
|
||||||
|
apk add --no-cache curl
|
||||||
|
fi
|
||||||
|
"""
|
||||||
|
|
||||||
|
AlpineGlibcPackageVersion = sh (
|
||||||
|
script: "curl --silent --location --fail \"https://api.github.com/repos/sgerrand/alpine-pkg-glibc/releases\" | jq -r .[0].name",
|
||||||
|
returnStdout: true
|
||||||
|
).trim()
|
||||||
|
AlpineGlibcBasePackageFilename = "glibc-${AlpineGlibcPackageVersion}.apk"
|
||||||
|
AlpineGlibcBinPackageFilename = "glibc-bin-${AlpineGlibcPackageVersion}.apk"
|
||||||
|
AlpineGlibcI18nPackageFilename = "glibc-i18n-${AlpineGlibcPackageVersion}.apk"
|
||||||
|
|
||||||
|
dockerFile = """
|
||||||
FROM registry.c.test-chamber-13.lan/library/alpine:latest
|
FROM registry.c.test-chamber-13.lan/library/alpine:latest
|
||||||
|
|
||||||
LABEL maintainer="The_Spider <spider@smoothnet.org>"
|
LABEL maintainer="The_Spider <spider@smoothnet.org>"
|
||||||
@ -51,30 +91,34 @@ RUN apk add --update --no-cache --virtual=.build-dependencies \\
|
|||||||
${AlpineGlibcBinPackageFilename} \\
|
${AlpineGlibcBinPackageFilename} \\
|
||||||
${AlpineGlibcI18nPackageFilename}
|
${AlpineGlibcI18nPackageFilename}
|
||||||
"""
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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,
|
||||||
)
|
credentials: repositoryCreds
|
||||||
) {
|
],
|
||||||
node (label) {
|
],
|
||||||
def workspace = pwd()
|
destination: [
|
||||||
|
"${repository}/library/alpine-glibc:latest",
|
||||||
functions.buildContainer(
|
],
|
||||||
repository: repository,
|
[
|
||||||
imageDest: "${repository}/library/alpine-glibc:latest",
|
"LANG=${GlibcLanguage}",
|
||||||
dockerFile: dockerFile,
|
"TZ=${TimeZone}"
|
||||||
repoCreds: repositoryCreds,
|
]
|
||||||
[
|
)
|
||||||
"LANG=${GlibcLanguage}",
|
}
|
||||||
"TZ=${TimeZone}"
|
}
|
||||||
]
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user