manage artifacts
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
a2ff103a2d
commit
0d293e4fcf
|
@ -13,7 +13,7 @@ pipeline {
|
||||||
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
|
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
|
||||||
echo 'Starting to build docker image'
|
echo 'Starting to build docker image'
|
||||||
script {
|
script {
|
||||||
def customImage = docker.build(registry+'/'+repo+'/'+project, "--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(version.split(/\./)[0,1].join('.'))
|
customImage.push(version.split(/\./)[0,1].join('.'))
|
||||||
customImage.push(version.split(/\./)[0])
|
customImage.push(version.split(/\./)[0])
|
||||||
|
@ -43,8 +43,36 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
success {
|
||||||
|
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"""
|
||||||
|
}
|
||||||
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+': ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
options {
|
||||||
|
buildDiscarder(BuildHistoryManager([
|
||||||
|
[
|
||||||
|
conditions: [
|
||||||
|
BuildResult(matchFailure: true)
|
||||||
|
],
|
||||||
|
matchAtMost: 4,
|
||||||
|
continueAfterMatch: false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
conditions: [
|
||||||
|
BuildResult(matchSuccess: true)
|
||||||
|
],
|
||||||
|
matchAtMost: 4,
|
||||||
|
continueAfterMatch: false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
conditions: [
|
||||||
|
BuildResult(matchSuccess: true, matchFailure: true)
|
||||||
|
],
|
||||||
|
actions: [DeleteBuild()]
|
||||||
|
]
|
||||||
|
]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue