alpine/Jenkinsfile
chris ec22356fea
All checks were successful
dockers/alpine/pipeline/head This commit looks good
var fix
2020-08-26 15:11:41 +02:00

50 lines
2.2 KiB
Groovy

project = "alpine"
repo = "zknt"
version = "3.12.0"
registry = "reg.zknt.org"
registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5"
timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC'))
pipeline {
agent any
stages {
stage('Build image') {
steps {
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
echo 'Starting to build docker image'
script {
def customImage = docker.build(registry+'/'+repo+'/'+project, "--build-arg VERSION=$version --build-arg DATE=$timeStamp .")
customImage.push(version)
customImage.push(version.split(/\./)[0,1].join('.'))
customImage.push(version.split(/\./)[0])
customImage.push("latest")
def io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
withDockerRegistry([ credentialsId: io_registry_credentials ]) {
def official_image = repo+'/'+project+':'+version.split(/\./)[0,1].join('.')
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0]
sh "docker push " + official_image
sh "docker push " + official_image.split(/\:/)[0]
}
def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a"
withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) {
def official_image = 'quay.io/'+repo+'/'+project+':'+version.split(/\./)[0,1].join('.')
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/\:/)[0]
sh "docker push " + official_image
sh "docker push " + official_image.split(/\:/)[0]
}
}
}
}
}
}
post {
always {
emailext body: 'build finished', subject: '[jenkins] docker '+project+': ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true
}
}
}