Skip to content

Reenable push #11

Merged
5 commits merged into from
Jul 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}