Skip to content

Commit c2018d4

Browse files
author
Vaughn Dice
authored
Merge pull request #128 from vdice/receive-sdk-params
feat(Jenkinsfile): receive sdk-related params
2 parents 7afbdcc + 52296e9 commit c2018d4

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

Jenkinsfile

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ def workpath_linux = "/src/github.com/deis/workflow-cli"
22
def keyfile = "tmp/key.json"
33

44
def getBasePath = { String filepath ->
5-
def filename = filepath.lastIndexOf("/")
5+
def filename = filepath.lastIndexOf(File.separator)
66
return filepath.substring(0, filename)
77
}
88

@@ -24,6 +24,18 @@ def workdir_linux = { String gopath ->
2424
gopath + workpath_linux
2525
}
2626

27+
properties([[$class: 'ParametersDefinitionProperty',
28+
parameterDefinitions: [
29+
[$class: 'StringParameterDefinition',
30+
defaultValue: '',
31+
description: 'controller-sdk-go commit sha to use in glide.yaml (not updated if empty)',
32+
name : 'SDK_SHA'],
33+
[$class: 'StringParameterDefinition',
34+
defaultValue: '',
35+
description: 'controller-sdk-go repo to use in glide.yaml (not updated if empty)',
36+
name: 'SDK_GO_REPO']
37+
]]])
38+
2739
node('windows') {
2840
def gopath = pwd() + "\\gopath"
2941
env.GOPATH = gopath
@@ -95,6 +107,20 @@ parallel(
95107
}
96108

97109
sh 'make bootstrap'
110+
111+
if (SDK_GO_REPO && SDK_SHA) {
112+
echo "Updating local glide.yaml with controller-sdk-go repo '${SDK_GO_REPO}' and version '${SDK_SHA}'"
113+
114+
def pattern = "github\\.com\\/deis\\/controller-sdk-go\\n\\s+version:\\s+[a-f0-9]+"
115+
def replacement = "${SDK_GO_REPO.replace("/", "\\/")}\\n version: ${SDK_SHA}"
116+
sh "perl -i -0pe 's/${pattern}/${replacement}/' glide.yaml"
117+
118+
def glideYaml = readFile('glide.yaml')
119+
echo "Updated glide.yaml:\n${glideYaml}"
120+
121+
sh 'make glideup'
122+
}
123+
98124
sh 'make build-revision'
99125

100126
upload_artifacts(keyfile)
@@ -132,9 +158,9 @@ waitUntil {
132158
} else {
133159
build job: '/workflow-test-pr', parameters: [[$class: 'StringParameterValue', name: 'WORKFLOW_CLI_SHA', value: git_commit]]
134160
}
161+
true
135162
} catch(error) {
136163
input "Retry the e2e tests?"
137164
false
138165
}
139-
true
140166
}

0 commit comments

Comments
 (0)