Skip to content

Commit

Permalink
Updates to the file
Browse files Browse the repository at this point in the history
  • Loading branch information
John Gasper committed Sep 4, 2018
1 parent ff510ce commit 1804879
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ pipeline {
def builds = build(tagSet)

if(env.BRANCH_NAME == "master") {
push(builds)
//builds.each{ k, v -> echo ("push ${k}") } //for local testing
builds.each{ k, v -> v.push(k) }

} else {
echo 'skipping push, since the SCM branch is not master'
}
Expand Down Expand Up @@ -121,6 +123,34 @@ def imagename() {
matcher ? matcher[0][1] : null
}

def generateTagSet() {
def tagSet = []

exceriseSets.each{ course, stepCountPerExercise ->
stepCountPerExercise.eachWithIndex {stepCount, exIndex ->
for (int step = 0; step < stepCount; step++) {
tagSet.add("${course}.${exIndex+1}.${step+1}")
}

tagSet.add("${course}.${exIndex+1}.end")
}
}

tagSet
}

def build(tagSet) {
def builds = [:]

for (String tag : tagSet) {
def baseImg = docker.build("$maintainer/$imagename", "--no-cache $tag")
echo "built ${tag}; adding to the push queue"
builds.put(tag, baseImg);
}

builds
}

def handleError(String message){
echo "${message}"
currentBuild.setResult("FAILED")
Expand Down

0 comments on commit 1804879

Please sign in to comment.