Skip to content
Permalink
Browse files

Matching container target name as siteadmin-sp

  • Loading branch information
Jim Van Fleet
Jim Van Fleet committed Jul 13, 2017
1 parent ece6316 commit 8f602779d51af1268891b6f8a1e90fc49e757271
Showing with 35 additions and 9 deletions.
  1. +2 −2 Dockerfile
  2. +32 −6 Jenkinsfile
  3. +1 −1 common.bash
@@ -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
@@ -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)
}
}
@@ -1,2 +1,2 @@
maintainer="tier"
imagename="siteadmin-www"
imagename="siteadmin-sp"

0 comments on commit 8f60277

Please sign in to comment.
You can’t perform that action at this time.