aboutsummaryrefslogtreecommitdiff
path: root/tcwg-llvm-build.yaml
blob: 0dc0aa712fc1e957772022c73b9152b226221791 (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
# Auto generated by ./tcwg/generate-yamlfiles.sh from tcwg-dev-build.yaml.in and tcwg-dev-build/tcwg-llvm-build.def. Do not edit.
#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

- job:
    name: tcwg-llvm-build
    project-type: freestyle
    defaults: global
    properties:
      - default-properties
    parameters:
        - string:
            name: release
            default: ''
            description: 'Release number. Ex. 4.0.1'
        - string:
            name: candidate
            default: 'git-ref=main'
            description: 'RC number. Ex. 1, 2, final'
        - string:
            name: toolchain
            default: ''
            description: 'URL of the toolchain to use. This needs to be a tarball with a /bin directory inside with either GCC or LLVM from make install'
        - string:
            name: compiler
            default: 'clang'
            description: 'Override the default system compiler. Only used if "toolchain" is empty.'
        - bool:
            name: useninja
            default: true
            description: 'Whether or not to use ninja for the release (works for releases > 9.0.0)'
        - bool:
            name: testsuite
            default: true
            description: 'Whether or not to trigger a test-suite with this build.'
        - string:
            name: build_container_tag
            default: 'lts_1'
            description: 'Type of image to use in the container: bionic, focal.'
        - label:
            name: builder
            default: tcwg-x86_64-build
            description: 'Jenkins label to build on; determines host of the toolchain'
        - string:
            name: scripts_branch
            default: tested
            description: 'Scripts revision to use'
    disabled: false
    concurrent: true
    display-name: 'TCWG AAA llvm linux Build'
    scm:
      - jenkins-scripts
    wrappers:
        - timeout:
            timeout: 1800
        - timestamps
        - ssh-agent-credentials:
            # tcwg-buildslave user id
            users:
                - 'e0958a95-204f-4c14-a66c-5e2be6c5d50a'
        - build-name:
            name: '#$BUILD_NUMBER-$release-$candidate/$builder'
        - workspace-cleanup
    builders:
        - shell: |
            #!/bin/bash

            set -ex

            rm -rf artifacts
            mkdir artifacts

            # Until we figure out a way to use heavy-job with different weights
            # based on the builder, we hardcode to one.
            buildjobs=1

            # Select builder arch/type/container
            case ${builder} in
                tcwg-x86_64-build|tcwg-x86_64-cam)
                    builder_arch=amd64
                    buildjobs=8 # 1 slot is 32/4
                    ;;
                tcwg-tk1_32-build|tcwg-llvm_tk1-*)
                    builder_arch=armhf
                    buildjobs=3 # TK1s only have 4 cores and little RAM
                    ;;
                tcwg-jade*)
                    builder_arch=arm64
                    buildjobs=64 # Jades have lots of cores
                    ;;
                *) echo "ERROR: Unsupported label: $builder"; exit 1 ;;
            esac

            # Sets the system compiler
            compiler_option=''
            if [ "${toolchain:+set}" != "set" ] && [ "${compiler:+set}" = "set" ]; then
              compiler_option="--compiler=${compiler}"
            fi

            # Trigger toolchain name
            toolchain_file="${WORKSPACE}/llvm.params.toolchain"
            toolchain_file_option=""
            if ${twostage} || ${testsuite}; then
              toolchain_file_option="--toolchain-file=$toolchain_file"
            fi

            # Setup job parameters and run (for now, just pretend to run)
            ret=0
            ./jenkins-scripts/docker-run.sh \
                --arch ${builder_arch} \
                --distro ${build_container_tag} \
                -- \
                bash -x ./jenkins-scripts/tcwg-llvm-release.sh \
                --workspace=${WORKSPACE} \
                --release=${release} \
                --candidate=${candidate} \
                --buildjobs=${buildjobs} \
                --toolchain=${toolchain} \
                --use-ninja=${useninja} \
                $toolchain_file_option $compiler_option \
                > artifacts/release.log 2>&1 || ret=$?

            if [ $ret -ne 0 ]; then
                touch llvm.failed
            fi

            # Chained jobs
            if ${testsuite}; then
              echo "target_list=$builder" > llvm.params.testsuite
              cat $toolchain_file >> llvm.params.testsuite
            fi

            # failure is handled by conditional step on llvm.failed
            # so that the testsuite job is always triggered
            exit 0
        - conditional-step:
            condition-kind: file-exists
            condition-filename: llvm.params.testsuite
            steps:
                - trigger-builds:
                    - project: 'tcwg-llvm-testsuite'
                      property-file: llvm.params.testsuite
                      current-parameters: true
                      block: true
        - conditional-step:
            condition-kind: file-exists
            condition-filename: llvm.failed
            steps:
                - shell: "exit 1"
    publishers:
        - archive:
            artifacts: 'artifacts/**'
            latest-only: false
# checksum: 59b769065cb540a8c5e622c4f3d65fb3