Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated base build
Jim Van Fleet committed Aug 30, 2016
1 parent 5fc72e2 commit f9c0c7b
Showing 1 changed file with 41 additions and 9 deletions.
50 changes: 41 additions & 9 deletions Jenkinsfile
@@ -2,26 +2,58 @@ node {
stage 'Checkout'

checkout scm

stage 'Acquire util'

sh 'mkdir -p tmp'
dir('tmp'){
git([ url: "https://github.internet2.edu/docker/util.git",
credentialsId: "jenkins-github-access-token" ])
sh 'ls'
sh 'mv ./bin/* ../bin/.'
}
stage 'Setting build context'

def maintainer = maintainer()
def imagename = imagename()
def tag

// Tag images created on master branch with 'latest'
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}"
}

stage 'BUILD: Base'

try{
// Build Base Image
sh './build.sh &> debug'
// Build Base Image
// sh './build_image.sh &> debug'
// Run Base Container
// sh 'bin/run.sh'
sh 'bin/build.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 ${imagename}:${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'TEST: Base'

sh 'bats tests/base.bats'
try{
sh 'bin/test.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'SHIP: Base'

@@ -35,6 +67,6 @@ def handleError(String message){
echo "${message}"
currentBuild.setResult("FAILED")
slackSend color: 'danger', message: "${message}"
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true])
#step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true])
sh 'exit 1'
}

0 comments on commit f9c0c7b

Please sign in to comment.