@cryptotaxi247 / kubo / commits / 48e2aa325

ci: Add more timeouts to the pipeline

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Apr 21, 2018 at 18:08 UTC 48e2aa3252bb7942111c20a851033ee0b2f570c0
1 file changed +81 -56
ci/Jenkinsfile
+81 -56
@@ -2,6 +2,13 @@ import groovy.transform.Field
2
3 /* SETTINGS */
4
5 +// in minutes
6 +def global_timeout = 30
7 +def sharness_timeout = 15
8 +def gotest_timeout = 10
9 +def build_timeout = 20
10 +def check_timeout = 4
11 +
12 def test = 'go test -v ./...'
13
14 def fast_build_platforms = [
@@ -64,21 +71,27 @@ def gobuild_step(list) {
71
72 /* PIPELINE */
73
67 -ansiColor('xterm') { withEnv(['TERM=xterm-color']) { timeout(time: 30, unit: 'MINUTES') {
74 +ansiColor('xterm') { withEnv(['TERM=xterm-color']) { timeout(time: global_timeout, unit: 'MINUTES') {
75 stage('Checks') {
76 parallel(
77 'go fmt': {
78 setupStep('linux') { run ->
72 - run 'make test_go_fmt'
79 + timeout(time: check_timeout, unit: 'MINUTES') {
80 + run 'make test_go_fmt'
81 + }
82 }
83 },
84 'go vet': {
85 setupStep('linux') { run ->
77 - run 'go vet ./...'
86 + timeout(time: check_timeout, unit: 'MINUTES') {
87 + run 'go vet ./...'
88 + }
89 }
90 },
91 'go build': {
81 - gobuild_step(fast_build_platforms)
92 + timeout(time: check_timeout, unit: 'MINUTES') {
93 + gobuild_step(fast_build_platforms)
94 + }
95 }
96 )
97 }
@@ -86,81 +99,93 @@ ansiColor('xterm') { withEnv(['TERM=xterm-color']) { timeout(time: 30, unit: 'MI
99 stage('Tests') {
100 parallel(
101 'go build (other platforms)': {
89 - gobuild_step(build_platforms)
102 + timeout(time: build_timeout, unit: 'MINUTES') {
103 + gobuild_step(build_platforms)
104 + }
105 },
106 windows: {
107 setupStep('windows') { run ->
93 - run 'go get -v github.com/jstemmer/go-junit-report github.com/whyrusleeping/gx github.com/whyrusleeping/gx-go'
94 - run "gx install --global"
95 -
96 - try {
97 - run test + ' -tags="nofuse" > output & type output'
98 - run 'type output | go-junit-report > junit-report-windows.xml'
99 - } catch (err) {
100 - throw err
101 - } finally {
102 - /* IGNORE TEST FAILS */
103 - /* junit allowEmptyResults: true, testResults: 'junit-report-*.xml' */
108 + timeout(time: gotest_timeout, unit: 'MINUTES') {
109 + run 'go get -v github.com/jstemmer/go-junit-report github.com/whyrusleeping/gx github.com/whyrusleeping/gx-go'
110 + run "gx install --global"
111 +
112 + try {
113 + run test + ' -tags="nofuse" > output & type output'
114 + run 'type output | go-junit-report > junit-report-windows.xml'
115 + } catch (err) {
116 + throw err
117 + } finally {
118 + /* IGNORE TEST FAILS */
119 + /* junit allowEmptyResults: true, testResults: 'junit-report-*.xml' */
120 + }
121 }
122 }
123 },
124 linux: {
125 setupStep('linux') { run ->
109 - run 'go get -v github.com/jstemmer/go-junit-report'
110 - run "make gx-deps"
111 -
112 - try {
113 - run test + ' -tags="nofuse" 2>&1 | tee output'
114 - run 'cat output | go-junit-report > junit-report-linux.xml'
115 - } catch (err) {
116 - throw err
117 - } finally {
118 - junit allowEmptyResults: true, testResults: 'junit-report-*.xml'
126 + timeout(time: gotest_timeout, unit: 'MINUTES') {
127 + run 'go get -v github.com/jstemmer/go-junit-report'
128 + run "make gx-deps"
129 +
130 + try {
131 + run test + ' -tags="nofuse" 2>&1 | tee output'
132 + run 'cat output | go-junit-report > junit-report-linux.xml'
133 + } catch (err) {
134 + throw err
135 + } finally {
136 + junit allowEmptyResults: true, testResults: 'junit-report-*.xml'
137 + }
138 }
139 }
140 },
141 linuxSharness: {
142 setupStep('linux') { run ->
124 - run 'go get -v github.com/jstemmer/go-junit-report'
125 - run "make gx-deps"
126 -
127 - try {
128 - run "make -j12 -Otarget test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_NO_FUSE=1 TEST_NO_DOCKER=1"
129 - } catch (err) {
130 - throw err
131 - } finally {
132 - junit allowEmptyResults: true, testResults: 'test/sharness/test-results/sharness.xml'
143 + timeout(time: sharness_timeout, unit: 'MINUTES') {
144 + run 'go get -v github.com/jstemmer/go-junit-report'
145 + run "make gx-deps"
146 +
147 + try {
148 + run "make -j12 -Otarget test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_NO_FUSE=1 TEST_NO_DOCKER=1"
149 + } catch (err) {
150 + throw err
151 + } finally {
152 + junit allowEmptyResults: true, testResults: 'test/sharness/test-results/sharness.xml'
153 + }
154 }
155 }
156 },
157 macOS: {
158 setupStep('macos') { run ->
138 - run 'go get -v github.com/jstemmer/go-junit-report'
139 - run "make gx-deps"
140 -
141 - try {
142 - run test + ' -tags="nofuse" 2>&1 | tee output'
143 - run 'cat output | go-junit-report > junit-report-macos.xml'
144 - } catch (err) {
145 - throw err
146 - } finally {
147 - /* IGNORE TEST FAILS */
148 - /* junit 'junit-report-*.xml' */
159 + timeout(time: gotest_timeout, unit: 'MINUTES') {
160 + run 'go get -v github.com/jstemmer/go-junit-report'
161 + run "make gx-deps"
162 +
163 + try {
164 + run test + ' -tags="nofuse" 2>&1 | tee output'
165 + run 'cat output | go-junit-report > junit-report-macos.xml'
166 + } catch (err) {
167 + throw err
168 + } finally {
169 + /* IGNORE TEST FAILS */
170 + /* junit 'junit-report-*.xml' */
171 + }
172 }
173 }
174 },
175 macSharness: {
176 setupStep('macos') { run ->
154 - run 'go get -v github.com/jstemmer/go-junit-report'
155 - run "make gx-deps"
156 -
157 - try {
158 - run "make -j12 test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_NO_FUSE=1"
159 - } catch (err) {
160 - throw err
161 - } finally {
162 - /* IGNORE TEST FAILS */
163 - /* junit allowEmptyResults: true, testResults: 'test/sharness/test-results/sharness.xml' */
177 + timeout(time: sharness_timeout, unit: 'MINUTES') {
178 + run 'go get -v github.com/jstemmer/go-junit-report'
179 + run "make gx-deps"
180 +
181 + try {
182 + run "make -j12 test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_NO_FUSE=1"
183 + } catch (err) {
184 + throw err
185 + } finally {
186 + /* IGNORE TEST FAILS */
187 + /* junit allowEmptyResults: true, testResults: 'test/sharness/test-results/sharness.xml' */
188 + }
189 }
190 }
191 },