aboutsummaryrefslogtreecommitdiffstats
path: root/jobs/gerrit-verifications.yml
blob: 0a7ccaca7c8d4ddd276865449d728b86483a92f4 (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
# This file holds all gerrit build verifications https://jenkins.osmocom.org/jenkins/view/Jenkins-Gerrit/.
# One can simply add a gerrit job by adding project's repository to repos list.
#
# How it works:
# * Two jobs get added for each repository:
#   gerrit-{repos}
#   gerrit-{repos}-build
# * The gerrit-{repos} job is a pipeline that runs the gerrit-{repos}-build job
#   and other jobs (linting, building debian packages, ...). The purpose of
#   this job is to reduce the amount of comments (and resulting mails) in
#   gerrit coming from the jenkins build verification. If each job ran
#   separately without this pipeline job, they would each generate mails.
#   The gerrit-{repos} job gets triggered from gerrit whenever a new patch to
#   test is available. It passes the GERRIT_BRANCH and GERRIT_REFSPEC variables
#   from gerrit to the jobs called in the pipeline.
# * The gerrit-{repos}-build job runs contrib/jenkins.sh in docker in a matrix.
#   By default the matrix results in only one job, however for some projects we
#   use the matrix to build for multiple CPU architectures (x86_64, arm) or use
#   it to build multiple configurations of the same project (see osmo-bts).

- project:
    name: gerrit
    # following default values can be overridden by each repo
    disabled: false
    concurrent: true
    node: osmocom-gerrit-debian9
    # axes related defaults
    slave_axis: !!python/tuple [osmocom-gerrit-debian9]
    a1_name: a1
    a1: !!python/tuple [default]
    a2_name: a2
    a2: !!python/tuple [default]
    a3_name: a3
    a3: !!python/tuple [default]
    a4_name: a4
    a4: !!python/tuple [default]
    combination_filter: ''
    sequential: false
    # most common build invocation
    # SYS_PTRACE is needed for ASAN (https://github.com/google/sanitizers/issues/764)
    # Documentation for variables (keep in sync!):
    # https://osmocom.org/projects/osmocom-servers/wiki/Jenkins_build_verification_jobs
    docker_run: |
            ARTIFACT_STORE="$HOME/jenkins_build_artifact_store"
            mkdir -p "$ARTIFACT_STORE"
            docker run --rm=true \
              --cap-add SYS_PTRACE \
              -e ARTIFACT_STORE=/artifact_store \
              -e ASCIIDOC_WARNINGS_CHECK="1" \
              -e HOME=/build \
              -e JOB_NAME="$JOB_NAME" \
              -e MAKE=make \
              -e OSMOPY_DEBUG_TCP_SOCKETS="1" \
              -e OSMO_GSM_MANUALS_DIR="/opt/osmo-gsm-manuals" \
              -e PARALLEL_MAKE="$PARALLEL_MAKE" \
              -e WITH_MANUALS="1" \
              -w /build -i -u build \
              -v "$PWD:/build" \
              -v "$ARTIFACT_STORE:/artifact_store" \
    docker_img: '$USER/debian-buster-jenkins'
    docker_img_erlang: '$USER/debian-bullseye-erlang'
    timeout_cmd: '/usr/bin/timeout 30m'
    cmd: '{docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins.sh'
    gerrit_url: 'ssh://jenkins@gerrit.osmocom.org:29418'
    repos_url: '{gerrit_url}/{repos}'
    gerrit_project: '{repos}'

    # in alphabetical order
    repos:
      - asn1c
      - cellmgr-ng
      - libasn1c
      - libgtpnl
      - libosmo-abis
      - libosmo-gprs
      - libosmo-netif
      - libosmo-pfcp
      - libosmo-sccp

      - libosmocore:
          a1_name: arch
          a1: !!python/tuple [arm-none-eabi, amd64]
          combination_filter: '!(arch=="arm-none-eabi" && label=="FreeBSD_amd64")'
          cmd: '{docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins_arch.sh "$arch"'

      - libsmpp34
      - libtelnet
      - libusrp

      - openbsc:
          a1_name: SMPP
          a1: !!python/tuple [--enable-smpp]
          a2_name: MGCP
          a2: !!python/tuple [--enable-mgcp-transcoding, --disable-mgcp-transcoding]
          a3_name: IU
          a3: !!python/tuple [--disable-iu]
          cmd: |
            {docker_run} \
              -e IU="$IU" \
              -e SMPP="$SMPP" \
              -e MGCP="$MGCP" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins.sh

      - openggsn:
          a1_name: GTP
          a1: !!python/tuple [--enable-gtp-linux,--disable-gtp-linux]
          concurrent: false
          cmd: '{timeout_cmd} ./contrib/jenkins.sh'

      - osmo-bsc
      - osmo-bsc-nat

      - osmo-bts:
          slave_axis: !!python/tuple [osmocom-master-debian9, rpi4-raspbian11]
          a1_name: FIRMWARE_VERSION
          a1: !!python/tuple [master, femtobts_v2.7, superfemto_v2.4, superfemto_v3.0.1pre, superfemto_v3.1, superfemto_v5.1, v2017.01, litecell15, oc2g, oc2g-next]
          a2_name: BTS_MODEL
          a2: !!python/tuple [sysmo, oct, trx, oct+trx, lc15, oc2g]
          a3_name: WITH_MANUALS
          a3: !!python/tuple ["1", "0"]
          combination_filter: >
            (FIRMWARE_VERSION == "master" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "master" && BTS_MODEL == "trx" && WITH_MANUALS == "0" && label == "rpi4-raspbian11") ||
            (FIRMWARE_VERSION == "femtobts_v2.7" && BTS_MODEL == "sysmo" && WITH_MANUALS == "1" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "superfemto_v2.4" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "superfemto_v3.0.1pre" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "superfemto_v3.1" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "superfemto_v5.1" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "v2017.01" && BTS_MODEL == "lc15" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "litecell15" && BTS_MODEL == "lc15" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "oc2g" && BTS_MODEL == "oc2g" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (FIRMWARE_VERSION == "oc2g-next" && BTS_MODEL == "oc2g" && WITH_MANUALS == "0" && label == "osmocom-master-debian9")
          concurrent: false
          cmd: |
            {docker_run} \
              -e FIRMWARE_VERSION="$FIRMWARE_VERSION" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins_bts_model.sh "$BTS_MODEL"

      - osmo_dia2gsup:
          repos_url: '{gerrit_url}/erlang/{repos}'
          gerrit_project: 'erlang/{repos}'
          cmd: '{docker_run} {docker_img_erlang} {timeout_cmd} /build/contrib/jenkins.sh'

      - osmo-e1-hardware:
          docker_img: 'registry.osmocom.org/$USER/fpga-build'
          cmd: 'docker pull {docker_img} && {docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins.sh'

      - osmo-ggsn:
          a1_name: GTP
          a1: !!python/tuple [--enable-gtp-linux,--disable-gtp-linux]
          a2_name: WITH_MANUALS
          a2: !!python/tuple ["1", "0"]
          combination_filter: >
            (GTP == "--enable-gtp-linux" && WITH_MANUALS == "0") ||
            (GTP == "--disable-gtp-linux" && WITH_MANUALS == "1")
          cmd: |
            {docker_run} \
              -e GTP="$GTP" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins.sh

      - osmo-gsm-manuals

      - osmo_gsup:
          repos_url: '{gerrit_url}/erlang/{repos}'
          gerrit_project: 'erlang/{repos}'
          cmd: '{docker_run} {docker_img_erlang} {timeout_cmd} /build/contrib/jenkins.sh'

      - osmo-hlr
      - osmo-iuh
      - osmo-mgw

      - osmo-msc:
          a1_name: IU
          a1: !!python/tuple [--enable-iu, --disable-iu]
          a2_name: WITH_MANUALS
          a2: !!python/tuple ["1", "0"]
          combination_filter: >
            (IU == "--enable-iu" && WITH_MANUALS == "0") ||
            (IU == "--disable-iu" && WITH_MANUALS == "1")
          cmd: |
            {docker_run} \
              -e IU="$IU" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins.sh

      - osmo-pcap

      - osmo-pcu:
          slave_axis: !!python/tuple [osmocom-master-debian9, rpi4-raspbian11]
          a1_name: FIRMWARE_VERSION
          a1: !!python/tuple [master, v2017.01, litecell15, oc2g]
          a2_name: with_vty
          a2: !!python/tuple [True, False]
          a3_name: with_dsp
          a3: !!python/tuple [sysmo, lc15, oc2g, none]
          a4_name: WITH_MANUALS
          a4: !!python/tuple ["1", "0"]
          combination_filter: >
            (with_vty == "True" && with_dsp == "sysmo" && FIRMWARE_VERSION=="master" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (with_vty == "True" && with_dsp == "lc15" && FIRMWARE_VERSION=="master" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (with_vty == "True" && with_dsp == "lc15" && FIRMWARE_VERSION=="v2017.01" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (with_vty == "True" && with_dsp == "lc15" && FIRMWARE_VERSION=="litecell15" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (with_vty == "True" && with_dsp == "oc2g" && FIRMWARE_VERSION=="oc2g" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (with_vty == "False" && with_dsp == "none" && FIRMWARE_VERSION=="master" && WITH_MANUALS == "1" && label == "osmocom-master-debian9") ||
            (with_vty == "False" && with_dsp == "none" && FIRMWARE_VERSION=="master" && WITH_MANUALS == "0" && label == "rpi4-raspbian11")
          cmd: |
            {docker_run} \
              -e FIRMWARE_VERSION="$FIRMWARE_VERSION" \
              -e with_vty="$with_vty" \
              -e with_dsp="$with_dsp" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins.sh

      - osmo-python-tests:
          repos_url: '{gerrit_url}/python/{repos}'
          gerrit_project: 'python/{repos}'

      - osmo-sgsn:
          a1_name: IU
          a1: !!python/tuple [--enable-iu, --disable-iu]
          a2_name: WITH_MANUALS
          a2: !!python/tuple ["1", "0"]
          combination_filter: >
            (IU == "--enable-iu" && WITH_MANUALS == "0") ||
            (IU == "--disable-iu" && WITH_MANUALS == "1")
          cmd: |
            {docker_run} \
              -e IU="$IU" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins.sh

      - osmo_ss7:
          repos_url: '{gerrit_url}/erlang/{repos}'
          gerrit_project: 'erlang/{repos}'
          cmd: '{docker_run} {docker_img_erlang} {timeout_cmd} /build/contrib/jenkins.sh'

      - osmo-sip-connector

      - osmo-trx:
          slave_axis: !!python/tuple [osmocom-master-debian9,rpi4-raspbian11]
          a1_name: INSTR
          a1: !!python/tuple [--with-sse, --without-sse --with-neon, --with-neon-vfpv4]
          a2_name: WITH_MANUALS
          a2: !!python/tuple ["1", "0"]
          combination_filter: >
            (INSTR == "--without-sse" && WITH_MANUALS == "1" && label == "osmocom-master-debian9") ||
            (INSTR == "--with-sse" && WITH_MANUALS == "0" && label == "osmocom-master-debian9") ||
            (INSTR == "--with-neon" && WITH_MANUALS == "0" && label == "rpi4-raspbian11") ||
            (INSTR == "--with-neon-vfpv4" && WITH_MANUALS == "0" && label == "rpi4-raspbian11")
          cmd: |
            {docker_run} \
              -e INSTR="$INSTR" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins.sh

      - osmocom-bb
      - osmo-tetra
      - osmo-sysmon
      - osmo-remsim
      - simtrace2
      - osmo-opencm3-projects:
          docker_img: '$USER/debian-bullseye-jenkins'
          cmd: '{docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins.sh'
      - osmo-asf4-dfu
      - osmo-ccid-firmware
      - osmo-e1d
      - osmo-cbc
      - osmo-e1-recorder
      - gapk
      - osmo-uecups
      - osmo-el2tpd
      - osmo-smlc
      - osmo-gbproxy
      - osmo-hnodeb
      - osmo-hnbgw
      - osmo-upf

      - pysim:
          slave_axis: !!python/tuple [simtester]
          concurrent: false
          cmd: '{timeout_cmd} ./contrib/jenkins.sh'

      - osmo-ttcn3-hacks:
          slave_axis: !!python/tuple [ttcn3]
          cmd: |
            docker run \
              --rm \
              -v "$PWD:/build" \
              "registry.osmocom.org/osmocom-build/debian-bullseye-titan" \
              {timeout_cmd} \
              sh -e -x -c "
                useradd --uid=1000 build;
                cd /build;
                su build -c 'make deps';
                su build -c 'make clean';
                su build -c 'make compile';
                "

      - dahdi-tools

    jobs:
      - 'gerrit-{repos}'
      - 'gerrit-{repos}-build'

- job-template:
    name: 'gerrit-{repos}'
    project-type: pipeline
    dsl: |
      pipeline {{
        agent {{ label "osmocom-gerrit" }}
        stages {{
          stage("Verification") {{
            parallel {{
              stage("Build") {{
                steps {{
                  script {{
                    // Run the build job for this repository and keep going on failure
                    catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {{
                      env.PIPELINE_BUILD_PASSED = "0"
                      build job: 'gerrit-{repos}-build', parameters: [
                        string(name: "GERRIT_BRANCH", value: "${{env.GERRIT_BRANCH}}"),
                        string(name: "GERRIT_REFSPEC", value: "${{env.GERRIT_REFSPEC}}"),
                      ]
                      env.PIPELINE_BUILD_PASSED = "1"
                    }}
                  }}
                }}
              }}
            }}
          }}
          stage("Result") {{
            steps {{
              echo "PIPELINE_BUILD_PASSED=${{env.PIPELINE_BUILD_PASSED}}"
            }}
          }}
          // The end result is success if all started jobs were successful,
          // and failed otherwise.
        }}
      }}
    disabled: '{obj:disabled}'
    retry-count: 3 # scm checkout
    properties:
      - build-discarder:
          days-to-keep: 30
          num-to-keep: 120
          artifact-days-to-keep: -1
          artifact-num-to-keep: -1
    description: |
      Pipeline of CI for patches sent to
      <a href="https://gerrit.osmocom.org/#/q/status:open+project:{repos}">{repos}</a>
      <br/><br/>
      <b>Auto-generated using Jenkins Job Builder. DO NOT EDIT MANUALLY!</b>

    scm:
      - git:
         url: '{obj:repos_url}'
         credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
         branches:
           - $GERRIT_BRANCH
         refspec: $GERRIT_REFSPEC
         name:
         choosing-strategy: gerrit
         wipe-workspace: false
         skip-tag: true
         submodule:
           recursive: true

    triggers:
      - gerrit:
          trigger-on:
            - patchset-created-event:
                exclude-drafts: true
                exclude-no-code-change: true
          projects:
            - project-compare-type: 'PLAIN'
              project-pattern: '{obj:gerrit_project}'
              branches:
                - branch-compare-type: 'ANT'
                  branch-pattern: '**'
          skip-vote:
              successful: false
              failed: false
              unstable: false
              notbuilt: false
          silent: false
          escape-quotes: false
          no-name-and-email: false
          trigger-for-unreviewed-patches: true
          server-name: gerrit.osmocom.org

- job-template:
    name: 'gerrit-{repos}-build'
    project-type: matrix
    node: '{node}'
    concurrent: '{obj:concurrent}'
    disabled: '{obj:disabled}'
    retry-count: 3 # scm checkout
    properties:
      - build-discarder:
          days-to-keep: 30
          num-to-keep: 120
          artifact-days-to-keep: -1
          artifact-num-to-keep: -1
    description: |
      Build job of CI for patches sent to
      <a href="https://gerrit.osmocom.org/#/q/status:open+project:{repos}">{repos}</a>
      <br/><br/>
      <b>Auto-generated using Jenkins Job Builder. DO NOT EDIT MANUALLY!</b>

    execution-strategy:
      sequential: '{obj:sequential}'
      combination-filter: |
        {obj:combination_filter}
    axes:
      - axis:
          type: slave
          name: label
          values: '{obj:slave_axis}'
      - axis:
          type: user-defined
          name: '{obj:a1_name}'
          values: '{obj:a1}'
      - axis:
          type: user-defined
          name: '{obj:a2_name}'
          values: '{obj:a2}'
      - axis:
          type: user-defined
          name: '{obj:a3_name}'
          values: '{obj:a3}'
      - axis:
          type: user-defined
          name: '{obj:a4_name}'
          values: '{obj:a4}'

    scm:
      - git:
         url: '{obj:repos_url}'
         credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
         branches:
           - $GERRIT_BRANCH
         refspec: $GERRIT_REFSPEC
         name:
         choosing-strategy: gerrit
         wipe-workspace: false
         skip-tag: true
         submodule:
           recursive: true

    parameters:
      - string:
          name: GERRIT_BRANCH
          description: set by gerrit-{repos} job
      - string:
          name: GERRIT_REFSPEC
          description: set by gerrit-{repos} job

    builders:
      - shell: '{obj:cmd}'

    publishers:
       - warnings:
           console-log-parsers:
             - 'GNU C Compiler 4 (gcc)'
           resolve-relative-paths: true

# vim: expandtab tabstop=2 shiftwidth=2