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)
@@ -54,34 +56,48 @@ def sh = { String cmd ->
5456 }
5557}
5658
57- node(' windows' ) {
59+ def pscmd = { String cmd ->
60+ " powershell -NoProfile -ExecutionPolicy Bypass -Command \" ${ cmd} \" "
61+ }
62+
63+ def bootstrap = { String node ->
64+ bootstrapCmd = node == windows ? bat(pscmd(' .\\ make bootstrap' )) : make(' bootstrap' )
65+
66+ try {
67+ bootstrapCmd
68+ } catch (error) {
69+ echo " bootstrap failed; wiping 'vendor' directory and trying again..."
70+ retry(1 ) {
71+ dir(' vendor' ) { deleteDir() }
72+ bootstrapCmd
73+ }
74+ }
75+ }
76+
77+ node(windows) {
5878 def gopath = pwd() + " \\ gopath"
5979 env. GOPATH = gopath
6080 def workdir = gopath + " \\ src\\ github.com\\ deis\\ workflow-cli"
6181
62- def pscmd = { String cmd ->
63- " powershell -NoProfile -ExecutionPolicy Bypass -Command \" ${ cmd} \" "
64- }
65-
6682 dir(workdir) {
6783 stage ' Checkout Windows'
6884 checkout scm
6985 stage ' Install Windows'
70- bat pscmd( ' . \\ make bootstrap' )
86+ bootstrap windows
7187 stage ' Test Windows'
7288 bat pscmd(' .\\ make test' )
7389 }
7490}
7591
76- node(' linux' ) {
92+ node(linux) {
7793 def gopath = gopath_linux()
7894 def workdir = workdir_linux(gopath)
7995
8096 dir(workdir) {
8197 stage ' Checkout Linux'
8298 checkout scm
8399 stage ' Install Linux'
84- make ' bootstrap'
100+ bootstrap linux
85101 stage ' Test Linux'
86102 make ' test-cover'
87103 stage ' Upload to Codeconv'
@@ -95,7 +111,7 @@ def git_commit = ''
95111def git_branch = ' '
96112
97113stage ' Git Info'
98- node(' linux' ) {
114+ node(linux) {
99115
100116 def gopath = gopath_linux()
101117 def workdir = workdir_linux(gopath)
@@ -131,7 +147,7 @@ stage 'Build and Upload Artifacts'
131147
132148parallel(
133149 revision : {
134- node(' linux' ) {
150+ node(linux) {
135151 def gopath = gopath_linux()
136152 def workdir = workdir_linux(gopath)
137153
@@ -152,7 +168,7 @@ parallel(
152168 }
153169 },
154170 latest : {
155- node(' linux' ) {
171+ node(linux) {
156172 def gopath = gopath_linux()
157173 def workdir = workdir_linux(gopath)
158174
@@ -190,7 +206,7 @@ waitUntil {
190206 throw error
191207 }
192208
193- node(' linux' ) {
209+ node(linux) {
194210 withCredentials([[$class : ' StringBinding' , credentialsId : ' 8a727911-596f-4057-97c2-b9e23de5268d' , variable : ' SLACKEMAIL' ]]) {
195211 mail body : """ <!DOCTYPE html>
196212<html>
0 commit comments