Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Build pipeline should perform rebuilds
Jim Van Fleet committed Sep 13, 2016
1 parent 98293fa commit 69eeb82
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions Jenkinsfile
@@ -13,33 +13,33 @@ node('docker') {
sh 'ls'
sh 'mv bin/* ../bin/.'
}
stage 'Environment'

stage 'Setting build context'
def maintainer = maintainer()
def imagename = imagename()
def tag = env.BRANCH_NAME

def tag
// Tag images created on master branch with 'latest'
if(env.BRANCH_NAME == "master"){
tag = "latest"
}else{
tag = env.BRANCH_NAME
}

if(!imagename){
if(env.BRANCH_NAME == "master"){
tag = "latest"
}else{
tag = env.BRANCH_NAME
}
if(!imagename){
echo "You must define an imagename in common.bash"
currentBuild.result = 'FAILURE'
}
if(maintainer){
echo "Building ${maintainer}:${tag} for ${maintainer}"
}
}
if(maintainer){
echo "Building ${imagename}:${tag} for ${maintainer}"
}

stage 'Build'
try{
sh 'bin/build.sh &> debug'
sh 'bin/rebuild.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem building the Base Image. \n\n ${error_details}"
def message = "BUILD ERROR: There was a problem building the shibboleth-sp mage. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}
@@ -49,8 +49,15 @@ node('docker') {

stage 'Tests'

sh 'bin/test.sh'
// should build a finally construct here
try{
sh 'bin/test.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem testing ${imagename}:${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'Stop container'

sh 'bin/ci-stop.sh'
@@ -60,8 +67,10 @@ node('docker') {
def baseImg = docker.build("$maintainer/$imagename")
baseImg.push("$tag")
}



stage 'Notify'

slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub"
}

def maintainer() {

0 comments on commit 69eeb82

Please sign in to comment.