1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

Fixing groovy

This commit is contained in:
Ewout Prangsma 2018-03-27 10:16:11 +02:00
parent fef2975210
commit 1ac163dd8e
No known key found for this signature in database
GPG key ID: 4DBAD380D93D0698

View file

@ -23,8 +23,6 @@ def fetchParamsFromGitLog() {
def myParams = [:]; def myParams = [:];
// Copy configured params // Copy configured params
for (entry in params) { for (entry in params) {
println("Fetching entry from params: ${entry}");
println("Fetching entry from params: key=${entry.key}, value=${entry.value}");
myParams[entry.key] = entry.value; myParams[entry.key] = entry.value;
} }
@ -33,9 +31,7 @@ def fetchParamsFromGitLog() {
// Example: [ci TESTOPTIONS="-test.run ^TestSimpleSingle$"] // Example: [ci TESTOPTIONS="-test.run ^TestSimpleSingle$"]
def options = sh(returnStdout: true, script: "git log --reverse remotes/origin/master..HEAD | grep -o \'\\[ci[^\\[]*\\]\' | sed -E \'s/\\[ci (.*)\\]/\\1/\'").trim().split("\n") def options = sh(returnStdout: true, script: "git log --reverse remotes/origin/master..HEAD | grep -o \'\\[ci[^\\[]*\\]\' | sed -E \'s/\\[ci (.*)\\]/\\1/\'").trim().split("\n")
for (opt in options) { for (opt in options) {
println("Processing option ${opt}");
def idx = opt.indexOf('='); def idx = opt.indexOf('=');
println("Processing option ${opt} with idx=${idx}");
if (idx > 0) { if (idx > 0) {
def key = opt.substring(0, idx); def key = opt.substring(0, idx);
def value = opt.substring(idx+1); def value = opt.substring(idx+1);
@ -52,11 +48,11 @@ def buildBuildSteps(Map myParams) {
return { return {
timestamps { timestamps {
withEnv([ withEnv([
"DEPLOYMENTNAMESPACE=${myParams['TESTNAMESPACE']}-${env.GIT_COMMIT}", "DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
"DOCKERNAMESPACE=${myParams['DOCKERNAMESPACE']}", "DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
"IMAGETAG=jenkins-test", "IMAGETAG=jenkins-test",
"LONG=${myParams['LONG'] ? 1 : 0}", "LONG=${myParams.LONG ? 1 : 0}",
"TESTOPTIONS=${myParams['TESTOPTIONS']}", "TESTOPTIONS=${myParams.TESTOPTIONS}",
]) { ]) {
sh "make" sh "make"
sh "make run-unit-tests" sh "make run-unit-tests"
@ -71,13 +67,13 @@ def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
timestamps { timestamps {
withCredentials([string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE')]) { withCredentials([string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE')]) {
withEnv([ withEnv([
"DEPLOYMENTNAMESPACE=${myParams['TESTNAMESPACE']}-${env.GIT_COMMIT}", "DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
"DOCKERNAMESPACE=${myParams['DOCKERNAMESPACE']}", "DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
"ENTERPRISEIMAGE=${myParams['ENTERPRISEIMAGE']}", "ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}",
"IMAGETAG=jenkins-test", "IMAGETAG=jenkins-test",
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}", "KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
"LONG=${myParams['LONG'] ? 1 : 0}", "LONG=${myParams.LONG ? 1 : 0}",
"TESTOPTIONS=${myParams['TESTOPTIONS']}", "TESTOPTIONS=${myParams.TESTOPTIONS}",
]) { ]) {
sh "make run-tests" sh "make run-tests"
} }
@ -90,8 +86,8 @@ def buildCleanupSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
return { return {
timestamps { timestamps {
withEnv([ withEnv([
"DEPLOYMENTNAMESPACE=${myParams['TESTNAMESPACE']}-${env.GIT_COMMIT}", "DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
"DOCKERNAMESPACE=${myParams['DOCKERNAMESPACE']}", "DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}", "KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
]) { ]) {
sh "make cleanup-tests" sh "make cleanup-tests"
@ -127,7 +123,7 @@ pipeline {
steps { steps {
script { script {
def myParams = fetchParamsFromGitLog(); def myParams = fetchParamsFromGitLog();
def configs = "${myParams['KUBECONFIGS']}".split(",") def configs = "${myParams.KUBECONFIGS}".split(",")
def testTasks = [:] def testTasks = [:]
for (kubeconfig in configs) { for (kubeconfig in configs) {
testTasks["${kubeconfig}"] = buildTestSteps(myParams, kubeConfigRoot, kubeconfig) testTasks["${kubeconfig}"] = buildTestSteps(myParams, kubeConfigRoot, kubeconfig)