From 56aaf2577d2b1a96e805b1b85264c56267bc8306 Mon Sep 17 00:00:00 2001 From: Chris Bynum Date: Tue, 9 Aug 2016 16:23:34 -0400 Subject: [PATCH] Tag images in this branch with latest --- Jenkinsfile | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 584e271..54a054b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,9 +3,9 @@ node('docker') { stage 'Checkout' checkout scm - + stage 'Acquire util' - + sh 'mkdir -p bin' dir('bin'){ git([ url: "https://github.internet2.edu/docker/util.git", @@ -13,7 +13,7 @@ node('docker') { sh 'ls' sh 'mv bin/* .' } - + stage 'Acquire conftree' sh 'mkdir -p root' @@ -21,34 +21,42 @@ node('docker') { git([ url: "https://github.internet2.edu/docker/shib-idp-conftree.git", branch: "test", credentialsId: "jenkins-github-access-token" ]) } - + stage 'Build' def maintainer = maintainer() def imagename = imagename() - def tag = env.BRANCH_NAME + def tag + + 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}" + echo "Building ${maintainer} for ${maintainer}" } sh 'bin/rebuild.sh' stage 'Start container' - + sh 'bin/ci-run.sh && sleep 60' - + stage 'Tests' - + sh 'bin/test.sh' // should build a finally construct here stage 'Stop container' - + sh 'bin/ci-stop.sh' - + stage 'Push' docker.withRegistry('https://registry.hub.docker.com/', 'dockerhub-bigfleet') { @@ -71,4 +79,4 @@ def imagename() { def version() { def matcher = readFile('common.bash') =~ 'version="(.+)"' matcher ? matcher[0][1] : null -} \ No newline at end of file +}