Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix Jenkins build for non-master branch
(trying to)
mederly committed Oct 5, 2018
1 parent e2d9df1 commit 68d0f46
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Jenkinsfile
@@ -11,7 +11,7 @@ pipeline {
script {
maintainer = maintain()
imagename = imagename()
if (env.BRANCH_NAME == "master" || env.BRANCH_NAME == "bats") { // temporary
if (env.BRANCH_NAME == "master") {
tag = "latest"
} else {
tag = env.BRANCH_NAME
@@ -34,10 +34,8 @@ pipeline {
steps {
script {
try {
sh '(ls -l ; docker ps -a ; docker image ls ; echo Destroying ; bin/destroy.sh ; docker image ls) 2>&1 | tee debug' // temporary
sh './download-midpoint 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
sh 'bin/rebuild.sh 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
//sh 'echo Build output ; cat debug'
sh './jenkins-rebuild.sh 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0' // temporary
} catch (error) {
def error_details = readFile('./debug')
def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}"
17 changes: 17 additions & 0 deletions jenkins-rebuild.sh
@@ -0,0 +1,17 @@
#!/bin/bash

# Temporary workaround for docker/util not rebuilding the specific version of the image

# from destroy.sh (adapted)

result=$(docker ps -a | grep $maintainer/$imagename:$tag)

if [ ! -z "$result" ]; then
docker rm -f $(docker ps -a | grep $maintainer/$imagename:$tag | awk '{print $1}')
docker rmi -f $maintainer/$imagename:$tag
fi

# from build.sh (adapted)

echo "Building new Docker image($maintainer/$imagename:$tag)"
docker build --rm -t $maintainer/$imagename:$tag --build-arg maintainer=$maintainer --build-arg imagename=$imagename .

0 comments on commit 68d0f46

Please sign in to comment.