generate jenkinsfile
Some checks failed
dockers/debian/pipeline/head There was a failure building this commit

This commit is contained in:
chris 2020-10-29 00:35:30 +01:00
parent a1264646e0
commit 5a1c5e0b6d

20
Jenkinsfile vendored
View file

@ -21,20 +21,21 @@ pipeline {
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"
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"
}
def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a"
withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) {
def quay_image = 'quay.io/' + repo + '/' + project + ':' + version
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image
sh "docker push " + quay_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"
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image.split(/\:/)[0] + ":buster"
sh "docker push " + quay_image.split(/\:/)[0] + ":buster"
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image.split(/\:/)[0] + ":stable"
sh "docker push " + quay_image.split(/\:/)[0] + ":stable"
}
}
}
@ -44,8 +45,9 @@ pipeline {
post {
success {
sh """docker image prune -f"""
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 | grep -vi SCRATCH); do docker rmi -f \$(docker images -q \${image}); done"""
}
always {
emailext body: 'build finished', subject: '[jenkins] docker '+project+'('+version+'): ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true