generate jenkinsfile
dockers/alpine/pipeline/head There was a failure building this commit
Details
dockers/alpine/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
0d293e4fcf
commit
90f3292d9d
|
@ -1,46 +1,47 @@
|
||||||
|
version = "3.12.1"
|
||||||
project = "alpine"
|
project = "alpine"
|
||||||
repo = "zknt"
|
repo = "zknt"
|
||||||
version = "3.12.1"
|
|
||||||
registry = "reg.zknt.org"
|
registry = "reg.zknt.org"
|
||||||
registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5"
|
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 {
|
||||||
agent any
|
agent any
|
||||||
stages {
|
stages {
|
||||||
stage('Build image') {
|
stage('Build image') {
|
||||||
steps {
|
steps {
|
||||||
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
|
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
|
||||||
echo 'Starting to build docker image'
|
script {
|
||||||
script {
|
def customImage = docker.build(registry+'/'+repo+'/'+project, "--pull --build-arg VERSION=$version --build-arg DATE=$timeStamp .")
|
||||||
def customImage = docker.build(registry+'/'+repo+'/'+project, "--pull --build-arg VERSION=$version --build-arg DATE=$timeStamp .")
|
customImage.push(version)
|
||||||
customImage.push(version)
|
customImage.push("latest")
|
||||||
customImage.push(version.split(/\./)[0,1].join('.'))
|
customImage.push("3.12")
|
||||||
customImage.push(version.split(/\./)[0])
|
|
||||||
customImage.push("latest")
|
|
||||||
|
|
||||||
def io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
|
def io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
|
||||||
withDockerRegistry([ credentialsId: io_registry_credentials ]) {
|
withDockerRegistry([ credentialsId: io_registry_credentials ]) {
|
||||||
def official_image = repo+'/'+project+':'+version.split(/\./)[0,1].join('.')
|
def io_registry_image = repo + '/' + project + ':' + version
|
||||||
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image
|
||||||
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0]
|
sh "docker push " + io_registry_image
|
||||||
sh "docker push " + official_image
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image.split(/\:/)[0] + "latest"
|
||||||
sh "docker push " + official_image.split(/\:/)[0]
|
sh "docker push " + io_registry_image.split(/\:/)[0] + "latest"
|
||||||
}
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image.split(/\:/)[0] + "3.12"
|
||||||
|
sh "docker push " + io_registry_image.split(/\:/)[0] + "3.12"
|
||||||
|
}
|
||||||
|
|
||||||
def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a"
|
def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a"
|
||||||
withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) {
|
withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) {
|
||||||
def official_image = 'quay.io/'+repo+'/'+project+':'+version.split(/\./)[0,1].join('.')
|
def quay_image = 'quay.io/' + repo + '/' + project + ':' + version
|
||||||
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image
|
sh "docker push " + quay_image
|
||||||
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0]
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0] + "latest"
|
||||||
sh "docker push " + official_image
|
sh "docker push " + official_image.split(/\:/)[0] + "latest"
|
||||||
sh "docker push " + official_image.split(/\:/)[0]
|
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0] + "3.12"
|
||||||
|
sh "docker push " + official_image.split(/\:/)[0] + "3.12"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
|
@ -48,7 +49,7 @@ pipeline {
|
||||||
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 '+project+': ' + 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 {
|
||||||
|
@ -75,4 +76,4 @@ pipeline {
|
||||||
]
|
]
|
||||||
]))
|
]))
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
version: 3.12.1
|
||||||
|
project: alpine
|
||||||
|
additional_tags:
|
||||||
|
- latest
|
||||||
|
- 3.12
|
Loading…
Reference in New Issue