aboutsummaryrefslogtreecommitdiff
path: root/tcwg_bmk-code_size-spec2k6--llvm.yaml
blob: 24872ec8335a69e0fe7d79fd716a1d97e9c1f46d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
# Auto generated by ./tcwg/generate-yamlfiles.sh from tcwg_bmk.yaml.in and tcwg_bmk/tcwg_bmk-code_size-spec2k6--llvm.def. Do not edit.
# Beware: git branch names need the 'refs/heads/' prefix, while tags need 'refs/tags/'
- project:
    name: tcwg_bmk-code_size-spec2k6-llvm
    llvm_url: https://github.com/llvm/llvm-project.git

    toolchain_name: llvm

    # BMK defined in def files
    bmk:
      - spec2k6

    target:
      - arm:
          docker_arch: armhf
      - aarch64:
          docker_arch: arm64


    # PROFILE_NAME defined in def files
    cflags:
      - Os
      - Os_LTO
      - Oz
      - Oz_LTO

    jobs:
      - 'tcwg_bmk-llvm-master'


- job-group:
    name: tcwg_bmk-llvm-master
    toolchain_ver: master
    llvm_branch: refs/heads/main
    distro: default
    cron_schedule: 'H H H/3 * *'
    jobs:
      - 'tcwg_bmk-code_size-spec2k6--llvm-{target}-{toolchain_ver}-{cflags}-build'
      - 'tcwg_bmk-code_size-spec2k6--llvm-{target}-{toolchain_ver}-{cflags}-bisect'
    ci_project: 'tcwg_bmk-code_size-spec2k6'
    ci_config: 'llvm-{target}-{toolchain_ver}-{cflags}'

#BEGIN: tcwg/round-robin.yaml.inc
# -*- mode: Yaml -*-

#BEGIN: tcwg/default.yaml.inc
# -*- mode: Yaml -*-

- property:
    name: default-properties
    properties:
      - authorization:
          anonymous:
            - job-read
            - job-extended-read
          everyone-flat:
            - job-build
            - job-cancel
      - build-discarder:
          days-to-keep: 30

- scm:
    name: jenkins-scripts
    scm:
      - git:
          url: https://git.linaro.org/toolchain/jenkins-scripts.git
          refspec: +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*
          branches:
            - $scripts_branch
          basedir: jenkins-scripts
          skip-tag: true
          reference-repo: /home/tcwg-buildslave/snapshots-ref/jenkins-scripts.git
          wipe-workspace: false
          clean:
            before: true
          prune: true

- scm:
    name: bmk-scripts
    scm:
      - git:
          url: https://git.linaro.org/toolchain/bmk-scripts.git
          refspec: +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*
          branches:
            - $bmk_branch
          basedir: bmk-scripts
          skip-tag: true
          reference-repo: /home/tcwg-buildslave/snapshots-ref/bmk-scripts.git
          wipe-workspace: false
          clean:
            before: true
          prune: true
#END:   tcwg/default.yaml.inc

- parameter:
    name: default-parameters
    parameters:
      - string:
          name: extra_build_params
          default: ""
          description: "Extra parameters to pass to the build script; can be used to override settings extracted from ci_project/ci_config"
      - string:
          name: distro
          default: '{distro}'
          description: 'Distro image to use'
      - string:
          name: scripts_branch
          default: master
          description: 'Scripts revision to use'
      - string:
          name: bmk_branch
          default: master
          description: 'Benchmark scripts revision to use'

- parameter:
    name: component-parameters
    parameters:
      - string:
          name: '{component}_git'
          default: '{default_git}'
          description: "{component} git_url#branch/sha1 to build, or 'default', 'baseline' or 'jenkins-scm', or pw://series/<id> to build with patches from patchwork ('precommit' mode, use 'pw://series/<id>/retrigger/' to force a rebuild)"

- parameter:
    name: all-component-parameters
    parameters:
      - component-parameters:
          component: llvm
          default_git: '{default_git}'

