generate jenkinsfile
dockers/debian/pipeline/head Build queued...
Details
dockers/debian/pipeline/head Build queued...
Details
This commit is contained in:
parent
caf07e253a
commit
a1264646e0
|
@ -13,8 +13,8 @@ RUN set -xe;\
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
FROM bootstrapped as toolbuilder
|
FROM bootstrapped as toolbuilder
|
||||||
ARG GOSU_VERSION
|
ENV GOSU_VERSION="1.12"
|
||||||
ARG DUMB_INIT_VERSION
|
ENV DUMB_INIT_VERSION="1.2.2"
|
||||||
RUN set -xe;\
|
RUN set -xe;\
|
||||||
apt-get update &&\
|
apt-get update &&\
|
||||||
apt-get install -y git golang &&\
|
apt-get install -y git golang &&\
|
||||||
|
@ -33,8 +33,8 @@ RUN set -xe;\
|
||||||
|
|
||||||
FROM bootstrapped
|
FROM bootstrapped
|
||||||
ARG DATE
|
ARG DATE
|
||||||
ARG GOSU_VERSION
|
ENV GOSU_VERSION="1.12"
|
||||||
ARG DUMB_INIT_VERSION
|
ENV DUMB_INIT_VERSION="1.2.2"
|
||||||
COPY --from=toolbuilder /build/build /usr/local/sbin/gosu
|
COPY --from=toolbuilder /build/build /usr/local/sbin/gosu
|
||||||
COPY --from=toolbuilder /dumb-init /usr/local/sbin/dumb-init
|
COPY --from=toolbuilder /dumb-init /usr/local/sbin/dumb-init
|
||||||
COPY apt-install /bin/apt-install
|
COPY apt-install /bin/apt-install
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
gosu_version = "1.12"
|
version = "10"
|
||||||
dumb_init_version = "1.2.2"
|
project = "debian"
|
||||||
|
repo = "zknt"
|
||||||
|
registry = "reg.zknt.org"
|
||||||
|
registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5"
|
||||||
timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC'))
|
timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC'))
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
|
@ -7,31 +10,45 @@ pipeline {
|
||||||
stages {
|
stages {
|
||||||
stage('Build image') {
|
stage('Build image') {
|
||||||
steps {
|
steps {
|
||||||
withDockerRegistry([ credentialsId: "6ff44976-23cd-4cc2-902c-de8c340e65e5", url: "https://reg.zknt.org" ]) {
|
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
|
||||||
script {
|
script {
|
||||||
def customImage = docker.build("reg.zknt.org/zknt/debian", "--pull --build-arg DATE=$timeStamp --build-arg GOSU_VERSION=$gosu_version --build-arg DUMB_INIT_VERSION=$dumb_init_version --no-cache .")
|
def customImage = docker.build(registry+'/'+repo+'/'+project, "--pull --build-arg VERSION=$version --build-arg DATE=$timeStamp .")
|
||||||
|
customImage.push(version)
|
||||||
customImage.push("buster")
|
customImage.push("buster")
|
||||||
customImage.push("stable")
|
customImage.push("stable")
|
||||||
customImage.push("10")
|
def io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
|
||||||
|
withDockerRegistry([ credentialsId: io_registry_credentials ]) {
|
||||||
|
def io_registry_image = repo + '/' + project + ':' + version
|
||||||
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image
|
||||||
|
sh "docker push " + io_registry_image
|
||||||
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image.split(/\:/)[0] + "buster"
|
||||||
|
sh "docker push " + io_registry_image.split(/\:/)[0] + "buster"
|
||||||
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image.split(/\:/)[0] + "stable"
|
||||||
|
sh "docker push " + io_registry_image.split(/\:/)[0] + "stable"
|
||||||
|
}
|
||||||
|
|
||||||
registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
|
def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a"
|
||||||
withDockerRegistry([ credentialsId: registry_credentials ]) {
|
withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) {
|
||||||
def official_image = 'zknt/debian:buster'
|
def quay_image = 'quay.io/' + repo + '/' + project + ':' + version
|
||||||
sh "docker image tag reg.zknt.org/zknt/debian:buster " + official_image
|
sh "docker push " + quay_image
|
||||||
sh "docker push " + official_image
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0] + "buster"
|
||||||
|
sh "docker push " + official_image.split(/\:/)[0] + "buster"
|
||||||
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0] + "stable"
|
||||||
|
sh "docker push " + official_image.split(/\:/)[0] + "stable"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
sh """docker rmi -f \$(docker images -q $registry/$repo/$project:$version)"""
|
sh """docker rmi -f \$(docker images -q $registry/$repo/$project:$version)"""
|
||||||
sh """for image in \$(grep FROM Dockerfile | cut -d ' ' -f 2); do docker rmi -f \$(docker images -q \${image}); done"""
|
sh """for image in \$(grep FROM Dockerfile | cut -d ' ' -f 2); do docker rmi -f \$(docker images -q \${image}); done"""
|
||||||
}
|
}
|
||||||
always {
|
always {
|
||||||
emailext body: 'build finished', subject: '[jenkins] docker debian: ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true
|
emailext body: 'build finished', subject: '[jenkins] docker '+project+'('+version+'): ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
options {
|
options {
|
||||||
|
@ -47,7 +64,7 @@ pipeline {
|
||||||
conditions: [
|
conditions: [
|
||||||
BuildResult(matchSuccess: true)
|
BuildResult(matchSuccess: true)
|
||||||
],
|
],
|
||||||
matchAtMost: 2,
|
matchAtMost: 4,
|
||||||
continueAfterMatch: false
|
continueAfterMatch: false
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -58,5 +75,4 @@ pipeline {
|
||||||
]
|
]
|
||||||
]))
|
]))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
version: 10
|
||||||
|
project: debian
|
||||||
|
additional_tags:
|
||||||
|
- buster
|
||||||
|
- stable
|
Loading…
Reference in New Issue