- project:
    name: master-builds-dahdi-linux-stable
    type: stable
    repo: 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git'
    linux-ver:
      - "linux-4.19.y"
      - "linux-5.10.y"
      - "linux-6.1.y"
      - "linux-rolling-stable"
    jobs:
      - 'master-dahdi-linux-{type}-{linux-ver}'

- project:
    name: master-builds-dahdi-linux-torvalds
    type: torvalds
    repo: 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'
    linux-ver:
      - "master"
    jobs:
      - 'master-dahdi-linux-{type}-{linux-ver}'

- job-template:
    name: 'master-dahdi-linux-{type}-{linux-ver}'
    project-type: freestyle
    node: osmocom-master
    concurrent: true
    retry-count: 0 # scm checkout
    properties:
      - build-discarder:
          days-to-keep: 30
          num-to-keep: 120
    description: |
      Automatic jenkins test job of
      <a href="https://gerrit.osmocom.org/#/q/status:open+project:dahdi-linux">dahdi-linux</a>
      built against linux {linux-ver}
      (<a href="https://osmocom.org/issues/5407">OS#5407</a>)
      <br/><br/>
      <b>Auto-generated using Jenkins Job Builder. DO NOT EDIT MANUALLY!</b>

    parameters:
      - string:
          name: BRANCH
          description: dahdi-linux.git branch
          default: 'master'
      - string:
          name: EMAIL_NOTIFICATIONS
          description: For failed build notifications, set to empty to disable
          default: 'jenkins-notifications@lists.osmocom.org laforge@gnumonks.org'

    scm:
      # Let jenkins clone the big linux repository and keep it between builds
      # (wipe-workspace is false). Clone dahdi-linux with code from gerrit in
      # the shell part below.
      - git:
         basedir: 'linux'
         url: '{repo}'
         branches:
           - '{linux-ver}'
         refspec: '{linux-ver}'
         shallow-clone: true
         wipe-workspace: false
         clean:
          before: true

    triggers:
      - timed: "H 23 * * *"

    builders:
      - shell: |
          git -C linux config gc.autoDetach false
          git -C linux gc --auto

          rm -rf dahdi-linux
          git clone \
            --depth=1 \
            https://gerrit.osmocom.org/dahdi-linux \
            -b "$BRANCH"
          git -C dahdi-linux log --oneline

          docker run \
            --rm=true \
            -e "KSRC=/linux" \
            -v "$PWD/dahdi-linux:/build" \
            -v "$PWD/linux:/linux" \
            "$USER/debian-bookworm-build" \
            timeout 10m su build -c /build/contrib/jenkins.sh

    publishers:
       - warnings:
           console-log-parsers:
             - 'GNU C Compiler 4 (gcc)'
           resolve-relative-paths: true
       - email:
           recipients: '$EMAIL_NOTIFICATIONS'
           send-to-individuals: true

# vim: expandtab tabstop=2 shiftwidth=2