- parameter:
    name: build-parameters
    parameters:
      - all-component-parameters:
          default_git: '{default_git}'
      - choice:
          name: update_baseline
          choices:
            - onsuccess
            - force
            - init
            - ignore
          description: "What to do with baseline in this build"
      - choice:
          name: notify
          choices:
            - ignore
            - onregression
            - precommit
          description: "Whether to notify developers about the result of this build"
      - default-parameters:
          distro: '{distro}'


- property:
    name: build-properties
    properties:
      - default-properties
      - build-blocker:
          blocking-jobs:
            - '{ci_project}--{ci_config}-bisect'
          queue-scanning: 'ALL'


- property:
    name: bisect-properties
    properties:
      - default-properties
      - build-blocker:
          # Run at most 1 bisect job for all configurations.
          # Bisect jobs can easily run for 5+ hours, and a few of them
          # can hog the entire TCWG build farm for a long time.  Since
          # same regression tends to appear in multiple configurations,
          # run bisections for all configurations in-order.
          blocking-jobs:
            # We can't have same regressions between GNU and LLVM toolchains,
            # do allow parallel bisections of those.
            - '{ci_project}--llvm-.*-bisect'
          queue-scanning: 'BUILDABLE'

# Beware: git branch names need the 'refs/heads/' prefix while tags
# need 'refs/tags/'.
- scm:
    name: component-scm
    scm:
        - git:
            url: '{url}'
            branches:
              - '{branch}'
            basedir: '{component}'
            skip-tag: true
            reference-repo: '/home/tcwg-buildslave/snapshots-ref/{reference}'
            wipe-workspace: false
            clean:
              before: true
            prune: true

# SCMs must start with jenkins-scripts and then be ordered alphabetically.
# Same alphabetical order must be followed in .def files.  The reason behind
# this is that jenkins sets $GIT_COMMIT to sha1 of jenkins-scripts, and then
# sets $GIT_COMMIT_1, $GIT_COMMIT_2, etc. to sha1s of component SCM /in the
# order that they are declared here/.
- scm:
    name: build-scms
    scm:
      - jenkins-scripts
      - component-scm:
          component: llvm
          url: '{llvm_url}'
          branch: '{llvm_branch}'
          reference: llvm-project.git
      - bmk-scripts

- wrapper:
    name: build-wrappers
    wrappers:
      - timeout:
          timeout: '{timeout}'
      - timestamps
      - ssh-agent-credentials:
          # tcwg-buildslave user id
          users:
            - 'e0958a95-204f-4c14-a66c-5e2be6c5d50a'
      - credentials-binding:
          - text:
              credential-id: TCWG_JIRA_TOKEN
              variable: TCWG_JIRA_TOKEN

- builder:
    name: trigger-followup-builds-1
    builders:
      - shell: |
          #!/bin/bash
          source artifacts/jenkins/run-build.env
          set -ex

          for i in artifacts/trigger-build-* artifacts/trigger-bisect; do
            if [ -f $i ]; then
              echo "distro=$distro" >> $i
              echo "scripts_branch=$scripts_branch" >> $i
              echo "bmk_branch=$bmk_branch" >> $i
            fi
          done

          trap "" EXIT

- builder:
    name: trigger-followup-builds-2
    builders:
      - trigger-builds:
          - project: '{ci_project}--{ci_config}-build'
            parameter-factories:
              - factory: filebuild
                file-pattern: artifacts/trigger-build-*
          - project: '{ci_project}--{ci_config}-bisect'
            property-file: artifacts/trigger-bisect

