Skip to content

Commit

Permalink
Merge pull request #11 from docker/reenable-push
Browse files Browse the repository at this point in the history
Reenable push
  • Loading branch information
Jim Van Fleet committed Jul 27, 2016
2 parents a087b87 + 21ba0f6 commit 583acd2
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
node {

env.DOCKERHUB_ACCOUNT = "bigfleet"
env.VERSION_TAG = "3.2.1" // latest version of the release
env.BUILD_TAG = "testing" // default tag to push for to the registry

stage 'Checkout'

checkout scm
Expand All @@ -17,14 +13,42 @@ node {
sh 'ls'
sh 'mv bin/* .'
}

stage 'Base'

stage 'Build'

def maintainer = maintainer()
def imagename = imagename()
def 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}"
}

sh 'bin/build.sh'

stage 'Tests'

sh '/usr/local/bin/bats tests'
sh 'bin/test.sh'

stage 'Push'

docker.withRegistry('https://registry.hub.docker.com/', 'dockerhub-bigfleet') {
def baseImg = docker.build("$maintainer/$imagename")
baseImg.push("$tag")
}


}

def maintainer() {
def matcher = readFile('common.bash') =~ 'maintainer="(.+)"'
matcher ? matcher[0][1] : 'tier'
}

def imagename() {
def matcher = readFile('common.bash') =~ 'imagename="(.+)"'
matcher ? matcher[0][1] : null
}

0 comments on commit 583acd2

Please sign in to comment.