# Regex denoting stable branches for which we want to build packages
stable_branch_regex: '^(stable-.*|thread-next|master)$'

# Note: Dockerfiles must be rebuilt by manually triggering the pipeline
# with an appropriate input via https://gitlab.nic.cz/labs/bird/-/pipelines/new

distros:
  # CentOS 7 with quite some hacks
  - name: centos-7-amd64
    variables:
      LC_ALL: en_US.UTF-8
      CC: /opt/rh/devtoolset-8/root/usr/bin/gcc
    type: rpm
    docker: static

  - name: centos-8-amd64
    type: rpm
    docker:
      parent: 'centos:8'
      installer: yum -y
      alternative_lsb: redhat-lsb-core
      systemd: false
      preinstall: |
        # Has to be done for yum to work properly. CentOS 8 is EOL.
        RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/CentOS-*.repo
        RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/CentOS-*.repo
        RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/CentOS-*.repo

  # Rocky and Oracle Linux, forks of CentOS/RHEL
  # check latest supported version at https://wiki.rockylinux.org/rocky/version/#__tabbed_1_2
  {% for inum,snum in ((8,10),(9,5)) -%}
  {% if inum >= 10 %}{% set num = inum ~ "" %}{% else %}{% set num = "0" ~ inum %}{% endif -%}
  - name: rocky-{{ num }}-amd64
    type: rpm
    docker:
      parent: 'rockylinux/rockylinux:{{ inum }}.{{snum}}'
      installer: yum -y
      {%- if num == "08" %}
      alternative_lsb: redhat-lsb-core
      systemd: false
      {%- else %}
      systemd: true
      faketime: true
      preinstall: 'RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ inum }}.noarch.rpm'
      {%- endif %}
  {% endfor %}
  {% for inum in (8,9,10) -%}
  {% if inum >= 10 %}{% set num = inum ~ "" %}{% else %}{% set num = "0" ~ inum %}{% endif -%}
  - name: oracle-{{ num }}-amd64
    type: rpm
    docker:
      parent: 'oraclelinux:{{ inum }}'
      installer: yum -y
      {%- if num == "08" %}
      alternative_lsb: redhat-lsb-core
      systemd: false
      {%- else %}
      systemd: true
      faketime: true
      preinstall: 'RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ inum }}.noarch.rpm'
      {%- endif %}
  {% endfor %}

  # Last 7 years of OpenSUSE
  {% for num in (0,1,2,3,4,5) -%}
  - name: opensuse-15.{{ num }}-amd64
    type: rpm
    docker:
      parent: 'opensuse/leap:15.{{num}}'
      installer: zypper -n
      pkgconfig: true
      systemd: true
      faketime: lib
      sysuser: true
  {% endfor %}
  {% for num in (0,) -%}
  - name: opensuse-16.{{ num }}-amd64
    type: rpm
    docker:
      parent: 'opensuse/leap:16.{{num}}'
      installer: zypper -n
      pkgconfig: true
      systemd: true
      faketime: lib
      sysuser: true
  {% endfor %}

  # Last 12 versions of Fedora
  {% for num in (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44) -%}
  - name: fedora-{{ num }}-amd64
    type: rpm
    docker:
      parent: fedora:{{ num }}
      installer: dnf -y
      pkgconfig: true
      faketime: true
      {%- if num <= 36 %}
      alternative_lsb: redhat-lsb-core
      {%- endif %}
      systemd: true

  {% endfor %}

  # Debian from oldoldstable up to testing
  {% for num, codename, crossarch in (
    (11, "bullseye", []),
    (12, "bookworm", ["mips64el", "s390x"]),
    (13, "trixie", ["arm64", "armel", "armhf", "riscv64", "s390x"]),
    ("testing", "testing", ["arm64", "armhf", "riscv64", "s390x"])
    ) -%}
  {% for arch in ('amd64', 'i386') -%}
  - name: debian-{{num}}-{{arch}}
    type: deb
    shortname: debian
  {%- if arch == "amd64" %}
    crossarch: {{ crossarch }}
  {%- endif %}
    docker:
      parent: {{ arch }}/debian:{{ codename }}-slim
      libssh_kind: {% if (num != "testing") and (num < 13) %}libssh-gcrypt{% else %}libssh{% endif %}
      needs_adduser: {% if (num != "testing") and (num < 13) %}false{% else %}true{% endif %}
  {% endfor %}
  {% endfor %}

