Skip to content

Commit 1eb8608

Browse files
authored
[ci] Favor direct mage invocation on CI (elastic#19960) (elastic#20153)
1 parent 07b60b8 commit 1eb8608

File tree

13 files changed

+199
-61
lines changed

13 files changed

+199
-61
lines changed

.travis.yml

+118-28
Original file line numberDiff line numberDiff line change
@@ -37,49 +37,85 @@ jobs:
3737

3838
# Filebeat
3939
- os: linux
40-
env: TARGETS="-C filebeat testsuite"
40+
before_install: .ci/scripts/travis_has_changes.sh filebeat libbeat || travis_terminate 0
41+
env:
42+
- PROJECT=filebeat
43+
- MAGE='build test'
4144
go: $TRAVIS_GO_VERSION
4245
stage: test
4346
- os: osx
44-
env: TARGETS="TEST_ENVIRONMENT=0 -C filebeat testsuite"
47+
before_install: .ci/scripts/travis_has_changes.sh filebeat libbeat || travis_terminate 0
48+
env:
49+
- PROJECT=filebeat
50+
- MAGE='build unitTest'
4551
go: $TRAVIS_GO_VERSION
4652
stage: test
4753
- os: linux
48-
env: TARGETS="-C x-pack/filebeat testsuite"
54+
before_install: .ci/scripts/travis_has_changes.sh x-pack/filebeat filebeat libbeat || travis_terminate 0
55+
env:
56+
- PROJECT=x-pack/filebeat
57+
- MAGE='build test'
4958
go: $(GO_VERSION)
5059
stage: test
5160

5261
# Heartbeat
5362
- os: linux
54-
env: TARGETS="-C heartbeat testsuite"
63+
before_install: .ci/scripts/travis_has_changes.sh heartbeat libbeat || travis_terminate 0
64+
env:
65+
- PROJECT=heartbeat
66+
- MAGE='build test'
5567
go: $TRAVIS_GO_VERSION
5668
stage: test
5769
- os: osx
58-
env: TARGETS="TEST_ENVIRONMENT=0 -C heartbeat testsuite"
70+
before_install: .ci/scripts/travis_has_changes.sh heartbeat libbeat || travis_terminate 0
71+
env:
72+
- PROJECT=heartbeat
73+
- MAGE='build unitTest'
5974
go: $TRAVIS_GO_VERSION
6075
stage: test
6176

6277
# Auditbeat
6378
- os: linux
64-
env: TARGETS="-C auditbeat testsuite"
79+
before_install: .ci/scripts/travis_has_changes.sh auditbeat libbeat || travis_terminate 0
80+
env:
81+
- PROJECT=auditbeat
82+
- MAGE='build test'
6583
go: $TRAVIS_GO_VERSION
6684
stage: test
6785
- os: osx
68-
env: TARGETS="TEST_ENVIRONMENT=0 -C auditbeat testsuite"
86+
before_install: .ci/scripts/travis_has_changes.sh auditbeat libbeat || travis_terminate 0
87+
env:
88+
- PROJECT=auditbeat
89+
- MAGE='build unitTest'
6990
go: $TRAVIS_GO_VERSION
7091
stage: test
7192
- os: linux
7293
env: TARGETS="-C auditbeat crosscompile"
7394
go: $TRAVIS_GO_VERSION
7495
stage: test
7596
- os: linux
76-
env: TARGETS="-C x-pack/auditbeat testsuite"
97+
before_install: .ci/scripts/travis_has_changes.sh x-pack/auditbeat auditbeat libbeat || travis_terminate 0
98+
env:
99+
- PROJECT=x-pack/auditbeat
100+
- MAGE='build test'
101+
go: $TRAVIS_GO_VERSION
102+
stage: test
103+
- os: osx
104+
before_install: .ci/scripts/travis_has_changes.sh x-pack/auditbeat auditbeat libbeat || travis_terminate 0
105+
env:
106+
- PROJECT=x-pack/auditbeat
107+
- MAGE='build unitTest'
77108
go: $TRAVIS_GO_VERSION
78109
stage: test
79110

80111
# Libbeat
81112
- os: linux
82-
env: TARGETS="-C libbeat testsuite"
113+
before_install: .ci/scripts/travis_has_changes.sh libbeat || travis_terminate 0
114+
env:
115+
- PROJECT=libbeat
116+
- MAGE='build test'
117+
# The libbeat tests are so verbose that they exceed the maximum allowed log length of Travis CI.
118+
- MAGEFILE_VERBOSE=false
83119
go: $TRAVIS_GO_VERSION
84120
stage: test
85121
- os: linux
@@ -91,58 +127,86 @@ jobs:
91127
go: $TRAVIS_GO_VERSION
92128
stage: test
93129
- os: linux
94-
env: TARGETS="-C x-pack/libbeat testsuite"
130+
before_install: .ci/scripts/travis_has_changes.sh x-pack/libbeat libbeat || travis_terminate 0
131+
env:
132+
- PROJECT=x-pack/libbeat
133+
- MAGE='build test'
95134
go: $TRAVIS_GO_VERSION
96135
stage: test
97136

98137
# Metricbeat
99138
- os: linux
100-
env: TARGETS="-C metricbeat unit-tests"
139+
before_install: .ci/scripts/travis_has_changes.sh metricbeat libbeat || travis_terminate 0
140+
env:
141+
- PROJECT=metricbeat
142+
- MAGE='build unitTest'
101143
go: $TRAVIS_GO_VERSION
102144
stage: test
103145
- os: linux
104146
before_install: .ci/scripts/travis_has_changes.sh metricbeat libbeat || travis_terminate 0
105-
install:
147+
install:
106148
- .ci/scripts/install-kind.sh
107149
- .ci/scripts/install-kubectl.sh
108150
env:
109-
- TARGETS="-C metricbeat integration-tests"
110151
- K8S_VERSION=v1.17.2
111152
- KIND_VERSION=v0.7.0
153+
- PROJECT=metricbeat
154+
- MAGE='goIntegTest'
112155
go: $TRAVIS_GO_VERSION
113156
stage: test
114157
- os: linux
115-
env: TARGETS="-C metricbeat system-tests"
158+
before_install: .ci/scripts/travis_has_changes.sh metricbeat libbeat || travis_terminate 0
159+
env:
160+
- PROJECT=metricbeat
161+
- MAGE='pythonIntegTest'
116162
go: $TRAVIS_GO_VERSION
117163
stage: test
118164
- os: osx
119-
env: TARGETS="-C metricbeat testsuite"
165+
before_install: .ci/scripts/travis_has_changes.sh metricbeat libbeat || travis_terminate 0
166+
env:
167+
- PROJECT=metricbeat
168+
- MAGE='build unitTest'
120169
go: $TRAVIS_GO_VERSION
121170
stage: test
122171
- os: linux
123172
env: TARGETS="-C metricbeat crosscompile"
124173
go: $TRAVIS_GO_VERSION
125174
stage: test
126175
- os: linux
127-
env: TARGETS="-C x-pack/metricbeat unit-tests"
176+
before_install: .ci/scripts/travis_has_changes.sh x-pack/metricbeat metricbeat libbeat || travis_terminate 0
177+
env:
178+
- PROJECT=x-pack/metricbeat
179+
- MAGE='build unitTest'
128180
go: $TRAVIS_GO_VERSION
129181
stage: test
130182
- os: linux
131-
env: TARGETS="-C x-pack/metricbeat integration-tests"
183+
before_install: .ci/scripts/travis_has_changes.sh x-pack/metricbeat metricbeat libbeat || travis_terminate 0
184+
env:
185+
- PROJECT=x-pack/metricbeat
186+
- MAGE='goIntegTest'
132187
go: $TRAVIS_GO_VERSION
133188
stage: test
134189
- os: linux
135-
env: TARGETS="-C x-pack/metricbeat system-tests"
190+
before_install: .ci/scripts/travis_has_changes.sh x-pack/metricbeat metricbeat libbeat || travis_terminate 0
191+
env:
192+
- PROJECT=x-pack/metricbeat
193+
- MAGE='pythonIntegTest'
136194
go: $TRAVIS_GO_VERSION
137195
stage: test
138196
- os: osx
139-
env: TARGETS="-C x-pack/metricbeat testsuite"
197+
before_install: .ci/scripts/travis_has_changes.sh metricbeat libbeat || travis_terminate 0
198+
env:
199+
- PROJECT=x-pack/metricbeat
200+
- MAGE='build unitTest'
140201
go: $TRAVIS_GO_VERSION
141202
stage: test
142203

143204
# Packetbeat
144205
- os: linux
145-
env: TARGETS="-C packetbeat testsuite"
206+
before_install: .ci/scripts/travis_has_changes.sh packetbeat libbeat || travis_terminate 0
207+
env:
208+
- PROJECT=packetbeat
209+
- MAGE='build test'
146210
go: $TRAVIS_GO_VERSION
147211
stage: test
148212

@@ -154,40 +218,58 @@ jobs:
154218

155219
# Functionbeat
156220
- os: linux
157-
env: TARGETS="-C x-pack/functionbeat testsuite"
221+
before_install: .ci/scripts/travis_has_changes.sh x-pack/functionbeat libbeat || travis_terminate 0
222+
env:
223+
- PROJECT=x-pack/functionbeat
224+
- MAGE='build test'
158225
go: $TRAVIS_GO_VERSION
159226
stage: test
160227
- os: osx
161-
env: TARGETS="TEST_ENVIRONMENT=0 -C x-pack/functionbeat testsuite"
228+
before_install: .ci/scripts/travis_has_changes.sh x-pack/functionbeat libbeat || travis_terminate 0
229+
env:
230+
- PROJECT=x-pack/functionbeat
231+
- MAGE='build unitTest'
162232
go: $TRAVIS_GO_VERSION
163233
stage: test
164234
- os: linux
165235
before_install: .ci/scripts/travis_has_changes.sh x-pack/functionbeat libbeat || travis_terminate 0
166-
env: TARGETS="-C x-pack/functionbeat test-gcp-functions"
236+
env:
237+
- PROJECT=x-pack/functionbeat
238+
- MAGE='testGCPFunctions'
167239
go: 1.13.1
168240
stage: test
169241

170242
# Docker Log Driver
171243
- os: linux
172-
env: TARGETS="-C x-pack/dockerlogbeat testsuite"
244+
before_install: .ci/scripts/travis_has_changes.sh x-pack/dockerlogbeat libbeat || travis_terminate 0
245+
env:
246+
- PROJECT=x-pack/dockerlogbeat
247+
- MAGE='build test'
173248
go: $TRAVIS_GO_VERSION
174249
stage: test
175250

176251
# Journalbeat
177252
- os: linux
178-
env: TARGETS="-C journalbeat testsuite"
253+
before_install: .ci/scripts/travis_has_changes.sh journalbeat libbeat || travis_terminate 0
254+
env:
255+
- PROJECT=journalbeat
256+
- MAGE='build goUnitTest'
179257
go: $TRAVIS_GO_VERSION
180258
stage: test
181259

182260
# Agent
183261
- os: linux
184262
before_install: .ci/scripts/travis_has_changes.sh x-pack/elastic-agent libbeat || travis_terminate 0
185-
env: TARGETS="-C x-pack/elastic-agent testsuite"
263+
env:
264+
- PROJECT=x-pack/elastic-agent
265+
- MAGE='build test'
186266
go: $TRAVIS_GO_VERSION
187267
stage: test
188268
- os: osx
189269
before_install: .ci/scripts/travis_has_changes.sh x-pack/elastic-agent libbeat || travis_terminate 0
190-
env: TARGETS="TEST_ENVIRONMENT=0 -C x-pack/elastic-agent testsuite"
270+
env:
271+
- PROJECT=x-pack/elastic-agent
272+
- MAGE='build unitTest'
191273
go: $TRAVIS_GO_VERSION
192274
stage: test
193275

@@ -279,6 +361,7 @@ before_install:
279361
- chmod +x docker-compose
280362
- sudo mv docker-compose /usr/local/bin
281363
- if [ $TRAVIS_OS_NAME = osx ]; then pip install virtualenv==16.7.9; fi
364+
- make mage
282365

283366

284367
# Skips installations step
@@ -289,7 +372,14 @@ script:
289372
# Default Travis timeout is 10min, so this workaround prints timestamps every 9min to reset the counter.
290373
# Using seconds (540s = 9min) instead of minutes for shell compatibility reasons.
291374
- while sleep 540; do echo "=====[ ${SECONDS} seconds still running ]====="; done &
292-
- make $TARGETS
375+
- if [[ -n "$MAGE" ]]; then
376+
echo ">> mage $MAGE from $PROJECT";
377+
cd "$PROJECT";
378+
mage $MAGE;
379+
else
380+
echo ">> make $TARGETS";
381+
make $TARGETS;
382+
fi
293383
- kill %1
294384

295385
notifications:

0 commit comments

Comments
 (0)