- builder:
    name: run-build-notify
    builders:
      - shell: |
          #!/bin/bash
          source artifacts/jenkins/run-build.env
          set -ex

          if [ -f artifacts/failed ]; then
            # Only send notifications for forced successful
            # (aka "onregression") builds; never for failed builds.
            echo "Build failed. Using option notify=ignore."
            notify=ignore
          fi

          # Basic notification -- create entry in interesting-commits.
          # Note that we add --notify to the manifest -- we will need this
          # later in round-robin-baseline.sh when re-writing history
          # to update notifications files in interesting-commits and jira.
          build_container_exec \
            ./jenkins-scripts/round-robin-notify.sh \
            @@rr[top_artifacts] artifacts --notify "$notify" \
            __stage init __verbose true \
            __build_script {build_script} \
            &> ./artifacts/jenkins/notify-init.log &

          if ! wait $!; then
            echo "maxim.kuvyrkov@linaro.org, laurent.alfonsi@linaro.org" \
              > artifacts/jenkins/error-mail-recipients.txt
            echo -e "$BUILD_URL\nERROR: notify-init failed\n" \
              >> artifacts/jenkins/error-mail-body.txt
            echo "ERROR: notify-init failed"
            exit 1
          fi

          # Full notification
          echo "NOTE: Notify developers about this build"

          build_container_exec \
            ./jenkins-scripts/round-robin-notify.sh \
            @@rr[top_artifacts] artifacts __stage full __verbose true \
            __build_script {build_script} \
            &> ./artifacts/jenkins/notify-full.log &

          if ! wait $!; then
            echo "maxim.kuvyrkov@linaro.org, laurent.alfonsi@linaro.org" \
              > artifacts/jenkins/error-mail-recipients.txt
            echo -e "$BUILD_URL\nERROR: notify-full failed\n" \
              >> artifacts/jenkins/error-mail-body.txt
            echo "ERROR: notify-full failed"
          fi

          # Failsafe for avoid spamming developers.
          if [ "$notify" = "ignore" ] \
            && [ -f artifacts/jenkins/mail-recipients.txt ]; then
            echo "maxim.kuvyrkov@linaro.org, laurent.alfonsi@linaro.org" \
              > artifacts/jenkins/error-mail-recipients.txt
            echo -e "$BUILD_URL\nERROR: tried to unexpectedly notify developers\n" \
              >> artifacts/jenkins/error-mail-body.txt
            mv artifacts/jenkins/mail-recipients.txt \
            artifacts/jenkins/mail-recipients.bak
          fi

          trap "" EXIT

- builder:
    name: run-exit-on-failure
    builders:
      - shell: |
          #!/bin/bash
          source artifacts/jenkins/run-build.env
          set -ex

          if [ -f artifacts/failed ]; then
            # Mark failed build as FAILURE; no further steps will run.
            exit $(cat artifacts/failed)
          fi
          # Only successful builds run beyond this point.

          trap "" EXIT

- builder:
    name: run-push-baseline
    builders:
      - shell: |
          #!/bin/bash
          source artifacts/jenkins/run-build.env
          set -ex

          # Update baseline branch of base-artifacts.
          # If we made it this far, then the build is successful
          # (possibly because it was forced to be declared successful).
          if [ "$update_baseline" = "ignore" ]; then
            trap "" EXIT
            exit 0
          fi

          # We may need jira token while rewriting history.
          if [ -f $HOME/.jipdate.yml ]; then
            (
              # BE CAREFUL WITH TCWG_JIRA_TOKEN
              set +x
              build_container_exec \
                sed -i -e "s/#TCWG_JIRA_TOKEN#/$TCWG_JIRA_TOKEN/" \
                "$HOME/.jipdate.yml"
            )
          fi

          build_container_exec \
            ./jenkins-scripts/round-robin-baseline.sh \
            @@rr[top_artifacts] artifacts \
            __build_script {build_script} \
            __push_base_artifacts true \
            __rewrite_base_artifacts true \
            __commit_artifacts {commit_artifacts} \
            __rewrite_num 100 \
            &> ./artifacts/jenkins/rewrite.log &

          if ! wait $!; then
            echo "maxim.kuvyrkov@linaro.org, laurent.alfonsi@linaro.org" \
              > artifacts/jenkins/error-mail-recipients.txt
            echo -e "$BUILD_URL\nERROR: round-robin-baseline.sh failed" \
              >> artifacts/jenkins/error-mail-body.txt
            echo "ERROR: round-robin-baseline.sh failed"
            # We have failed to update the baseline, so let's fail and
            # not notify developers.
            exit 1
          fi

          trap "" EXIT

