aboutsummaryrefslogtreecommitdiff
path: root/tcwg_gcc.yaml
blob: bd401cd0cd3a54faf170721f77c7c85c439c261c (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
# Auto generated by ./tcwg/generate-yamlfiles.sh from tcwg_gnu.yaml.in and tcwg_gnu/tcwg_gcc.def. Do not edit.
# Beware: git branch names need the 'refs/heads/' prefix, while tags need 'refs/tags/'
- project:
    name: tcwg_gcc
    toolchain_name: gnu
    ci_project: tcwg_gnu
    gcc_url: https://github.com/gcc-mirror/gcc.git
    toolchain_ver:
      - master:
          gcc_branch: refs/heads/master
          distro: lts
      - release:
          gcc_branch: refs/heads/releases/gcc-10
          distro: lts_1
    target:
      - aarch64:
          node: tcwg-armv8_64
          docker_arch: arm64
      - arm:
          node: tcwg-armv8_32
          docker_arch: armhf
    disabled: false
    type_of_test:
      - bootstrap_O1
      - bootstrap_O3
      - bootstrap_debug
      - bootstrap_profiled
      - bootstrap_profiled_lto
      - bootstrap_profiled_lto_lean
      - bootstrap_ubsan
      - check_bootstrap:
          disabled: true
      - check_bootstrap_lto:
          disabled: true
    jobs:
      - 'tcwg_gcc-build-{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
      - 'tcwg_gcc-bisect-{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'

- view:
    name: tcwg_gcc
    view-type: list
    regex: 'tcwg_gcc-.*'

#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
          linaro:
            - job-build
            - job-cancel
      - build-discarder:
          days-to-keep: 30
          num-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

#END:   tcwg/default.yaml.inc

- parameter:
    name: default-parameters
    parameters:
      - string:
          name: ci_project
          default: '{ci_project}'
          description: "CI project ID; used as namespace for git branches"
      - string:
          name: ci_config
          default: '{ci_config}'
          description: "CI configuration ID"
      - string:
          name: extra_build_params
          default: ""
          description: "Extra parameters to pass to the build script"
      - string:
          name: mail_recipients
          default: default
          description: "Comma-separated list of email recipients; use 'default' unless testing"
      - string:
          name: distro
          default: '{distro}'
          description: 'Distro image to use'
      - string:
          name: scripts_branch
          default: master
          description: 'Scripts revision to use'

- parameter:
    name: component-parameters
    parameters:
      - string:
          name: '{component}_url'
          default: '{url}'
          description: "{component} git URL"
      - string:
          name: '{component}_branch'
          default: '{branch}'
          description: "{component} branch or sha1 to build, or 'baseline'"

- parameter:
    name: build-parameters
    parameters:
      - component-parameters:
          component: gcc
          url: '{gcc_url}'
          branch: '{default_branch}'
      - choice:
          name: update_baseline
          choices:
            - update
            - reset
            - init
            - push
          description: "What to do with baseline in this build"
      - default-parameters:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
          distro: '{distro}'

# 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: gcc
          url: '{gcc_url}'
          branch: '{gcc_branch}'
          reference: gcc.git

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

- builder:
    name: trigger-followup-builds
    builders:
      - build-name-setter:
          name: 'artifacts/jenkins/build-name'
          file: true
      - shell: |
          #!/bin/bash
          set -ex
          for i in artifacts/trigger-build-* artifacts/trigger-bisect; do
            if [ -f $i ]; then
              echo "ci_project=$ci_project" >> $i
              echo "ci_config=$ci_config" >> $i
              echo "mail_recipients=$mail_recipients" >> $i
              echo "distro=$distro" >> $i
              echo "scripts_branch=$scripts_branch" >> $i
            fi
          done
      - trigger-builds:
          - project: '{rr_project}-build-{ci_project_config}'
            parameter-factories:
              - factory: filebuild
                file-pattern: artifacts/trigger-build-*
          - project: '{rr_project}-bisect-{ci_project_config}'
            property-file: artifacts/trigger-bisect

- builder:
    name: run-build
    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

            dryruncmd=""
            # Don't run these known-bad configurations.
            case {target}-{type_of_test} in
              aarch64-bootstrap_profiled|\
              aarch64-bootstrap_profiled_lto|\
              aarch64-bootstrap_profiled_lto_lean|\
              aarch64-check_bootstrap_lto|\
              arm-bootstrap_profiled|\
              arm-bootstrap_profiled_lto*|\
              arm-check_bootstrap_lto)
                echo "Known bad configuration, not running."
                echo "Would have run:"
                # So we know it wasn't an infrastructure failure
                touch artifacts/failures
                dryruncmd="echo"
                ;;
            esac

            build_name="#$BUILD_NUMBER"
            branch_opt=""
            # 1 to skip jenkins-scripts
            i=1
            for c in {components}; do
              eval "u=\$$$${{c}}_url"
              eval "b=\$$$${{c}}_branch"
              if [ x"$b" = x"default" ]; then
                eval "b=\$GIT_COMMIT_$i"
              fi
              i=$(($i+1))
              if [ x"$b" != x"baseline" ]; then
                build_name="$build_name-$c"
                branch_opt="$branch_opt ==rr[${{c}}_url] $u ==rr[${{c}}_branch] $b"
              fi
            done

            $dryruncmd \
            ./jenkins-scripts/docker-run.sh \
              --distro $distro \
              --arch {docker_arch} \
              --node $NODE_NAME \
              -- \
              ./jenkins-scripts/{build_script} \
              %% artifacts/jenkins/manifest.sh \
              ==rr[ci_project] $ci_project \
              ==rr[ci_config] $ci_config \
              $extra_build_params \
              --scripts_branch "$scripts_branch" \
              $branch_opt \
              ==rr[mode] "jenkins-full" \
              ==rr[update_baseline] "$update_baseline" \
              --BUILD_URL "$BUILD_URL" &
            res=0 && wait $! || res=$?

            # If we didn't run the docker command
            if [ -n "$dryruncmd" ]; then
              # Mark build unstable aka a skipped config
              exit 125
            fi

            if [ $res != 0 ]; then
              touch artifacts/failures
            fi

            if [ -e artifacts/results ]; then
              build_name="$build_name-R$(tail -n1 artifacts/results)"
            fi
            if [ x"$update_baseline" != x"update" ]; 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
          unstable-return: 125
      - conditional-step:
          # Only run if above succeeded
          # Meaning we did not skip a bad config
          # (a failed build is indicated by artifacts/failures)
          condition-kind: current-status
          steps:
            - trigger-followup-builds:
                rr_project: '{rr_project}'
                ci_project_config: '{ci_project_config}'
            - shell: |
                #!/bin/bash
                if [ -f artifacts/failures ]; then
                  exit 1
                fi

