# All master branch verification builds, https://jenkins.osmocom.org/jenkins/view/master/

- project:
    name: master_build
    # following default values can be overridden by each repo
    disabled: false
    concurrent: true
    # axes related defaults
    slave_axis: !!python/tuple [osmocom-master]
    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)
    # seccomp profile is needed for io_uring (OS#6405)
    # Documentation for variables (keep in sync!):
    # https://osmocom.org/projects/osmocom-servers/wiki/Jenkins_build_verification_jobs
    docker_run: |
            docker run --rm=true \
              --cap-add SYS_PTRACE \
              --security-opt seccomp=$HOME/osmo-ci/_docker_playground/seccomp_profile.json \
              --ulimit fsize=1000000000 \
              -e ASCIIDOC_WARNINGS_CHECK="1" \
              -e CFLAGS="-g" \
              -e HOME=/build \
              -e IS_MASTER_BUILD=1 \
              -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 PUBLISH="1" \
              -e SSH_AUTH_SOCK=/ssh-agent \
              -e WITH_MANUALS="1" \
              -w /build \
              -i \
              -u build \
              -v $(readlink -f $SSH_AUTH_SOCK):/ssh-agent \
              -v "$HOME/osmo-ci:/osmo-ci:ro" \
              -v "$PWD:/build" \
              -v "$HOME/.ssh:/home/build/.ssh:ro" \
    docker_run_ccache: |
            CCACHE_DIR="$HOME/ccache/master-builds"
            mkdir -p "$CCACHE_DIR"
            chown osmocom-build:osmocom-build "$CCACHE_DIR"

            docker run --rm=true \
              --cap-add SYS_PTRACE \
              --security-opt seccomp=$HOME/osmo-ci/_docker_playground/seccomp_profile.json \
              --ulimit fsize=1000000000 \
              -e ASCIIDOC_WARNINGS_CHECK="1" \
              -e CFLAGS="-g" \
              -e HOME=/build \
              -e IS_MASTER_BUILD=1 \
              -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 PUBLISH="1" \
              -e SSH_AUTH_SOCK=/ssh-agent \
              -e WITH_MANUALS="1" \
              -w /build \
              -i \
              -u build \
              -v $(readlink -f $SSH_AUTH_SOCK):/ssh-agent \
              -v "$HOME/osmo-ci:/osmo-ci:ro" \
              -v "$PWD:/build" \
              -v "$HOME/.ssh:/home/build/.ssh:ro" \
              \
              -e CCACHE_DIR="/ccache" \
              -e PATH="/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
              -v "$CCACHE_DIR:/ccache" \
    docker_img: '$USER/debian-trixie-build'
    docker_img_erlang: '$USER/debian-bookworm-erlang'
    docker_img_android: 'registry.osmocom.org/osmocom-build/debian-bookworm-android'
    docker_img_aram_applet: 'registry.osmocom.org/osmocom-build/debian-bookworm-aram-applet'
    docker_img_rp2040: 'registry.osmocom.org/osmocom-build/debian-bookworm-rp2040'
    timeout_cmd: '/usr/bin/timeout 30m'
    wrapper_cmd: '{timeout_cmd} /osmo-ci/scripts/wrapper_core_bt_on_error.sh'
    cmd: '{docker_run_ccache} {docker_img} {wrapper_cmd} /build/contrib/jenkins.sh'
    trigger:
    email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org
    gerrit_url: 'https://gerrit.osmocom.org'
    gitea_url: 'https://gitea.osmocom.org'
    repos_url: '{gerrit_url}/{repos}'
    branch: master
    ssh:
      - docs_ftp.osmocom.org
    archive_artifacts_on_success: false

    # in alphabetical order
    repos:
      - android-apdu-proxy:
          cmd: |
            ANDROID_CACHE="$HOME/android-cache/master-builds/android"
            GRADLE_CACHE="$HOME/android-cache/master-builds/gradle"
            mkdir -p "$ANDROID_CACHE" "$GRADLE_CACHE"
            docker pull {docker_img_android}
            {docker_run} \
              -v "$ANDROID_CACHE":/build/.android \
              -v "$GRADLE_CACHE":/build/.gradle \
              {docker_img_android} {timeout_cmd} contrib/jenkins.sh
          archive_artifacts_on_success: true

      - aram-applet:
          cmd: |
            docker pull {docker_img_aram_applet}
            {docker_run} \
              {docker_img_aram_applet} {timeout_cmd} sh -exc "
                ln -sf /cache/aram-applet/.gradle .
                contrib/jenkins.sh
              "
          archive_artifacts_on_success: true

      - asn1c:
          branch: osmo-iuh/master

      - libasn1c:
          # Full triggers would be:
          # trigger: master-osmo-iuh, master-osmo-msc
          # Optimized:
          # osmo-iuh triggers osmo-msc
          trigger: master-osmo-iuh

      - libgtpnl:
          trigger: master-osmo-ggsn, openggsn, master-osmo-upf

      - libosmo-abis:
          # Full triggers would be:
          # trigger: >
          #   master-osmo-bsc, master-osmo-bts, master-osmo-hlr,
          #   master-osmo-mgw, master-osmo-sgsn
          # Optimized:
          # (see comment at libosmocore)
          trigger: >
            master-osmo-bts,
            master-osmo-hlr,
            master-osmo-mgw,
            master-osmo-sgsn

      - libosmo-asn1-tcap:
          trigger: master-libosmo-sigtran

      - libosmo-dsp:
          repos_url: '{gitea_url}/sdr/{repos}'
          cmd: |
            {docker_run_ccache} \
              {docker_img} {wrapper_cmd} sh -ex -c \
                'autoreconf -fi; \
                 ./configure; \
                 $MAKE $PARALLEL_MAKE; \
                 $MAKE distcheck'
          trigger: master-osmo-gmr
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org 246tnt@gmail.com

      - libosmo-gprs:
          # Full triggers would be:
          # trigger: >
          #   master-osmo-pcu
          # Optimized:
          # (see comment at libosmocore)
          trigger: >
            master-osmo-pcu

      - libosmo-netif:
          # Full triggers would be:
          # trigger: >
          # master-libosmo-abis, master-libosmo-sigtran, mastere-osmo-hlr,
          # master-osmo-iuh, master-osmo-mgw, master-osmo-msc, master-osmo-sgsn,
          # master-osmo-hnodeb, master-osmo-hnbgw
          # Optimized:
          # (see comment at libosmocore)
          trigger: >
            master-libosmo-abis
            master-libosmo-sigtran

      - libosmo-pfcp:
          # Full triggers would be:
          # trigger: >
          #   master-osmo-upf, master-osmo-hnbgw
          # Optimized:
          # (see comment at libosmocore)
          trigger: >
            master-osmo-upf,
            master-osmo-hnbgw

      - libosmo-sigtran:
          a1_name: WITH_TCAP
          a1: !!python/tuple ["1", "0"]
          a2_name: WITH_MANUALS
          a2: !!python/tuple ["1", "0"]
          combination_filter: >
            (WITH_TCAP == "1" && WITH_MANUALS == "1") ||
            (WITH_TCAP == "0" && WITH_MANUALS == "0")
          cmd: |
            {docker_run_ccache} \
              -e WITH_TCAP="$WITH_TCAP" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {timeout_cmd} /build/contrib/jenkins.sh
          # Full triggers would be:
          # trigger: >
          #   master-osmo-bsc, master-osmo-iuh, master-osmo-msc,
          #   master-osmo-sgsn, master-osmo-hnodeb, master-osmo-hnbgw
          # Optimized:
          # (see comment at libosmocore)
          trigger: >
            master-osmo-bsc,
            master-osmo-bsc-nat,
            master-osmo-iuh,
            master-osmo-msc,
            master-osmo-sgsn

      - libosmocore:
          slave_axis: !!python/tuple [io_uring]  # OS#6405
          a1_name: arch
          a1: !!python/tuple [arm-none-eabi, amd64]
          combination_filter: '!(arch=="arm-none-eabi" && label=="FreeBSD_amd64")'
          cmd: '{docker_run_ccache} {docker_img} {wrapper_cmd} /build/contrib/jenkins_arch.sh "$arch"'
          # Full triggers would be:
          # trigger: >
          #   master-libosmo-netif, master-libosmo-abis, master-libosmo-sigtran,
          #   master-osmo-bsc, master-osmo-bts, master-osmo-ggsn, master-osmo-gmr, master-osmo-hlr,
          #   master-osmo-iuh, master-osmo-mgw, master-osmo-msc, master-osmo-pcap, master-osmo-pcu,
          #   master-osmo-sgsn, master-osmo-sip-connector, master-osmo-tetra, master-osmo-hnodeb
          #   master-osmocom-bb, master-simtrace, master-xgoldmon
          # Optimized:
          # libosmocore
          # -> master-libosmo-netif
          #    -> master-libosmo-abis
          #    -> master-libosmo-sigtran
          #       -> master-osmo-bsc
          #       -> master-osmo-bsc-nat
          #       -> master-osmo-iuh
          #          -> master-osmo-msc
          #          -> master-osmo-sgsn
          #          -> master-osmo-hnodeb
          #       -> master-osmo-msc
          #       -> master-osmo-sgsn
          #    -> master-osmo-hlr
          #    -> master-osmo-mgw
          #    -> master-osmo-sgsn
          #    -> master-osmo-bts
          # -> master-libosmo-gprs
          #    -> master-osmo-pcu
          # -> master-libosmo-pfcp
          #    -> master-osmo-upf
          #    -> master-osmo-hnbgw
          # -> master-osmo-ggsn
          #    -> master-osmo-sgsn
          # [...]
          trigger: >
            master-libosmo-netif,
            master-libosmo-pfcp,
            master-osmo-gbproxy,
            master-osmo-ggsn,
            master-osmo-gmr,
            master-osmo-pcap,
            master-osmo-sip-connector,
            master-osmo-tetra,
            master-osmo-trx,
            master-osmocom-bb,
            master-simtrace,
            master-xgoldmon

      - libsmpp34:
          trigger: master-osmo-msc

      - libtelnet
      - libusrp:
          trigger: master-osmo-trx

      - osmo-bsc
      - osmo-bsc-nat

      - osmo-bts:
          slave_axis: !!python/tuple [osmocom-master, raspbian]
          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, origin/nrw/litecell15, origin/nrw/oc2g]
          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 == "1" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "master" && BTS_MODEL == "trx" && WITH_MANUALS == "0" && label == "raspbian") ||
            (FIRMWARE_VERSION == "femtobts_v2.7" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "superfemto_v2.4" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "superfemto_v3.0.1pre" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "superfemto_v3.1" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "superfemto_v5.1" && BTS_MODEL == "sysmo" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "v2017.01" && BTS_MODEL == "lc15" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "origin/nrw/litecell15" && BTS_MODEL == "lc15" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (FIRMWARE_VERSION == "origin/nrw/oc2g" && BTS_MODEL == "oc2g" && WITH_MANUALS == "0" && label == "osmocom-master")
          concurrent: false
          cmd: |
            DOCKER_IMG="{docker_img}"
            case "$(arch)" in
            arm*|aarch64)
              DOCKER_IMG="$DOCKER_IMG-arm"
              SETARCH_CMD="setarch linux32"
              ;;
            esac
            {docker_run_ccache} \
              -e FIRMWARE_VERSION="$FIRMWARE_VERSION" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              "$DOCKER_IMG" {timeout_cmd} $SETARCH_CMD /build/contrib/jenkins_bts_model.sh "$BTS_MODEL"

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

      - osmo-epdg:
          repos_url: '{gerrit_url}/erlang/{repos}'
          a2_name: JOB_TYPE
          a2: !!python/tuple ["build", "manuals"]
          cmd: |
            case "$JOB_TYPE" in
            build)
              {docker_run} {docker_img_erlang} {timeout_cmd} /build/contrib/jenkins.sh
              ;;
            manuals)
              {docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins_manuals.sh
              ;;
            esac

      - osmo-s1gw:
          repos_url: '{gerrit_url}/erlang/{repos}'
          a2_name: JOB_TYPE
          a2: !!python/tuple ["build", "manuals"]
          cmd: |
            case "$JOB_TYPE" in
            build)
              {docker_run} {docker_img_erlang} {timeout_cmd} /build/contrib/jenkins.sh
              ;;
            manuals)
              {docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins_manuals.sh
              ;;
            esac

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

      - enftables:
          repos_url: '{gitea_url}/erlang/{repos}'
          cmd: '{docker_run} {docker_img_erlang} {timeout_cmd} /build/contrib/jenkins.sh'

      - osmo-e1-hardware:
          a2_name: JOB_TYPE
          a2: !!python/tuple ["firmware", "gateware", "manuals", "software"]
          cmd: |
            DOCKER_IMG="{docker_img}"
            case "$JOB_TYPE" in
            firmware|gateware)
              DOCKER_IMG="registry.osmocom.org/$USER/fpga-build"
              docker pull "$DOCKER_IMG"
              ;;
            esac
            {docker_run} \
              -e JOB_TYPE="$JOB_TYPE" \
              "$DOCKER_IMG" \
                {timeout_cmd} /build/contrib/jenkins.sh --publish
          ssh:
            - binaries_ftp.osmocom.org
            - docs_ftp.osmocom.org
      - ice40-usbtrace:
          repos_url: '{gitea_url}/electronics/{repos}'
          docker_img: 'registry.osmocom.org/$USER/fpga-build'
          cmd: 'docker pull {docker_img} && {docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins.sh --publish'
          ssh:
            - binaries_ftp.osmocom.org
            - docs_ftp.osmocom.org
      - no2bootloader:
          repos_url: 'https://github.com/no2fpga/{repos}'
          docker_img: 'registry.osmocom.org/$USER/fpga-build'
          cmd: 'docker pull {docker_img} && {docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins.sh --publish'
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org kredon@sysmocom.de 246tnt@gmail.com
          ssh:
            - binaries_ftp.osmocom.org
            - docs_ftp.osmocom.org

      - osmo-fl2k:
          repos_url: '{gitea_url}/sdr/{repos}'

      - 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_ccache} \
              -e GTP="$GTP" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {wrapper_cmd} /build/contrib/jenkins.sh
          trigger: master-osmo-sgsn

      - osmo-upf

      - osmo-gmr:
          repos_url: '{gitea_url}/satellite/{repos}'
          email: jenkins-notifications@lists.osmocom.org 246tnt@gmail.com

      - osmo-gsm-manuals

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

      - osmo-gsm-tester:
          cmd: '{docker_run} {docker_img} {timeout_cmd} /build/contrib/jenkins-build-manuals.sh'

      - osmo-hlr

      - osmo-iuh:
          # Full triggers would be:
          # trigger: master-osmo-msc, master-osmo-sgsn, master-osmo-hnodeb, master-osmo-hnbgw
          # Optimized:
          # (see comment at libosmocore)
          trigger: >
            master-osmo-msc,
            master-osmo-sgsn,
            master-osmo-hnodeb,
            master-osmo-hnbgw

      - osmo-ir77:
          repos_url: '{gitea_url}/satellite/{repos}'
          email: jenkins-notifications@lists.osmocom.org 246tnt@gmail.com

      - osmo-mgw:
          trigger: master-osmo-msc, master-osmo-bsc

      - 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 == "1") ||
            (IU == "--disable-iu" && WITH_MANUALS == "0")
          cmd: |
            {docker_run_ccache} \
              -e IU="$IU" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {wrapper_cmd} /build/contrib/jenkins.sh

      - osmo-pcap

      - osmo-pcu:
          slave_axis: !!python/tuple [osmocom-master, raspbian]
          a1_name: FIRMWARE_VERSION
          a1: !!python/tuple [master, v2017.01, origin/nrw/litecell15]
          a2_name: with_vty
          a2: !!python/tuple [True, False]
          a3_name: with_dsp
          a3: !!python/tuple [sysmo, lc15, 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") ||
            (with_vty == "True" && with_dsp == "lc15" && FIRMWARE_VERSION=="master" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (with_vty == "True" && with_dsp == "lc15" && FIRMWARE_VERSION=="v2017.01" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (with_vty == "True" && with_dsp == "lc15" && FIRMWARE_VERSION=="origin/nrw/litecell15" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (with_vty == "False" && with_dsp == "none" && FIRMWARE_VERSION=="master" && WITH_MANUALS == "1" && label == "osmocom-master") ||
            (with_vty == "False" && with_dsp == "none" && FIRMWARE_VERSION=="master" && WITH_MANUALS == "0" && label == "raspbian")
          cmd: |
            DOCKER_IMG="{docker_img}"
            case "$(arch)" in
            arm*|aarch64)
              DOCKER_IMG="$USER/debian-bookworm-build-arm"  # OS#6858
              SETARCH_CMD="setarch linux32"
              ;;
            esac
            {docker_run_ccache} \
              -e FIRMWARE_VERSION="$FIRMWARE_VERSION" \
              -e with_vty="$with_vty" \
              -e with_dsp="$with_dsp" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              "$DOCKER_IMG" {wrapper_cmd} $SETARCH_CMD /build/contrib/jenkins.sh

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

      - ot290-gsmtap:
          repos_url: '{gitea_url}/phone-side/{repos}'
          cmd: '{docker_run_ccache} {docker_img} {wrapper_cmd} make -C /build/src'

      - pyosmocom:
          repos_url: '{gerrit_url}/python/{repos}'
          concurrent: false
          slave_axis: !!python/tuple [simtester,osmocom-gerrit]
          a2_name: JOB_TYPE
          a2: !!python/tuple ["test", "pylint", "docs", "pysim"]
          combination_filter: >
            (JOB_TYPE == "test" && label == "osmocom-gerrit") ||
            (JOB_TYPE == "pylint" && label == "osmocom-gerrit") ||
            (JOB_TYPE == "docs" && label == "osmocom-gerrit") ||
            (JOB_TYPE == "pysim" && label == "simtester")
          cmd: |
            case "$JOB_TYPE" in
            "pysim")
              {timeout_cmd} ./contrib/jenkins.sh
              ;;
            *)
              {docker_run} \
                -e JOB_TYPE="$JOB_TYPE" \
                {docker_img} \
                  {timeout_cmd} /build/contrib/jenkins.sh
              ;;
            esac

      - 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 == "1") ||
            (IU == "--disable-iu" && WITH_MANUALS == "0")
          cmd: |
            {docker_run_ccache} \
              -e IU="$IU" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              {docker_img} {wrapper_cmd} /build/contrib/jenkins.sh

      - osmo-sip-connector:
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org holger@freyther.de

      - osmo-tetra:
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org 246tnt@gmail.com

      - osmo-trx:
          slave_axis: !!python/tuple [osmocom-master,raspbian]
          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") ||
            (INSTR == "--with-sse" && WITH_MANUALS == "0" && label == "osmocom-master") ||
            (INSTR == "--with-neon" && WITH_MANUALS == "0" && label == "raspbian") ||
            (INSTR == "--with-neon-vfpv4" && WITH_MANUALS == "0" && label == "raspbian")
          cmd: |
            DOCKER_IMG="{docker_img}"
            case "$(arch)" in
            arm*|aarch64)
              DOCKER_IMG="$DOCKER_IMG-arm"
              SETARCH_CMD="setarch linux32"
              ;;
            esac
            {docker_run_ccache} \
              -e INSTR="$INSTR" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              "$DOCKER_IMG" {wrapper_cmd} $SETARCH_CMD /build/contrib/jenkins.sh

      - osmocom-bb
      - osmo-sysmon
      - osmo-remsim
      - osmo-asf4-dfu:
          cmd: '{docker_run_ccache} {docker_img} {timeout_cmd} /build/contrib/jenkins.sh --publish'
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org ewild@sysmocom.de
          ssh:
            - binaries_ftp.osmocom.org
            - docs_ftp.osmocom.org
      - osmo-ccid-firmware:
          cmd: '{docker_run_ccache} {docker_img} {timeout_cmd} /build/contrib/jenkins.sh --publish'
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org ewild@sysmocom.de
          ssh:
            - binaries_ftp.osmocom.org
            - docs_ftp.osmocom.org
      - osmo-rp2040-firmware:
          cmd: |
            docker pull {docker_img_rp2040}
            {docker_run} \
              {docker_img_rp2040} {timeout_cmd} contrib/jenkins.sh
          email: jenkins-notifications@lists.osmocom.org
          ssh:
            - binaries_ftp.osmocom.org
      - simtrace:
          repos_url: '{gitea_url}/sim-card/{repos}'
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org kredon@sysmocom.de
      - simtrace2:
          cmd: '{docker_run_ccache} {docker_img} {wrapper_cmd} /build/contrib/jenkins.sh --publish'
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org kredon@sysmocom.de
          ssh:
            - binaries_ftp.osmocom.org
            - docs_ftp.osmocom.org
      - osmo-opencm3-projects:
          repos_url: '{gitea_url}/electronics/{repos}'
          # bookworm: OS#6859
          cmd: '{docker_run} $USER/debian-bookworm-build {wrapper_cmd} /build/contrib/jenkins.sh --publish'
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org kredon@sysmocom.de
          ssh:
            - binaries_ftp.osmocom.org
            - docs_ftp.osmocom.org

      - osmo-e1d
      - osmo-cbc
      - osmo-e1-recorder
      - gapk
      - osmo-uecups
      - osmo-el2tpd
      - osmo-smlc
      - osmo-gbproxy
      - osmo-hnodeb

      - osmo-hnbgw:
          a1_name: PFCP
          a1: !!python/tuple ["1", "0"]
          a2_name: WITH_MANUALS
          a2: !!python/tuple ["1", "0"]
          a3_name: NFTABLES
          a3: !!python/tuple ["1", "0"]
          combination_filter: >
            (PFCP == "1" && WITH_MANUALS == "1" && NFTABLES == "1") ||
            (PFCP == "0" && WITH_MANUALS == "0" && NFTABLES == "0")
          cmd: |
            {docker_run_ccache} \
              -e PFCP="$PFCP" \
              -e WITH_MANUALS="$WITH_MANUALS" \
              -e NFTABLES="$NFTABLES" \
              {docker_img} {wrapper_cmd} /build/contrib/jenkins.sh

      - rtl-sdr:
          repos_url: '{gitea_url}/sdr/{repos}'
          email: jenkins-notifications@lists.osmocom.org laforge@gnumonks.org steve@steve-m.de

      - pysim:
          concurrent: false
          slave_axis: !!python/tuple [simtester,osmocom-master]
          a2_name: JOB_TYPE
          a2: !!python/tuple ["test", "pylint", "docs"]
          combination_filter: >
            (JOB_TYPE == "test" && label == "simtester") ||
            (JOB_TYPE == "pylint" && label == "osmocom-master") ||
            (JOB_TYPE == "docs" && label == "osmocom-master")
          cmd: |
            case "$JOB_TYPE" in
            "test")
              {timeout_cmd} ./contrib/jenkins.sh
              ;;
            *)
              {docker_run} \
                -e JOB_TYPE="$JOB_TYPE" \
                {docker_img} \
                  {timeout_cmd} /build/contrib/jenkins.sh
              ;;
            esac

      - sysmo-usim-tool:
          concurrent: false
          cmd: cd ./tests; {timeout_cmd} ./run-tests
          slave_axis: !!python/tuple [simtester]
          repos_url: 'https://gitea.sysmocom.de/sysmocom/{repos}'

      - dahdi-tools

      - osmocom-android-binaries:
          ssh:
            - binaries_ftp.osmocom.org
          concurrent: false
          repos_url: 'https://gitea.osmocom.org/osmocom/osmocom-android-binaries'

      - xgoldmon:
          repos_url: 'https://github.com/2b-as/{repos}'
          cmd: |
            rm -rf osmo-ci
            git clone --depth=1 https://gerrit.osmocom.org/osmo-ci -b master
            {docker_run_ccache} {docker_img} {wrapper_cmd} /build/osmo-ci/scripts/xgoldmon-jenkins.sh

    jobs:
      - 'master-{repos}'