- builder:
    name: run-push-lnt-results
    builders:
     - trigger-builds:
        - project: tcwg-update-lnt-results
          predefined-parameters: |
            ci_project={ci_project}
            ci_config={ci_config}


- builder:
    name: run-build-init
    builders:
      - shell:
          command: |
            #!/bin/bash
            set -ex
            # Delete artifacts now to avoid re-using stale artifacts if
            # below docker-run.sh fails to start up a container.
            rm -rf artifacts/
            mkdir -p artifacts/jenkins

            build_name="#$BUILD_NUMBER"
            echo "$build_name" > artifacts/jenkins/build-name

            if [ "{precommit}" = "True" ]; then
              cat >> artifacts/jenkins/run-build.env <<EOF
            update_baseline=ignore
            EOF
            fi

            cat >> artifacts/jenkins/run-build.env <<EOF
            build_name="$build_name"
            EOF
          unstable-return: 125

- builder:
    name: run-build-skip-if-queue
    builders:
      - shell:
          command: |
            #!/bin/bash
            source artifacts/jenkins/run-build.env
            set -ex

            # Skip SCM-triggered builds if there are other builds in
            # the queue.  We need to process all pending bisection-triggered
            # builds before fetching a new batch of upstream changes.
            # Re. skipping post-commit build if pre-commit queue is
            # not empty -- it's just a favor to pre-commit builds.
            if [ x"${{BUILD_CAUSE_SCMTRIGGER-false}}" = x"true" ] \
              || [ x"${{BUILD_CAUSE_TIMERTRIGGER-false}}" = x"true" ]; then
              for job_type in build; do
                url="${{JOB_URL%-build/}}-$job_type"
                inQueue=$(curl -s "$url/api/xml?tree=inQueue" \
                  | sed -e "s#.*<inQueue>\(.*\)</inQueue>.*#\1#")
                if [ "$inQueue" != "false" ]; then
                  echo "SKIP SCM BUILD"
                  touch artifacts/jenkins/skip-scm-build
                  build_name="$build_name-skip-scm-build"
                  echo "$build_name" > artifacts/jenkins/build-name

                  # Mark build unstable aka a skipped build
                  exit 125
                fi
              done
            fi

            trap "" EXIT
          unstable-return: 125

- builder:
    name: run-build-start-manifest
    builders:
      - shell:
          command: |
            #!/bin/bash
            source artifacts/jenkins/run-build.env
            set -ex

            docker_opts=(
              --distro $distro
              --arch {docker_arch}
              --node $NODE_NAME
              --ssh_info true
            )

            ./jenkins-scripts/start-container-docker.sh --prefix build_ \
              "${{docker_opts[@]}}" > build_container.sh
            source build_container.sh
            trap "cleanup_all_containers" EXIT

            # Run the build script to fetch base-artifacts/, which are
            # required to fetch baseline sources to apply patches to in
            # pw-apply.sh below.  This also initializes the build manifest
            # with all below settings; we then import this manifest below.
            #
            # The parameter __finish_after makes the build script stop
            # after fetching the baseline and "__" avoids saving this parameter
            # in the manifest, so that we don't see this option in the main
            # run of the build script below.
            build_container_exec \
              ./jenkins-scripts/{build_script} \
              %%rr[top_artifacts] artifacts \
              ==rr[ci_project] '{ci_project}' \
              ==rr[ci_config] '{ci_config}' \
              $extra_build_params \
              --bmk_branch "$bmk_branch" \
              --scripts_branch "$scripts_branch" \
              ==rr[mode] "build" \
              ==rr[update_baseline] "$update_baseline" \
              --BUILD_URL "$BUILD_URL" \
              __finish_at reset_artifacts

            cat >> artifacts/jenkins/run-build.env <<EOF
            docker_opts=(${{docker_opts[@]+$(printf "%q$IFS" "${{docker_opts[@]}}")}})
            source build_container.sh
            trap "cleanup_all_containers" EXIT
            EOF

            # Now that we have "trap cleanup_all_containers EXIT" in
            # run-build.env we need to reset the trap at the end of every
            # step to preserve container[s] for the next step.
            trap "" EXIT
          unstable-return: 125

