add autotoot

pull/1/head
chris 2020-06-22 14:10:13 +02:00
parent 7e12a12bfa
commit 19bb2252e9
1 changed files with 12 additions and 3 deletions

15
Jenkinsfile vendored
View File

@ -3,6 +3,7 @@ repo = "zknt"
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'))
official_image = ""
pipeline { pipeline {
agent any agent any
@ -18,9 +19,9 @@ pipeline {
customImage.push(timeStamp) customImage.push(timeStamp)
customImage.push() customImage.push()
registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7" io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
withDockerRegistry([ credentialsId: registry_credentials ]) { withDockerRegistry([ credentialsId: io_registry_credentials ]) {
def official_image = repo+'/'+project official_image = repo+'/'+project
sh "docker image tag " + registry+'/'+repo+'/'+project + ' ' + official_image sh "docker image tag " + registry+'/'+repo+'/'+project + ' ' + official_image
sh "docker image tag " + registry+'/'+repo+'/'+project + ' ' + official_image+':'+timeStamp sh "docker image tag " + registry+'/'+repo+'/'+project + ' ' + official_image+':'+timeStamp
sh "docker push " + official_image sh "docker push " + official_image
@ -36,6 +37,14 @@ pipeline {
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
} }
success {
withCredentials([string(credentialsId: '90700f9c-c5cf-449b-81af-d854c08265f5', variable: 'CONFIG_JSON')]) {
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
sh "docker pull reg.zknt.org/zknt/toot"
sh 'docker run -i -e CONFIG_JSON=$CONFIG_JSON -e TOOT="Successfully built and pushed new image: '+official_image+':'+timeStamp+' https://hub.docker.com/r/zknt/pixelfed/tags" reg.zknt.org/zknt/toot'
}
}
}
} }
options { options {
buildDiscarder(BuildHistoryManager([ buildDiscarder(BuildHistoryManager([