DBZ-3907 Publish debezium tool images to dockerhub using Jenkins
This commit is contained in:
parent
247a18f311
commit
02fa81012c
28
jenkins-jobs/job-dsl/deploy_debezium_tool_images.groovy
Normal file
28
jenkins-jobs/job-dsl/deploy_debezium_tool_images.groovy
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
pipelineJob('release-deploy-debezium-tool-images') {
|
||||||
|
displayName('Debezium Deploy Tool Images')
|
||||||
|
description('Build and deploy debezium tool images to the registry')
|
||||||
|
|
||||||
|
properties {
|
||||||
|
githubProjectUrl('https://github.com/debezium/docker-images')
|
||||||
|
}
|
||||||
|
|
||||||
|
logRotator {
|
||||||
|
daysToKeep(7)
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
cron('0 0 * * 1')
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters {
|
||||||
|
stringParam('IMAGES_REPOSITORY', 'github.com/debezium/docker-images.git', 'Repository with Debezium Dockerfiles')
|
||||||
|
stringParam('IMAGES_BRANCH', 'master', 'Branch used for images repository')
|
||||||
|
stringParam('TAG', 'latest', 'Tag used for building images')
|
||||||
|
}
|
||||||
|
|
||||||
|
definition {
|
||||||
|
cps {
|
||||||
|
script(readFileFromWorkspace('jenkins-jobs/pipelines/build-debezium-tool-images.groovy'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
jenkins-jobs/pipelines/build-debezium-tool-images.groovy
Normal file
38
jenkins-jobs/pipelines/build-debezium-tool-images.groovy
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import groovy.json.*
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
IMAGES_DIR = 'images'
|
||||||
|
GIT_CREDENTIALS_ID = 'debezium-github'
|
||||||
|
DOCKER_CREDENTIALS_ID = 'debezium-dockerhub'
|
||||||
|
MAIL_ID = 'jpechane@redhat.com'
|
||||||
|
|
||||||
|
node('Slave') {
|
||||||
|
try {
|
||||||
|
stage('Initialize') {
|
||||||
|
dir('.') {
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
checkout([$class : 'GitSCM',
|
||||||
|
branches : [[name: IMAGES_BRANCH]],
|
||||||
|
doGenerateSubmoduleConfigurations: false,
|
||||||
|
extensions : [[$class: 'RelativeTargetDirectory', relativeTargetDir: IMAGES_DIR]],
|
||||||
|
submoduleCfg : [],
|
||||||
|
userRemoteConfigs : [[url: "https://$IMAGES_REPOSITORY", credentialsId: GIT_CREDENTIALS_ID]]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
withCredentials([usernamePassword(credentialsId: DOCKER_CREDENTIALS_ID, passwordVariable: 'DOCKER_PASSWORD', usernameVariable: 'DOCKER_USERNAME')]) {
|
||||||
|
sh """
|
||||||
|
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('master') {
|
||||||
|
echo "Building debezium tool images"
|
||||||
|
dir(IMAGES_DIR) {
|
||||||
|
sh "PUSH_IMAGES=true TAG=$TAG ./build-tool-images.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
mail to: ${MAIL_ID}, subject: "${JOB_NAME} run #${BUILD_NUMBER} finished", body: "Run ${BUILD_URL} finished with result: ${currentBuild.currentResult}"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user