- builder:
    name: run-build-process-params
    builders:
      - shell:
          command: |
            #!/bin/bash
            source artifacts/jenkins/run-build.env
            set -ex

            branch_opt=()
            # 1 to skip jenkins-scripts
            i=1
            for c in llvm; do
              eval "g=\$$$${{c}}_git"
              if [ x"$g" = x"default" ]; then
                if [ x"${{BUILD_CAUSE_SCMTRIGGER-false}}" = x"true" ] \
                  || [ x"${{BUILD_CAUSE_TIMERTRIGGER-false}}" = x"true" ]; then
                  g="jenkins-scm"
                else
                  g="baseline"
                fi
              fi
              if [ x"$g" = x"jenkins-scm" ]; then
                eval "gb=\$GIT_BRANCH_$i"
                gb=$(echo $gb | sed 's+origin/++')
                eval "g=\$GIT_URL_$i#$gb"
              fi
              i=$(($i+1))

              if [ x"$g" != x"baseline" ]; then
                build_name="$build_name-$c"
                branch_opt+=("==rr[${{c}}_git]" "$g")
              fi
            done

            echo "$build_name" > artifacts/jenkins/build-name

            cat >> artifacts/jenkins/run-build.env <<EOF
            build_name="$build_name"
            branch_opt=(${{branch_opt[@]+$(printf "%q$IFS" "${{branch_opt[@]}}")}})
            EOF

            trap "" EXIT
          unstable-return: 125

- builder:
    name: run-build-main
    builders:
      - shell:
          command: |
            #!/bin/bash
            source artifacts/jenkins/run-build.env
            set -ex

            # Run the build script to from the manifest created above.
            #
            # The parameter __start_at makes the build script start right
            # where the above run finished.  This allows us to use read-only
            # bind-mount for base-artifacts/, which, otherwise, may require
            # multi-gig rsync.
            build_container_exec \
              ./jenkins-scripts/{build_script} \
              @@rr[top_artifacts] artifacts \
              "${{branch_opt[@]}}" \
              __start_at reset_artifacts+ &
            res=0 && wait $! || res=$?

            # Update build_name
            if [ -f artifacts/results ]; then
              build_name="$build_name-R$(tail -n1 artifacts/results)"
            fi
            if [ "$update_baseline" != "onsuccess" ]; then
              build_name="$build_name-$update_baseline"
            fi

            if [ -f artifacts/trigger-bisect ]; then
              build_name="$build_name-trigger-bisect"
            fi
            echo "$build_name" > artifacts/jenkins/build-name

            # Everything but 0 and $INTERNAL_FAILURE is an unexpected exit code,
            # so stop here and do nothing else.  From jenkins point of view ...
            # - if $res==0: build is successful, so proceed with all
            #   followup steps -- notify, push, trigger precommit.
            # - if $res==123: build has a regression, so proceed with triggering
            #   followup builds and sending precommit notifications; but stop
            #   before run-push-baseline by checking artifacts/failed.
            # - if $res is anything else: build has an unexpected failure, so
            #   skip the rest of the steps by setting UNSTABLE build status.
            #   This will cause all followup conditional-steps to skip due to
            #   "current-status" condition.
            #
            # See comment before round-robin.sh:check_regression() for details.
            case $res in
              0)
                ;;
              123)
                echo 123 > artifacts/failed
                ;;
              *)
                res=125
                ;;
            esac

            if [ $res = 125 ]; then
              # We had unexpected failure in the build scripts, so can't
              # proceed with triggers and notifications.  Mark this build
              # as UNSTABLE, which will skip all following conditional-steps.
              exit 125
            fi

            cat >> artifacts/jenkins/run-build.env <<EOF
            build_name="$build_name"
            EOF

            trap "" EXIT
          unstable-return: 125

