Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Matching container target name as siteadmin-sp
Jim Van Fleet committed Jul 13, 2017
1 parent ece6316 commit 8f60277
Showing 3 changed files with 35 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
@@ -2,12 +2,12 @@ FROM tier/shibboleth_sp

# Define args and set a default value
ARG maintainer=tier
ARG imagename=siteadmin-www
ARG imagename=siteadmin-sp
ARG version=1.0

MAINTAINER $maintainer
LABEL Vendor="Internet2"
LABEL ImageType="WWW"
LABEL ImageType="SP"
LABEL ImageName=$imagename
LABEL ImageOS=centos7
LABEL Version=$version
38 changes: 32 additions & 6 deletions Jenkinsfile
@@ -1,4 +1,4 @@
node {
node('docker') {

stage 'Checkout'

@@ -42,19 +42,27 @@ node {
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)
handleError(message, tag)
}

stage 'Start container'

sh 'bin/ci-run.sh && sleep 15'

stage 'Tests'

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}"
def message = "BUILD ERROR: There was a problem testing ${imagename}:${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
handleError(message, tag)
}

stage 'Stop container'

sh 'bin/ci-stop.sh'

stage 'Push'

@@ -63,6 +71,10 @@ node {
baseImg.push("$tag")
}

stage 'Clean Up'

cleanup(tag)

stage 'Notify'

slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub"
@@ -79,10 +91,24 @@ def imagename() {
matcher ? matcher[0][1] : null
}

def handleError(String message){
def handleError(String message, String tag, Boolean doCleanup = true){
echo "${message}"
currentBuild.setResult("FAILED")
slackSend color: 'danger', message: "${message}"
//step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true])
if (doCleanup) {
cleanup(tag)
}
sh 'exit 1'
}

def cleanup(String tag) {
try{
sh 'bin/destroy.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem cleaning up ${imagename}:${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message, tag, false)
}
}
2 changes: 1 addition & 1 deletion common.bash
@@ -1,2 +1,2 @@
maintainer="tier"
imagename="siteadmin-www"
imagename="siteadmin-sp"

0 comments on commit 8f60277

Please sign in to comment.