- publisher:
    name: build-publishers
    publishers:
        - archive:
            artifacts: 'artifacts/**'
            latest-only: false

- parameter:
    name: bisect-parameters
    parameters:
      - string:
          name: current_project
          default: ""
          description: "Project to bisect"
      - string:
          name: bad_url
          default: ""
          description: "Bad git URL"
      - string:
          name: bad_branch
          default: ""
          description: "Bad branch or sha1"
      - file:
          name: jenkins-scripts/replay_log
          description: "Replay part of bisect using provided bisect log"
      - default-parameters:
          ci_project: '{ci_project}'
          ci_config: '{ci_config}'
          distro: '{distro}'

- wrapper:
    name: bisect-wrappers
    wrappers:
      - build-wrappers:
          timeout: '{timeout}'
      - credentials-binding:
          - text:
              credential-id: TCWG_JIRA_PASSWORD
              variable: TCWG_JIRA_PASSWORD

- 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
            # artifacts/jenkins/mail-*.txt will be overwritten in successful builds.
            echo "prathamesh.kulkarni@linaro.org,tcwg-gcc@linaro.org" > artifacts/jenkins/mail-recipients.txt
            echo "Build $BUILD_URL failed" > artifacts/jenkins/mail-body.txt

            ./jenkins-scripts/docker-run.sh \
              --distro $distro \
              --arch {docker_arch} \
              --node $NODE_NAME \
              -- \
              ./jenkins-scripts/round-robin-bisect.sh \
              %% artifacts/manifests/bisect.sh \
              --BUILD_URL "$BUILD_URL" \
              --current_project "$current_project" \
              --bad_url "$bad_url" \
              --bad_branch "$bad_branch" \
              --replay_log "$(pwd)/jenkins-scripts/replay_log" \
              --build_script "./jenkins-scripts/{build_script}" \
              --JIRA_PASSWORD "$TCWG_JIRA_PASSWORD" \
              -- \
              ==rr[ci_project] $ci_project \
              ==rr[ci_config] $ci_config \
              $extra_build_params \
              --scripts_branch "$scripts_branch"

            if [ x"$mail_recipients" != x"default" ]; then
              echo "$mail_recipients" > artifacts/jenkins/mail-recipients.txt
            fi
      - trigger-followup-builds:
          rr_project: '{rr_project}'
          ci_project_config: '{ci_project_config}'