- builder:
    name: run-build-fini
    builders:
      - shell:
          command: |
            #!/bin/bash
            source artifacts/jenkins/run-build.env
            set -ex
            # The "trap cleanup_all_containers EXIT" statement in
            # artifacts/jenkins/run-build.env will remove build and precommit
            # containers.

- builder:
    name: run-build
    builders:
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-build-init:
                precommit: false
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-build-skip-if-queue:
                dummy: dummy
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-build-start-manifest:
                ci_project: '{ci_project}'
                ci_config: '{ci_config}'
                build_script: '{build_script}'
                docker_arch: '{docker_arch}'
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-build-process-params:
                dummy: dummy
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-push-baseline:
                build_script: '{build_script}'
                commit_artifacts: 'false'
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-build-main:
                build_script: '{build_script}'
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - trigger-followup-builds-1:
                dummy: dummy
            - trigger-followup-builds-2:
                ci_project: '{ci_project}'
                ci_config: '{ci_config}'
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-build-notify:
                build_script: '{build_script}'
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-exit-on-failure:
                dummy: dummy
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-push-baseline:
                build_script: '{build_script}'
                commit_artifacts: 'true'
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-push-lnt-results:
                ci_project: '{ci_project}'
                ci_config: '{ci_config}'
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - run-build-fini:
                dummy: dummy


- publisher:
    name: build-publishers
    publishers:
      - archive:
          artifacts: 'artifacts/**'
          latest-only: false
      - html-publisher:
          name: 'HTML Report'
          dir: 'artifacts/jenkins'
          files: 'status.html'
          keep-all: true
      - email-ext:
          recipients: |
            ${{FILE,path="artifacts/jenkins/mail-recipients.txt"}}
          reply-to: linaro-toolchain@lists.linaro.org
          subject: |
            ${{FILE,path="artifacts/jenkins/mail-subject.txt"}}
          content-type: text
          body: |
            ${{FILE,path="artifacts/jenkins/mail-body.txt"}}
          failure: {email_on_failure}
          success: {email_on_success}
          aborted: false
          send-to:
            - recipients
      - email-ext:
          recipients: |
            ${{FILE,path="artifacts/jenkins/error-mail-recipients.txt"}}
          body: |
            ${{FILE,path="artifacts/jenkins/error-mail-body.txt"}}
          failure: true
          success: true
          aborted: true
          send-to:
            - recipients

- parameter:
    name: bisect-parameters
    parameters:
      - string:
          name: current_project
          default: ""
          description: "Project to bisect"
      - string:
          name: bad_git
          default: ""
          description: "Bad git_url#branch/SHA1"
      - file:
          name: jenkins-scripts/replay_log
          description: "Replay part of bisect using provided bisect log"
      - default-parameters:
          distro: '{distro}'

- wrapper:
    name: bisect-wrappers
    wrappers:
      - build-wrappers:
          timeout: '{timeout}'

