debian/Jenkinsfile

60 lines
1.9 KiB
Groovy

gosu_version = "1.12"
dumb_init_version = "1.2.2"
timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC'))
pipeline {
agent any
stages {
stage('Build image') {
steps {
withDockerRegistry([ credentialsId: "6ff44976-23cd-4cc2-902c-de8c340e65e5", url: "https://reg.zknt.org" ]) {
script {
def customImage = docker.build("reg.zknt.org/zknt/debian", "--build-arg DATE=$timeStamp --build-arg GOSU_VERSION=$gosu_version --build-arg DUMB_INIT_VERSION=$dumb_init_version --no-cache --pull .")
aquaMicroscanner imageName: 'reg.zknt.org/zknt/debian', notCompliesCmd: '', onDisallowed: 'ignore', outputFormat: 'html'
customImage.push("buster")
customImage.push("stable")
customImage.push("10")
registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
withDockerRegistry([ credentialsId: registry_credentials ]) {
def official_image = 'zknt/debian:buster'
sh "docker image tag reg.zknt.org/zknt/debian:buster " + official_image
sh "docker push " + official_image
}
}
}
}
}
}
post {
always {
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: 2,
continueAfterMatch: false
],
[
conditions: [
BuildResult(matchSuccess: true, matchFailure: true)
],
actions: [DeleteBuild()]
]
]))
}
}