11def workpath_linux = " /src/github.com/deis/workflow-cli"
2+ def windows = ' windows'
3+ def linux = ' linux'
24
35def getBasePath = { String filepath ->
46 def filename = filepath. lastIndexOf(File . separator)
@@ -58,34 +60,48 @@ def sh = { String cmd ->
5860 }
5961}
6062
61- node(' windows' ) {
63+ def pscmd = { String cmd ->
64+ " powershell -NoProfile -ExecutionPolicy Bypass -Command \" ${ cmd} \" "
65+ }
66+
67+ def bootstrap = { String node ->
68+ bootstrapCmd = node == windows ? bat(pscmd(' .\\ make bootstrap' )) : make(' bootstrap' )
69+
70+ try {
71+ bootstrapCmd
72+ } catch (error) {
73+ echo " bootstrap failed; wiping 'vendor' directory and trying again..."
74+ retry(1 ) {
75+ dir(' vendor' ) { deleteDir() }
76+ bootstrapCmd
77+ }
78+ }
79+ }
80+
81+ node(windows) {
6282 def gopath = pwd() + " \\ gopath"
6383 env. GOPATH = gopath
6484 def workdir = gopath + " \\ src\\ github.com\\ deis\\ workflow-cli"
6585
66- def pscmd = { String cmd ->
67- " powershell -NoProfile -ExecutionPolicy Bypass -Command \" ${ cmd} \" "
68- }
69-
7086 dir(workdir) {
7187 stage ' Checkout Windows'
7288 checkout scm
7389 stage ' Install Windows'
74- bat pscmd( ' . \\ make bootstrap' )
90+ bootstrap windows
7591 stage ' Test Windows'
7692 bat pscmd(' .\\ make test' )
7793 }
7894}
7995
80- node(' linux' ) {
96+ node(linux) {
8197 def gopath = gopath_linux()
8298 def workdir = workdir_linux(gopath)
8399
84100 dir(workdir) {
85101 stage ' Checkout Linux'
86102 checkout scm
87103 stage ' Install Linux'
88- make ' bootstrap'
104+ bootstrap linux
89105 stage ' Test Linux'
90106 make ' test-cover'
91107 stage ' Upload to Codeconv'
@@ -99,7 +115,7 @@ def git_commit = ''
99115def git_branch = ' '
100116
101117stage ' Git Info'
102- node(' linux' ) {
118+ node(linux) {
103119
104120 def gopath = gopath_linux()
105121 def workdir = workdir_linux(gopath)
@@ -135,7 +151,7 @@ stage 'Build and Upload Artifacts'
135151
136152parallel(
137153 revision : {
138- node(' linux' ) {
154+ node(linux) {
139155 def gopath = gopath_linux()
140156 def workdir = workdir_linux(gopath)
141157
@@ -156,7 +172,7 @@ parallel(
156172 }
157173 },
158174 latest : {
159- node(' linux' ) {
175+ node(linux) {
160176 def gopath = gopath_linux()
161177 def workdir = workdir_linux(gopath)
162178
@@ -194,7 +210,7 @@ waitUntil {
194210 throw error
195211 }
196212
197- node(' linux' ) {
213+ node(linux) {
198214 withCredentials([[$class : ' StringBinding' , credentialsId : ' 8a727911-596f-4057-97c2-b9e23de5268d' , variable : ' SLACKEMAIL' ]]) {
199215 mail body : """ <!DOCTYPE html>
200216<html>
0 commit comments