From fef29752109a6cce1a49d1e0159f5b417f8268c7 Mon Sep 17 00:00:00 2001 From: Ewout Prangsma Date: Tue, 27 Mar 2018 10:08:21 +0200 Subject: [PATCH] This is stupid --- Jenkinsfile.groovy | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 6a2b38716..bff19f038 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -48,6 +48,24 @@ def fetchParamsFromGitLog() { def kubeConfigRoot = "/home/jenkins/.kube" +def buildBuildSteps(Map myParams) { + return { + timestamps { + withEnv([ + "DEPLOYMENTNAMESPACE=${myParams['TESTNAMESPACE']}-${env.GIT_COMMIT}", + "DOCKERNAMESPACE=${myParams['DOCKERNAMESPACE']}", + "IMAGETAG=jenkins-test", + "LONG=${myParams['LONG'] ? 1 : 0}", + "TESTOPTIONS=${myParams['TESTOPTIONS']}", + ]) { + sh "make" + sh "make run-unit-tests" + sh "make docker-test" + } + } + } +} + def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) { return { timestamps { @@ -96,34 +114,19 @@ pipeline { string(name: 'ENTERPRISEIMAGE', defaultValue: '', description: 'ENTERPRISEIMAGE sets the docker image used for enterprise tests)', ) } stages { - def myParams = [:]; - stage("Prepare") { - steps { - script { - myParams = fetchParamsFromGitLog(); - } - } - } stage('Build') { steps { - timestamps { - withEnv([ - "DEPLOYMENTNAMESPACE=${myParams['TESTNAMESPACE']}-${env.GIT_COMMIT}", - "DOCKERNAMESPACE=${myParams['DOCKERNAMESPACE']}", - "IMAGETAG=jenkins-test", - "LONG=${myParams['LONG'] ? 1 : 0}", - "TESTOPTIONS=${myParams['TESTOPTIONS']}", - ]) { - sh "make" - sh "make run-unit-tests" - sh "make docker-test" - } + script { + def myParams = fetchParamsFromGitLog(); + def buildSteps = buildBuildSteps(myParams); + buildSteps(); } } } stage('Test') { steps { script { + def myParams = fetchParamsFromGitLog(); def configs = "${myParams['KUBECONFIGS']}".split(",") def testTasks = [:] for (kubeconfig in configs) { @@ -138,6 +141,7 @@ pipeline { post { always { script { + def myParams = fetchParamsFromGitLog(); def configs = "${myParams['KUBECONFIGS']}".split(",") def cleanupTasks = [:] for (kubeconfig in configs) {