---
- project:
    name: Osmocom_OBS
    description_extra: ""
    jobs:
      - Osmocom_OBS_{type}
    type:
      - master:
          conflict_version: ""
          description_extra: |
            This job gets triggered by jenkins whenever something gets merged
            to master.
      - nightly:
          # For nightly we don't provide ABI compatibility, make sure packages
          # from different build dates are not mixed by accident
          conflict_version: "$(date +%Y%m%d%H%M)"
          description_extra: |
            This job gets triggered every night.<br><br>
            <b>Do not trigger manually! This causes a rebuild of ALL packages
            for ALL supported Linux distributions and architectures, and should
            only run once every night!</b>
      - latest:
          conflict_version: ""
          description_extra: |
            This job gets triggered every night.<br><br>
            Triggering this manually after making a release is fine, because
            only the packages that have a new version will be built.

- job-template:
    name: 'Osmocom_OBS_{type}'
    project-type: freestyle
    concurrent: false
    defaults: global
    description: |
      See <a href="https://osmocom.org/projects/cellular-infrastructure/wiki/Binary_Packages">Wiki: binary packages</a>
      for more information. {description_extra}
    properties:
      - build-discarder:
          days-to-keep: 30
          num-to-keep: 30
    node: obs
    parameters:
      - string:
          name: BRANCH
          description: osmo-ci.git branch
          default: 'refs/remotes/origin/master'
    builders:
      - shell: |
          export PYTHONUNBUFFERED=1

          ./scripts/obs/update_obs_project.py \
            --apiurl https://obs.osmocom.org \
            --conflict-version {conflict_version} \
            --docker \
            --feed {type} \
            --meta \
            osmocom:{type}

          # Remove workspace on success to free up space
          rm -rf "$WORKSPACE"

    scm:
      - git:
          branches:
            - '$BRANCH'
          url: https://gerrit.osmocom.org/osmo-ci
          git-config-name: 'Jenkins Builder'
          git-config-email: 'jenkins@osmocom.org'
    triggers:
      - timed: "H 20 * * *"

    publishers:
      - email:
          notify-every-unstable-build: true
          recipients: 'jenkins-notifications@lists.osmocom.org'

# vim: expandtab tabstop=2 shiftwidth=2