- builder:
    name: run-bisect
    builders:
      - shell:
          command: |
            #!/bin/bash
            set -ex
            # Delete artifacts now to avoid re-using stale artifacts if
            # below docker-run.sh fails to start up a container.
            rm -rf artifacts/
            mkdir -p artifacts/jenkins
            build_name="#$BUILD_NUMBER-$current_project"
            echo "$build_name" > artifacts/jenkins/build-name

            cat >> artifacts/jenkins/run-build.env <<EOF
            build_name="$build_name"
            EOF

            ./jenkins-scripts/docker-run.sh \
              --distro $distro \
              --ssh_info true \
              --arch {docker_arch} \
              --node $NODE_NAME \
              -- \
              ./jenkins-scripts/round-robin-bisect.sh \
              %%rel_artifacts artifacts \
              --BUILD_URL "$BUILD_URL" \
              --current_project "$current_project" \
              --bad_git "$bad_git" \
              --replay_log "$(pwd)/jenkins-scripts/replay_log" \
              --build_script "./jenkins-scripts/{build_script}" \
              -- \
              ==rr[ci_project] '{ci_project}' \
              ==rr[ci_config] '{ci_config}' \
              $extra_build_params \
              --bmk_branch "$bmk_branch" \
              --scripts_branch "$scripts_branch" &
            res=0 && wait $! || res=$?

            if [ $res != 0 ]; then
              echo $res > artifacts/failed
            fi
          unstable-return: 125
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - conditional-step:
          condition-kind: current-status
          steps:
            - trigger-followup-builds-1:
                dummy: dummy
            - trigger-followup-builds-2:
                ci_project: '{ci_project}'
                ci_config: '{ci_config}'
      - conditional-step:
          condition-kind: current-status
          steps:
            - shell: |
                #!/bin/bash
                set -ex

                if [ -f artifacts/failed ]; then
                  # Mark failed build as FAILURE; no further steps will run.
                  exit $(cat artifacts/failed)
                fi

- publisher:
    name: bisect-publishers
    publishers:
      - archive:
          artifacts: 'artifacts/**'
          latest-only: false
      - email-ext:
          recipients: |
            maxim.kuvyrkov@linaro.org, laurent.alfonsi@linaro.org
          failure: true
          success: false
          aborted: true
          send-to:
            - recipients
#END:   tcwg/round-robin.yaml.inc

- job-template:
    name: tcwg_bmk-code_size-spec2k6--llvm-{target}-{toolchain_ver}-{cflags}-build
    project-type: freestyle
    defaults: global
    properties:
      - build-properties:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
    parameters:
      - build-parameters:
          default_git: 'default'
          distro: '{distro}'
    disabled: false
    node: tcwg-build_bmk && tcwg-armv8_64
    concurrent: false
    display-name: 'TCWG Build {ci_project}--{ci_config}'
    workspace: workspace/tcwg_bmk_$EXECUTOR_NUMBER
    scm:
      - build-scms:
          llvm_url: '{llvm_url}'
          llvm_branch: '{llvm_branch}'
    triggers:
      - pollscm:
          cron: '{cron_schedule}'
    wrappers:
      - build-wrappers:
          timeout: 600
    builders:
      - run-build:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
          build_script: 'tcwg_bmk-build.sh'
          docker_arch: '{docker_arch}'
    publishers:
      - build-publishers:
          email_on_failure: false
          email_on_success: true

- job-template:
    name: tcwg_bmk-code_size-spec2k6--llvm-{target}-{toolchain_ver}-{cflags}-bisect
    project-type: freestyle
    defaults: global
    properties:
      - bisect-properties:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
    parameters:
      - bisect-parameters:
          distro: '{distro}'
    disabled: false
    node: tcwg-build_bmk && tcwg-armv8_64
    concurrent: false
    display-name: 'TCWG Bisect {ci_project}--{ci_config}'
    workspace: workspace/tcwg_bmk_$EXECUTOR_NUMBER
    scm:
      - jenkins-scripts
      - bmk-scripts
    wrappers:
      - bisect-wrappers:
          timeout: 2880
    builders:
      - run-bisect:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
          build_script: 'tcwg_bmk-build.sh'
          docker_arch: '{docker_arch}'
    publishers:
        - bisect-publishers
# checksum: b94d3d50acf6924c87456fa44e3bc83c