@@ -162,31 +162,6 @@ def getParallelTests(String image) {
162162 }
163163 },
164164
165- ' Build with Bazel' : {
166- node {
167- withDockerContainer(args : ' -u root -v /var/run/docker.sock:/var/run/docker.sock' , image : image) {
168- stage(' Setup Bazel Build' ) {
169- echo " Build with Bazel" ;
170- sh label : ' Configure git' , script : " git config --system --add safe.directory '*'" ;
171- checkout scm;
172- }
173- stage(' Bazel Build' ) {
174- withCredentials([file(credentialsId : ' bazel-cache-sa' , variable : ' GCS_SA_KEY' )]) {
175- timeout(time : 120 , unit : ' MINUTES' ) {
176- def cmd = ' bazelisk test --config=ci --show_timestamps --test_output=errors --curses=no --force_pic'
177-
178- if (env. BRANCH_NAME != ' master' ) {
179- cmd + = ' --remote_upload_local_results=false'
180- }
181-
182- sh label : ' Bazel Build' , script : cmd + ' --google_credentials=$GCS_SA_KEY ...'
183- }
184- }
185- }
186- }
187- }
188- },
189-
190165 ' Check message IDs' : {
191166 dir(' src' ) {
192167 sh label : ' Find duplicated message IDs' , script : ' ../etc/find_messages.py > messages.txt' ;
@@ -274,21 +249,31 @@ def getParallelTests(String image) {
274249 return ret;
275250}
276251
277- node {
278-
279- def isDefaultBranch = (env. BRANCH_NAME == ' master' )
280- def daysToKeep = ' 20' ;
281- def numToKeep = (isDefaultBranch ? ' -1' : ' 10' );
282-
283- properties([
284- buildDiscarder(logRotator(
285- daysToKeepStr : daysToKeep,
286- artifactDaysToKeepStr : daysToKeep,
252+ def bazelTest = {
253+ stage (' Build with Bazel' ) {
254+ node {
255+ stage(' Setup Bazel Build' ) {
256+ checkout scm;
257+ sh label : ' Setup Docker Image' , script : ' docker build -f docker/Dockerfile.bazel -t openroad/bazel-ci .' ;
258+ }
259+ withDockerContainer(args : ' -u root -v /var/run/docker.sock:/var/run/docker.sock' , image : ' openroad/bazel-ci:latest' ) {
260+ stage(' Bazel Build' ) {
261+ withCredentials([file(credentialsId : ' bazel-cache-sa' , variable : ' GCS_SA_KEY' )]) {
262+ timeout(time : 120 , unit : ' MINUTES' ) {
263+ def cmd = ' bazelisk test --config=ci --show_timestamps --test_output=errors --curses=no --force_pic' ;
264+ if (env. BRANCH_NAME != ' master' ) {
265+ cmd + = ' --remote_upload_local_results=false' ;
266+ }
267+ sh label : ' Bazel Build' , script : cmd + ' --google_credentials=$GCS_SA_KEY ...' ;
268+ }
269+ }
270+ }
271+ }
272+ }
273+ }
274+ }
287275
288- numToKeepStr : numToKeep,
289- artifactNumToKeepStr : numToKeep
290- ))
291- ]);
276+ def dockerTests = {
292277 stage(' Checkout' ) {
293278 checkout scm;
294279 }
@@ -317,6 +302,24 @@ node {
317302 echo " Docker image is ${ DOCKER_IMAGE} " ;
318303 }
319304 parallel(getParallelTests(DOCKER_IMAGE ));
305+ }
306+
307+ node {
308+ def isDefaultBranch = (env. BRANCH_NAME == ' master' )
309+ def daysToKeep = ' 20' ;
310+ def numToKeep = (isDefaultBranch ? ' -1' : ' 10' );
311+ properties([
312+ buildDiscarder(logRotator(
313+ daysToKeepStr : daysToKeep,
314+ artifactDaysToKeepStr : daysToKeep,
315+ numToKeepStr : numToKeep,
316+ artifactNumToKeepStr : numToKeep
317+ ))
318+ ]);
319+ parallel(
320+ " Bazel Tests" : bazelTest,
321+ " Docker Tests" : dockerTests
322+ );
320323 stage(' Send Email Report' ) {
321324 sendEmail();
322325 }
0 commit comments