- job-template:
    name: 'master-{repos}'
    project-type: matrix
    concurrent: '{obj:concurrent}'
    disabled: '{obj:disabled}'
    retry-count: 3 # scm checkout
    properties:
      - build-discarder:
          days-to-keep: 30
          num-to-keep: 120
    description: |
      Automatic jenkins test job of
      <a href="{repos_url}">{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}'

    parameters:
      - string:
          name: BRANCH
          description: git branch
          default: '{obj:branch}'
      - string:
          name: EMAIL_NOTIFICATIONS
          description: For failed build notifications, set to empty to disable
          default: '{obj:email}'

    scm:
      - git:
         url: '{obj:repos_url}'
         branches:
           - '$BRANCH'
         refspec:
         name:
         wipe-workspace: false
         skip-tag: true
         submodule:
           recursive: true

    triggers:
      - pollscm:
          cron: "H/5 * * * *"
          ignore-post-commit-hooks: false
      - timed: "H H * * *"

    builders:
      - shell: '{obj:cmd}'
      - shell: |
          # Remove workspace on success to free up space. Create an empty dir
          # so the job does not abort when attempting to collect artifacts.
          if [ "{archive_artifacts_on_success}" != "True" ]; then
            rm -rf "$WORKSPACE"
            mkdir -p "$WORKSPACE"
          fi

    publishers:
       - archive:
           allow-empty: true
           artifacts: '**/core, **/testsuite.log, **/workspace.tar.xz, **/app-release.apk, **/applet.cap'
       - warnings:
           console-log-parsers:
             - 'GNU C Compiler 4 (gcc)'
           resolve-relative-paths: true
       - trigger:
           project: '{obj:trigger}'
       - trigger:
           project: 'Osmocom_OBS_master'
       - email:
           recipients: '$EMAIL_NOTIFICATIONS'
           send-to-individuals: true
    wrappers:
       - ssh-agent-credentials:
           users: '{obj:ssh}'

# vim: expandtab tabstop=2 shiftwidth=2