# These debian don't crossbuild. TODO fix that.
# 12 -> ["arm64", "armel", "armhf"] ->  Error 127 from `make check` probably because qemu-user is somehow botched

  # Last 7 years of Ubuntu LTS
  {% for num, crossarch in (
      ('18.04', []),
      ('20.04', []),
      ('22.04', []),
      ('24.04', ["arm64", "armhf", "ppc64el", "riscv64", "s390x"]),
      ('25.04', ["armhf", "ppc64el", "riscv64", "s390x"]),
      ('25.10', ["arm64", "armhf", "ppc64el", "riscv64", "s390x"]),
      ('26.04', ["arm64", "armhf", "ppc64el", "riscv64", "s390x"]),
      ) -%}
  - name: ubuntu-{{ num }}-amd64
    type: deb
    shortname: ubuntu
    crossarch: {{ crossarch }}
    docker:
      parent: "ubuntu:{{ num }}"
      libssh_kind: {% if (num[:2] | int) < 25 %}libssh-gcrypt{% else %}libssh{% endif %}
      needs_adduser: {% if (num[:2] | int) > 22 %}true{% else %}false{% endif %}
  {% endfor %}

# These ubuntu don't crossbuild. TODO fix that.
# '22.04' -> ["arm64", "armhf", "ppc64el"] -> Error 127 from `make check` probably because qemu-user is somehow botched
#	  -> ["s390x"] doesn't pack -> debugedit --build-id --build-id-seed=bird2/2.18\+branch.mq.nightly.d0b6b85ebc17-cznic.1\~jammy debian/bird2/usr/sbin/birdc died with signal 11
#	  -> ["riscv64"] fails on dynamic linking libatomic.so.1 when running tests
# '25.04' -> ["arm64"] fails in `make check` with Timeout expired on `rt-fib_test`

birdlab:
  - name: openbsd-76
    variables:
      AUTOCONF_VERSION: "2.72"

  {% for num in ("09", "10") -%}
  - name: netbsd-{{ num }}
  {% endfor %}

  {% for num in (13, 14) -%}
  - name: freebsd-{{ num }}
  - name: freebsd-{{ num }}-netlink
    dist: freebsd-{{ num }}
    variables:
      CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
  {% endfor %}

partial_build_image:
  name: debian-12-amd64

partial_build:
  - protocols: aggregator
  - protocols: babel
  - protocols: bfd
  - protocols: bgp
  - protocols: bgp,bmp
  - protocols: l3vpn
  - protocols: mrt
  - protocols: ospf
  - protocols: pipe
  - protocols: radv
  - protocols: rip
  - protocols: rpki
  - protocols: static

netlab:
  - name: babel-base
  - name: babel-auth
  - name: ospf-base
  - name: ospf-default
  - name: ospf-priority
  - name: ospf-nbma
  - name: ospf-ptmp
  - name: ospf-authentication
  - name: ospf-bfd
  - name: ospf-custom
  - name: ospf-area
  - name: ospf-vrf
  - name: bgp-base
  - name: bgp-auth
  - name: bgp-int
  - name: bgp-merged
  - name: bgp-flowspec
  - name: bgp-rs-multitab
  - name: bgp-rs-singletab
  - name: ebgp-graceful
  - name: ebgp-loop
  - name: ebgp-star
  - name: ebgp-role
  - name: ebgp-import-limit
  - name: ebgp-hostname
  - name: ebgp-bfd-auth
  - name: ibgp-loop
  - name: ibgp-loop-big
  - name: ibgp-flat
  - name: ibgp-bfd-auth
  - name: rip-base
  - name: rip-vrf
  - name: kernel-learn
  - name: mpls-bgp
  - name: mpls-bgp-l3vpn
  - name: pipe-collision
  - name: ebgp-refresh/gen/imno-basic-imex-basic
  - name: ebgp-refresh/gen/noex-basic-imno-enhanced
  - name: ebgp-refresh/gen/imex-basic-noex-none
  - name: ebgp-refresh/gen/nono-enhanced-nono-basic
  - name: ebgp-refresh/gen/imno-none-imex-basic
  - name: ebgp-refresh/gen/noex-none-imno-enhanced
  - name: ebgp-refresh/gen/imex-none-noex-none
  - name: ebgp-refresh/gen/nono-none-nono-basic
  - name: ebgp-refresh/gen/imno-enhanced-imex-enhanced
  - name: ebgp-refresh/gen/noex-enhanced-imno-enhanced
  - name: ebgp-refresh/gen/imex-enhanced-noex-enhanced
  - name: ebgp-refresh/gen/nono-enhanced-nono-enhanced
