Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add building of midpoint-mariadb
...and added slack notifications as well.
mederly committed Sep 21, 2018
1 parent 97d1137 commit 96fc61d
Showing 2 changed files with 21 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Jenkinsfile
@@ -3,6 +3,7 @@ pipeline {
environment {
maintainer = "t"
imagename = 'm'
imagename_data = 'md'
tag = 'l'
}
stages {
@@ -11,13 +12,14 @@ pipeline {
script {
maintainer = maintain()
imagename = imagename()
imagename_data = imagename_data()
if(env.BRANCH_NAME == "master") {
tag = "latest"
} else {
tag = env.BRANCH_NAME
}
if(!imagename){
echo "You must define an imagename in common.bash"
if(!imagename || !imagename_data){
echo "You must define imagename and imagename_data in common.bash"
currentBuild.result = 'FAILURE'
}
sh 'mkdir -p bin'
@@ -56,13 +58,21 @@ pipeline {
// sh 'cd test-compose && docker-compose down'
baseImg.push("$tag")
}
docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") {
def baseImg = docker.build("$maintainer/$imagename_data", "--no-cache midpoint/midpoint-data")
// test the environment
// sh 'cd test-compose && ./compose.sh'
// bring down after testing
// sh 'cd test-compose && docker-compose down'
baseImg.push("$tag")
}
}
}
}
stage('Notify') {
steps {
echo "$maintainer"
//slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub"
slackSend color: 'good', message: "$maintainer/$imagename:$tag and $maintainer/$imagename_data:$tag pushed to DockerHub"
}
}
}
@@ -72,7 +82,7 @@ pipeline {
}
failure {
// slackSend color: 'good', message: "Build failed"
handleError("BUILD ERROR: There was a problem building ${maintainer}/${imagename}:${tag}.")
handleError("BUILD ERROR: There was a problem building ${maintainer}/${imagename}:${tag} or ${maintainer}/${imagename_data}:${tag}.")
}
}
}
@@ -88,10 +98,15 @@ def imagename() {
matcher ? matcher[0][1] : null
}

def imagename_data() {
def matcher = readFile('common.bash') =~ 'imagename_data="(.+)"'
matcher ? matcher[0][1] : null
}

def handleError(String message){
echo "${message}"
currentBuild.setResult("FAILED")
//slackSend color: 'danger', message: "${message}"
slackSend color: 'danger', message: "${message}"
//step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chubing@internet2.edu', sendToIndividuals: true])
sh 'exit 1'
}
1 change: 1 addition & 0 deletions common.bash
@@ -1,2 +1,3 @@
maintainer="tier"
imagename="midpoint"
imagename_data="midpoint-mariadb"

0 comments on commit 96fc61d

Please sign in to comment.