11@Library (' utils@or-v2.0.1' ) _
22
3+ def logHostname () {
4+ sh label : " Running on ${ env.NODE_NAME} " , script : " echo 'Node context established.'"
5+ }
6+
37def baseTests (String image ) {
48 Map base_tests = [failFast : false ];
59
@@ -43,6 +47,7 @@ def baseTests(String image) {
4347 flow_tests. each { current_test ->
4448 base_tests[" Flow Test - ${ current_test} " ] = {
4549 node {
50+ logHostname()
4651 withDockerContainer(args : ' -u root' , image : image) {
4752 stage(" Setup ${ current_test} " ) {
4853 sh label : ' Configure git' , script : " git config --system --add safe.directory '*'" ;
@@ -78,6 +83,7 @@ def getParallelTests(String image) {
7883 def ret = [
7984 ' Docs Tester' : {
8085 node {
86+ logHostname()
8187 withDockerContainer(args : ' -u root' , image : image) {
8288 stage(' Setup Docs Test' ) {
8389 echo " Setting up Docs Tester environment in ${ image} " ;
@@ -101,6 +107,7 @@ def getParallelTests(String image) {
101107
102108 ' Build without GUI' : {
103109 node {
110+ logHostname()
104111 withDockerContainer(args : ' -u root' , image : image) {
105112 stage(' Setup no-GUI Build' ) {
106113 echo " Build without GUI" ;
@@ -118,6 +125,7 @@ def getParallelTests(String image) {
118125
119126 ' Build without Test' : {
120127 node {
128+ logHostname()
121129 withDockerContainer(args : ' -u root' , image : image) {
122130 stage(' Setup no-test Build' ) {
123131 echo " Build without Tests" ;
@@ -139,6 +147,7 @@ def getParallelTests(String image) {
139147
140148 ' Build on RHEL8' : {
141149 node (' rhel8' ) {
150+ logHostname()
142151 stage(' Setup RHEL8 Build' ) {
143152 checkout scm;
144153 }
@@ -172,6 +181,7 @@ def getParallelTests(String image) {
172181
173182 ' Unit Tests Ninja' : {
174183 node {
184+ logHostname()
175185 withDockerContainer(args : ' -u root' , image : image) {
176186 stage(' Setup Ninja Tests' ) {
177187 sh label : ' Configure git' , script : " git config --system --add safe.directory '*'" ;
@@ -195,6 +205,7 @@ def getParallelTests(String image) {
195205
196206 ' Compile with C++20' : {
197207 node {
208+ logHostname()
198209 withDockerContainer(args : ' -u root' , image : image) {
199210 stage(' Setup C++20 Compile' ) {
200211 sh label : ' Configure git' , script : " git config --system --add safe.directory '*'" ;
@@ -213,32 +224,38 @@ def getParallelTests(String image) {
213224
214225def bazelTest = {
215226 node {
227+ logHostname()
216228 stage(' Setup' ) {
217229 checkout scm;
218230 sh label : ' Setup Docker Image' , script : ' docker build -f docker/Dockerfile.bazel -t openroad/bazel-ci .' ;
219231 }
220- withDockerContainer(args : ' -u root -v /var/run/docker.sock:/var/run/docker.sock' , image : ' openroad/bazel-ci:latest' ) {
221- stage(' bazelisk test ...' ) {
222- withCredentials([string(credentialsId : ' bazel-auth-token-b64' , variable : ' BAZEL_AUTH_TOKEN_B64' )]) {
223- timeout(time : 120 , unit : ' MINUTES' ) {
224- def cmd = ' bazelisk test --config=ci --show_timestamps --test_output=errors --curses=no --force_pic --remote_header="Authorization=Basic $BAZEL_AUTH_TOKEN_B64" --profile=build.profile'
225- try {
226- try {
227- sh label : ' Test, using cached results and building a minimum of dependencies' , script : cmd + ' ...' ;
228- } finally {
229- sh label : ' Analyze build times' , script : ' bazelisk analyze-profile build.profile' ;
230- }
231- } catch (e) {
232- currentBuild. result = ' FAILURE' ;
232+ try {
233+ withDockerContainer(args : ' -u root -v /var/run/docker.sock:/var/run/docker.sock' , image : ' openroad/bazel-ci:latest' ) {
234+ stage(' bazelisk test ...' ) {
235+ withCredentials([string(credentialsId : ' bazel-auth-token-b64' , variable : ' BAZEL_AUTH_TOKEN_B64' )]) {
236+ timeout(time : 120 , unit : ' MINUTES' ) {
237+ def cmd = ' bazelisk test --config=ci --show_timestamps --test_output=errors --curses=no --force_pic --remote_header="Authorization=Basic $BAZEL_AUTH_TOKEN_B64" --profile=build.profile'
233238 try {
234- sh label : ' Test (keep_going)' , script : cmd + ' --keep_going ...' ;
235- } finally {
236- sh label : ' Analyze build times' , script : ' bazelisk analyze-profile build.profile' ;
239+ try {
240+ sh label : ' Test, using cached results and building a minimum of dependencies' , script : cmd + ' ...' ;
241+ } finally {
242+ sh label : ' Analyze build times' , script : ' bazelisk analyze-profile build.profile' ;
243+ }
244+ } catch (e) {
245+ try {
246+ sh label : ' Test (keep_going)' , script : cmd + ' --keep_going ...' ;
247+ } catch (e2) {
248+ currentBuild. result = ' FAILURE' ;
249+ } finally {
250+ sh label : ' Analyze build times' , script : ' bazelisk analyze-profile build.profile' ;
251+ }
237252 }
238253 }
239254 }
240255 }
241256 }
257+ } catch (IOException e) {
258+ echo " Caught: ${ e} " ;
242259 }
243260 }
244261}
@@ -260,6 +277,7 @@ def dockerTests = {
260277 test_os. each { os ->
261278 build_docker_images[" Test Installer - ${ os.name} " ] = {
262279 node {
280+ logHostname()
263281 checkout scm;
264282 sh label : ' Build Docker image' , script : " ./etc/DockerHelper.sh create -target=builder -os=${ os.image} " ;
265283 sh label : ' Test Docker image' , script : " ./etc/DockerHelper.sh test -target=builder -os=${ os.image} -smoke" ;
0 commit comments