- publisher:
    name: bisect-publishers
    publishers:
        - build-publishers
        - email-ext:
            recipients: |
              ${{FILE,path="artifacts/jenkins/mail-recipients.txt"}}
            content-type: text
            body: |
              ${{FILE,path="artifacts/jenkins/mail-body.txt"}}
            failure: true
            success: true
            aborted: true
            send-to:
              - recipients
#END:   tcwg/round-robin.yaml.inc

- job-template:
    name: tcwg_gcc-build-{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}
    project-type: freestyle
    defaults: global
    properties:
      - default-properties
      - build-blocker:
          blocking-jobs:
            - "tcwg_gcc-bisect-{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}"
          queue-scanning: 'ALL'
    parameters:
      - build-parameters:
          ci_project: '{ci_project}'
          ci_config: '{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
          gcc_url: '{gcc_url}'
          default_branch: 'default'
          distro: '{distro}'
    disabled: '{disabled}'
    node: '{node} && tcwg-build'
    concurrent: false
    display-name: 'TCWG Build {ci_project}/{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
    workspace: workspace/tcwg_gnu_$EXECUTOR_NUMBER
    scm:
      - build-scms:
          gcc_url: '{gcc_url}'
          gcc_branch: '{gcc_branch}'
    triggers:
      - pollscm:
          cron: 'H H H/2 * *'
    wrappers:
      - build-wrappers:
          timeout: 1000
    builders:
      - run-build:
          build_script: 'tcwg_gnu-build.sh'
          components: 'gcc'
          rr_project: 'tcwg_gcc'
          ci_project_config: '{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
          docker_arch: '{docker_arch}'
          target: '{target}'
          type_of_test: '{type_of_test}'
    publishers:
      - build-publishers
      - email-ext:
          recipients: 'tcwg-gcc@linaro.org'
          aborted: true
          failure: false
          success: false

- job-template:
    name: tcwg_gcc-bisect-{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}
    project-type: freestyle
    defaults: global
    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:
            - "tcwg_gcc-bisect-.*"
          queue-scanning: 'BUILDABLE'
    parameters:
      - bisect-parameters:
          ci_project: '{ci_project}'
          ci_config: '{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
          distro: '{distro}'
    disabled: '{disabled}'
    node: '{node} && tcwg-bisect'
    concurrent: false
    display-name: 'TCWG Bisect {ci_project}/{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
    workspace: workspace/tcwg_gnu_$EXECUTOR_NUMBER
    scm:
      - jenkins-scripts
    wrappers:
      - bisect-wrappers:
          timeout: 6000
    builders:
      - run-bisect:
          build_script: 'tcwg_gnu-build.sh'
          rr_project: 'tcwg_gcc'
          ci_project_config: '{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
          docker_arch: '{docker_arch}'
    publishers:
      - bisect-publishers
# checksum: f33116f75a5ed5891be3ca5deb2018cb