@@ -36,7 +36,7 @@ def gen_simple_windows_jobs(label, script) {
3636 checkout_repo. checkout_repo()
3737 timeout(time : common. perJobTimeout. time,
3838 unit : common. perJobTimeout. unit) {
39- bat script
39+ bat script : script, label : label
4040 }
4141 }
4242 } catch (err) {
@@ -154,12 +154,13 @@ ${extra_setup_code}
154154 unit : common. perJobTimeout. unit) {
155155 try {
156156 if (use_docker) {
157- sh common. docker_script(
157+ sh script : common. docker_script(
158158 platform, " /var/lib/build/steps.sh"
159- )
159+ ), label : " docker run steps.sh # ${ job_name } "
160160 } else {
161161 dir(' src' ) {
162- sh ' ./steps.sh'
162+ sh script : ' ./steps.sh' ,
163+ label : " docker run steps.sh #${ job_name} "
163164 }
164165 }
165166 } finally {
@@ -265,7 +266,8 @@ def gen_abi_api_checking_job(platform) {
265266 /* The credentials here are the SSH credentials for accessing the repositories.
266267 They are defined at {JENKINS_URL}/credentials */
267268 withCredentials([sshUserPrivateKey(credentialsId : credentials_id, keyFileVariable : ' keyfile' )]) {
268- sh " GIT_SSH_COMMAND=\" ssh -i ${ keyfile} \" git fetch origin ${ CHANGE_TARGET} "
269+ sh script : " GIT_SSH_COMMAND=\" ssh -i ${ keyfile} \" git fetch origin ${ CHANGE_TARGET} " ,
270+ label : " git fetch origin ${ CHANGE_TARGET} "
269271 }
270272 writeFile file : ' steps.sh' , text : """ \
271273#!/bin/sh
@@ -283,9 +285,9 @@ scripts/abi_check.py -o FETCH_HEAD -n HEAD -s identifiers --brief
283285 }
284286 timeout(time : common. perJobTimeout. time,
285287 unit : common. perJobTimeout. unit) {
286- sh common. docker_script(
288+ sh script : common. docker_script(
287289 platform, " /var/lib/build/steps.sh"
288- )
290+ ), label : " steps.sh # ${ job_name } "
289291 }
290292 } catch (err) {
291293 failed_builds[job_name] = true
334336 timeout(time : common. perJobTimeout. time,
335337 unit : common. perJobTimeout. unit) {
336338 try {
337- sh common. docker_script(
339+ sh script : common. docker_script(
338340 platform, " /var/lib/build/steps.sh"
339- )
341+ ), label : " steps.sh # ${ job_name } "
340342 dir(' src' ) {
341343 String coverage_log = readFile(' coverage-summary.txt' )
342344 coverage_details[' coverage' ] = coverage_log. substring(
@@ -392,7 +394,7 @@ def gen_mbed_os_example_job(repo, branch, example, compiler, platform, raas) {
392394 try {
393395 deleteDir()
394396/* Create python virtual environment and install mbed tools */
395- sh """ \
397+ sh label : " virtualenv # ${ job_name } " , script : """ \
396398ulimit -f 20971520
397399virtualenv $WORKSPACE /mbed-venv
398400. $WORKSPACE /mbed-venv/bin/activate
@@ -406,7 +408,7 @@ pip install mbed-host-tests
406408/* If the job is targeting an example repo, then we wish to use the versions
407409 * of Mbed OS, TLS and Crypto specified by the mbed-os.lib file. */
408410 if (env. TARGET_REPO == ' example' ) {
409- sh """ \
411+ sh label : " mbed deploy # ${ job_name } " , script : """ \
410412ulimit -f 20971520
411413. $WORKSPACE /mbed-venv/bin/activate
412414mbed config root .
@@ -418,7 +420,7 @@ mbed deploy -vv
418420 * checking it out twice. Mbed deploy is still run in case other libraries
419421 * are required to be deployed. We then check out Mbed OS, TLS and Crypto
420422 * according to the job parameters. */
421- sh """ \
423+ sh label : " rm mbed-os.lib; mbed deploy # ${ job_name } " , script : """ \
422424ulimit -f 20971520
423425. $WORKSPACE /mbed-venv/bin/activate
424426rm -f mbed-os.lib
@@ -429,7 +431,7 @@ mbed deploy -vv
429431 deleteDir()
430432 checkout_repo. checkout_mbed_os()
431433/* Check that python requirements are up to date */
432- sh """ \
434+ sh label : " pip install # ${ job_name } " , script : """ \
433435ulimit -f 20971520
434436. $WORKSPACE /mbed-venv/bin/activate
435437pip install -r requirements.txt
@@ -443,14 +445,14 @@ pip install -r requirements.txt
443445 if (example == ' atecc608a' ) {
444446 tag_filter = " --tag-filters HAS_CRYPTOKIT"
445447 }
446- sh """ \
448+ sh label : " mbed compile # ${ job_name } " , script : """ \
447449ulimit -f 20971520
448450. $WORKSPACE /mbed-venv/bin/activate
449451mbed compile -m ${ platform} -t ${ compiler}
450452"""
451453 for (int attempt = 1 ; attempt <= 3 ; attempt++ ) {
452454 try {
453- sh """ \
455+ sh label : " mbedhtrun # ${ job_name } # ${ attempt } " , script : """ \
454456ulimit -f 20971520
455457if [ -e BUILD/${ platform} /${ compiler} /${ example} .bin ]
456458then
@@ -573,7 +575,9 @@ def gen_dockerfile_builder_job(platform, overwrite=false) {
573575 node(' dockerfile-builder' ) {
574576 def image_exists = false
575577 if (! overwrite) {
576- image_exists = sh(script : check_docker_image, returnStatus : true ) == 0
578+ image_exists = sh(script : check_docker_image,
579+ label : " check_docker_image ${ tag} " ,
580+ returnStatus : true ) == 0
577581 }
578582 if (overwrite || ! image_exists) {
579583 dir(' docker' ) {
@@ -585,7 +589,7 @@ def gen_dockerfile_builder_job(platform, overwrite=false) {
585589 extra_build_args
= ' --build-arg [email protected] ' 586590
587591 withCredentials([string(credentialsId : ' DOCKER_AUTH' , variable : ' TOKEN' )]) {
588- sh """ \
592+ sh label : " >.docker/config.json # ${ platform } " , script : """ \
589593mkdir -p ${ env.HOME} /.docker
590594cat > ${ env.HOME} /.docker/config.json << EOF
591595{
@@ -600,12 +604,12 @@ chmod 0600 ${env.HOME}/.docker/config.json
600604"""
601605 }
602606 } else {
603- sh """ \
607+ sh label : " docker login # ${ platform } " , script : """ \
604608aws ecr get-login-password | docker login --username AWS --password-stdin $common . docker_ecr
605609"""
606610 }
607611
608- sh """ \
612+ sh label : " docker push # ${ tag } " , script : """ \
609613# Use BuildKit and a remote build cache to pull only the reuseable layers
610614# from the last successful build for this platform
611615DOCKER_BUILDKIT=1 docker build \
0 commit comments