]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
CI: Tasks generated from a data file and template
authorMaria Matejka <mq@ucw.cz>
Sat, 19 Apr 2025 18:11:02 +0000 (20:11 +0200)
committerMaria Matejka <mq@ucw.cz>
Tue, 29 Apr 2025 18:28:28 +0000 (20:28 +0200)
Instead of directly editing .gitlab-ci.yml, the pipeline definition is
generated by a script from a much shorter file defining the required
tests, and templated.

.gitlab-ci.yml
Makefile.in
misc/gitlab/data.yml.j2 [new file with mode: 0644]
misc/gitlab/pipeline.py [new file with mode: 0755]
misc/gitlab/template.yml.j2 [new file with mode: 0644]
tools/git-is-stable-branch [new file with mode: 0755]

index 509dc0954e3d04f927b2c38570b60db7d614e674..4e1bfb5e6609012c4dfc394b93ae1a31c51d98e1 100644 (file)
@@ -1,7 +1,13 @@
-## TODO: find out how to generate this file by another yaml file.
-## Gitlab can do it but it is a stupid idea to mess with this
-## when releasing 4 versions at once. See ya later!
-##                                              -- Maria, April 2025
+###########################################################
+#####                                                 #####
+#####       DO  NOT  EDIT  THIS  FILE  BY  HAND       #####
+#####                                                 #####
+###########################################################
+#####                                                 #####
+##### This file is autogenerated from misc/gitlab/.   #####
+##### Edit those files and run `make gitlab` instead. #####
+#####                                                 #####
+###########################################################
 
 variables:
   DEBIAN_FRONTEND: noninteractive
@@ -18,15 +24,14 @@ stages:
   - build
   - pkg
   - test
-  - release
 
 ## Common rules
 # Ignore WIP commits
-.never_wip: &never_wip
+.never-wip: &never-wip
   if: $CI_COMMIT_MESSAGE =~ /^(fixup! )*WIP/
   when: never
 # Run for stable branches
-.if_stable: &if_stable
+.if-stable: &if-stable
   if: $CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/
   when: always
 
@@ -36,16 +41,25 @@ commit-messages:
   script:
   - tools/git-check-commits
   rules:
-  - *if_stable
+  - *if-stable
   - when: never
 
-## Docker Image Rules
-#
+## Default test job rules
+.test-job: &test-job
+  rules:
+  - *never-wip
+  - when: always
+
+############################
+## Docker builder rebuild ##
+############################
 # We are running all the build / packaging tests in Dockers (unless otherwise)
 # and these are rules to build these docker images. These are expensive to run
 # and should run only if needed.
+#
+# Modify the appropriate dockerfile to rebuild these images
 
-.docker: &docker_build
+.docker: &docker-build
   stage: image
   script:
   - $DOCKER_CMD login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.nic.cz
@@ -64,7 +78,8 @@ commit-messages:
   # That's Docker in Docker
   - dind
   rules:
-  - *never_wip
+    # Never rebuild for WIP commits
+  - *never-wip
 
     # Never rebuild for tags
   - if: '$CI_COMMIT_TAG'
@@ -75,176 +90,184 @@ commit-messages:
     when: never
 
     # Do any change in Dockerfile (e.g. change a comment) to rebuild the image
+    # FIXME: This probably belongs to bird-tools instead, we may end up with
+    # screwed up docker repository in case of colliding image updates
   - changes:
     - misc/docker/$IMG_NAME/Dockerfile
     when: always
 
   - when: never
 
+
 docker-docbuilder:
   variables:
     IMG_NAME: "docbuilder"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-centos-7-amd64:
   variables:
     IMG_NAME: "centos-7-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-centos-8-amd64:
   variables:
     IMG_NAME: "centos-8-amd64"
-  <<: *docker_build
-
-docker-debian-10-amd64:
-  variables:
-    IMG_NAME: "debian-10-amd64"
-  <<: *docker_build
-
-docker-debian-10-i386:
-  variables:
-    IMG_NAME: "debian-10-i386"
-  <<: *docker_build
+  <<: *docker-build
 
-docker-debian-11-amd64:
+docker-fedora-32-amd64:
   variables:
-    IMG_NAME: "debian-11-amd64"
-  <<: *docker_build
+    IMG_NAME: "fedora-32-amd64"
+  <<: *docker-build
 
-docker-debian-11-i386:
+docker-fedora-33-amd64:
   variables:
-    IMG_NAME: "debian-11-i386"
-  <<: *docker_build
+    IMG_NAME: "fedora-33-amd64"
+  <<: *docker-build
 
-docker-debian-12-amd64:
+docker-opensuse-15.0-amd64:
   variables:
-    IMG_NAME: "debian-12-amd64"
-  <<: *docker_build
+    IMG_NAME: "opensuse-15.0-amd64"
+  <<: *docker-build
 
-docker-debian-12-i386:
+docker-opensuse-15.1-amd64:
   variables:
-    IMG_NAME: "debian-12-i386"
-  <<: *docker_build
+    IMG_NAME: "opensuse-15.1-amd64"
+  <<: *docker-build
 
-docker-debian-testing-amd64:
+docker-opensuse-15.2-amd64:
   variables:
-    IMG_NAME: "debian-testing-amd64"
-  <<: *docker_build
+    IMG_NAME: "opensuse-15.2-amd64"
+  <<: *docker-build
 
-docker-debian-testing-i386:
+docker-opensuse-15.3-amd64:
   variables:
-    IMG_NAME: "debian-testing-i386"
-  <<: *docker_build
+    IMG_NAME: "opensuse-15.3-amd64"
+  <<: *docker-build
 
-docker-fedora-32-amd64:
+docker-opensuse-15.4-amd64:
   variables:
-    IMG_NAME: "fedora-32-amd64"
-  <<: *docker_build
+    IMG_NAME: "opensuse-15.4-amd64"
+  <<: *docker-build
 
-docker-fedora-33-amd64:
+docker-opensuse-15.5-amd64:
   variables:
-    IMG_NAME: "fedora-33-amd64"
-  <<: *docker_build
+    IMG_NAME: "opensuse-15.5-amd64"
+  <<: *docker-build
 
 docker-fedora-34-amd64:
   variables:
     IMG_NAME: "fedora-34-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-35-amd64:
   variables:
     IMG_NAME: "fedora-35-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-36-amd64:
   variables:
     IMG_NAME: "fedora-36-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-37-amd64:
   variables:
     IMG_NAME: "fedora-37-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-38-amd64:
   variables:
     IMG_NAME: "fedora-38-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-39-amd64:
   variables:
     IMG_NAME: "fedora-39-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-40-amd64:
   variables:
     IMG_NAME: "fedora-40-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-41-amd64:
   variables:
     IMG_NAME: "fedora-41-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
 docker-fedora-42-amd64:
   variables:
     IMG_NAME: "fedora-42-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
-docker-opensuse-15.0-amd64:
+docker-ubuntu-18.04-amd64:
   variables:
-    IMG_NAME: "opensuse-15.0-amd64"
-  <<: *docker_build
+    IMG_NAME: "ubuntu-18.04-amd64"
+  <<: *docker-build
 
-docker-opensuse-15.1-amd64:
+docker-debian-10-amd64:
   variables:
-    IMG_NAME: "opensuse-15.1-amd64"
-  <<: *docker_build
+    IMG_NAME: "debian-10-amd64"
+  <<: *docker-build
 
-docker-opensuse-15.2-amd64:
+docker-debian-10-i386:
   variables:
-    IMG_NAME: "opensuse-15.2-amd64"
-  <<: *docker_build
+    IMG_NAME: "debian-10-i386"
+  <<: *docker-build
 
-docker-opensuse-15.3-amd64:
+docker-debian-11-amd64:
   variables:
-    IMG_NAME: "opensuse-15.3-amd64"
-  <<: *docker_build
+    IMG_NAME: "debian-11-amd64"
+  <<: *docker-build
 
-docker-opensuse-15.4-amd64:
+docker-debian-11-i386:
   variables:
-    IMG_NAME: "opensuse-15.4-amd64"
-  <<: *docker_build
+    IMG_NAME: "debian-11-i386"
+  <<: *docker-build
 
-docker-opensuse-15.5-amd64:
+docker-debian-12-amd64:
   variables:
-    IMG_NAME: "opensuse-15.5-amd64"
-  <<: *docker_build
+    IMG_NAME: "debian-12-amd64"
+  <<: *docker-build
 
-docker-ubuntu-18_04-amd64:
+docker-debian-12-i386:
   variables:
-    IMG_NAME: "ubuntu-18.04-amd64"
-  <<: *docker_build
+    IMG_NAME: "debian-12-i386"
+  <<: *docker-build
+
+docker-debian-testing-amd64:
+  variables:
+    IMG_NAME: "debian-testing-amd64"
+  <<: *docker-build
+
+docker-debian-testing-i386:
+  variables:
+    IMG_NAME: "debian-testing-i386"
+  <<: *docker-build
 
-docker-ubuntu-20_04-amd64:
+docker-ubuntu-20.04-amd64:
   variables:
     IMG_NAME: "ubuntu-20.04-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
-docker-ubuntu-22_04-amd64:
+docker-ubuntu-22.04-amd64:
   variables:
     IMG_NAME: "ubuntu-22.04-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
-docker-ubuntu-24_04-amd64:
+docker-ubuntu-24.04-amd64:
   variables:
     IMG_NAME: "ubuntu-24.04-amd64"
-  <<: *docker_build
+  <<: *docker-build
 
-docker-ubuntu-24_10-amd64:
+docker-ubuntu-24.10-amd64:
   variables:
     IMG_NAME: "ubuntu-24.10-amd64"
-  <<: *docker_build
+  <<: *docker-build
+
+
+#####################################################
+## Linux distro build tests inside Docker builders ##
+#####################################################
 
 ## Build stage
 #
@@ -252,251 +275,280 @@ docker-ubuntu-24_10-amd64:
 # Every task needs its docker, see above.
 
 .build: &build-base
+  <<: *test-job
   stage: build
   script:
-  - autoreconf
-  - ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" $CONFIGURE_OPTIONS
-  # Detect which make is available
-  - MAKE=make
-  - which gmake 2>/dev/null >/dev/null && MAKE=gmake
-  - BRANCH=$CI_COMMIT_BRANCH $MAKE
-  - $MAKE check
-  # Build docs when tools are available
-  - if which linuxdoc pdflatex sgmlsasp >/dev/null ; then $MAKE docs ; fi
-  rules:
-  - *never_wip
-  - when: always
-
-# A special task for preparing the release archives
-build-release:
-  image: registry.nic.cz/labs/bird:docbuilder
-  stage: build
-  tags:
-    - docker
-    - linux
-  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
     - autoreconf
-    - ./configure --with-protocols= --disable-client
-    - make obj/doc/bird-singlepage.html
-    - BRANCH=$CI_COMMIT_BRANCH tools/make-archive
-  artifacts:
-    paths:
-      - obj/doc/bird-singlepage.html
-      - bird-*.tar.gz
-    expire_in: 1 day
-  rules:
-  - *never_wip
-  - when: always
-
-.build-linux: &build-linux
+    - ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" $CONFIGURE_OPTIONS
+    # Detect which make is available
+    - MAKE=make
+    - which gmake 2>/dev/null >/dev/null && MAKE=gmake
+    - $MAKE
+    - $MAKE check
+    # Build docs when tools are available
+    - if which linuxdoc pdflatex sgmlsasp >/dev/null ; then $MAKE docs ; fi
+
+.build-docker-linux-amd64: &build-docker-linux-amd64
   <<: *build-base
   tags:
     - docker
     - linux
     - amd64
 
+
 build-centos-7-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-centos-7-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:centos-7-amd64
   variables:
-    # export path to devtoolset-8-gcc
     CC: /opt/rh/devtoolset-8/root/usr/bin/gcc
     LC_ALL: en_US.UTF-8
-  image: registry.nic.cz/labs/bird:centos-7-amd64
 
 build-centos-8-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-centos-8-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:centos-8-amd64
 
-build-debian-10-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-10-amd64
-
-build-debian-10-i386:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-10-i386
-
-build-debian-11-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-11-amd64
+build-fedora-32-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-32-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-32-amd64
 
-build-debian-11-i386:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-11-i386
+build-fedora-33-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-33-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-33-amd64
 
-build-debian-12-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-12-amd64
+build-opensuse-15.0-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.0-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.0-amd64
 
-build-debian-12-i386:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-12-i386
+build-opensuse-15.1-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.1-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.1-amd64
 
-build-debian-testing-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-testing-amd64
+build-opensuse-15.2-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.2-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.2-amd64
 
-build-debian-testing-i386:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-testing-i386
+build-opensuse-15.3-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.3-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.3-amd64
 
-build-fedora-32-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-32-amd64
+build-opensuse-15.4-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.4-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.4-amd64
 
-build-fedora-33-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-33-amd64
+build-opensuse-15.5-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.5-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.5-amd64
 
 build-fedora-34-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-34-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-34-amd64
 
 build-fedora-35-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-35-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-35-amd64
 
 build-fedora-36-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-36-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-36-amd64
 
 build-fedora-37-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-37-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-37-amd64
 
 build-fedora-38-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-38-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-38-amd64
 
 build-fedora-39-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-39-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-39-amd64
 
 build-fedora-40-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-40-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-40-amd64
 
 build-fedora-41-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-41-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-41-amd64
 
 build-fedora-42-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-42-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:fedora-42-amd64
 
-build-opensuse-15.0-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:opensuse-15.0-amd64
-
-build-opensuse-15.1-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:opensuse-15.1-amd64
-
-build-opensuse-15.2-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:opensuse-15.2-amd64
-
-build-opensuse-15.3-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:opensuse-15.3-amd64
-
-build-opensuse-15.4-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:opensuse-15.4-amd64
-
-build-opensuse-15.5-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:opensuse-15.5-amd64
-
-build-ubuntu-18_04-amd64:
-  <<: *build-linux
+build-ubuntu-18.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-18.04-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:ubuntu-18.04-amd64
 
-build-ubuntu-20_04-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-20.04-amd64
-
-build-ubuntu-22_04-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-22.04-amd64
+build-debian-10-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-10-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-10-amd64
 
-build-ubuntu-24_04-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-24.04-amd64
+build-debian-10-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-10-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-10-i386
 
-build-ubuntu-24_10-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-24.10-amd64
+build-debian-11-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-11-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-11-amd64
 
-# Testing builds for just a single protocol each time
+build-debian-11-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-11-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-11-i386
 
-.build-only: &build-only
-  <<: *build-linux
+build-debian-12-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-12-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:debian-12-amd64
 
-build-only-aggregator:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=aggregator
-
-build-only-babel:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=babel
-
-build-only-bfd:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=bfd
-
-build-only-bgp:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=bgp
-
-build-only-bgp-bmp:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=bgp,bmp
+build-debian-12-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-12-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-12-i386
 
-build-only-l3vpn:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=l3vpn
+build-debian-testing-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-testing-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-testing-amd64
 
-build-only-mrt:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=mrt
+build-debian-testing-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-testing-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-testing-i386
 
-build-only-ospf:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=ospf
+build-ubuntu-20.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-20.04-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-20.04-amd64
 
-build-only-pipe:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=pipe
+build-ubuntu-22.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-22.04-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-22.04-amd64
 
-build-only-radv:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=radv
+build-ubuntu-24.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-24.04-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-24.04-amd64
 
-build-only-rip:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=rip
+build-ubuntu-24.10-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-24.10-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-24.10-amd64
 
-build-only-rpki:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=rpki
 
-build-only-static:
-  <<: *build-only
-  variables:
-    CONFIGURE_OPTIONS: --with-protocols=static
+#######################################################
+## A special task for preparing the release archives ##
+#######################################################
+build-release:
+  <<: *test-job
+  image: registry.nic.cz/labs/bird:docbuilder
+  needs: 
+    - job: docker-docbuilder
+      optional: true
+  stage: build
+  tags:
+    - docker
+    - linux
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - autoreconf
+    - ./configure --with-protocols= --disable-client
+    - make obj/doc/bird-singlepage.html
+    - tools/make-archive
+  artifacts:
+    paths:
+      - obj/doc/bird-singlepage.html
+      - bird-*.tar.gz
+    expire_in: 1 day
 
 # Packaging rules
 # As we support some ancient versions of different distributions,
@@ -506,6 +558,7 @@ build-only-static:
 # We do NOT build separate documentation packages in these rules.
 
 .pkg-deb: &pkg-deb
+  <<: *test-job
   stage: pkg
   script:
     # create venv only if it's installed
@@ -516,11 +569,9 @@ build-only-static:
   artifacts:
     paths:
       - pkg/pkgs/*
-  rules:
-  - *never_wip
-  - when: always
 
 .pkg-deb-legacy: &pkg-deb-legacy
+  <<: *test-job
   stage: pkg
   script:
     # create venv only if it's installed
@@ -535,11 +586,9 @@ build-only-static:
   artifacts:
     paths:
       - pkg/pkgs/*
-  rules:
-  - *never_wip
-  - when: always
 
 .pkg-rpm: &pkg-rpm
+  <<: *test-job
   stage: pkg
   script:
     - pip3 install apkg
@@ -548,11 +597,9 @@ build-only-static:
   artifacts:
     paths:
       - pkg/pkgs/*
-  rules:
-  - *never_wip
-  - when: always
 
 .pkg-rpm-wa: &pkg-rpm-wa
+  <<: *test-job
   stage: pkg
   script:
     - sed -i "s/runstatedir/with-runtimedir/" distro/pkg/rpm/bird.spec
@@ -564,175 +611,328 @@ build-only-static:
   artifacts:
     paths:
       - pkg/pkgs/*
-  rules:
-  - *never_wip
-  - when: always
+
+
 
 pkg-centos-7-amd64:
   <<: *pkg-rpm-wa
+  needs: [ build-centos-7-amd64 ]
+  image: registry.nic.cz/labs/bird:centos-7-amd64
   variables:
-    # export path to devtoolset-8-gcc
     CC: /opt/rh/devtoolset-8/root/usr/bin/gcc
     LC_ALL: en_US.UTF-8
-  needs: [build-centos-7-amd64]
-  image: registry.nic.cz/labs/bird:centos-7-amd64
 
 pkg-centos-8-amd64:
   <<: *pkg-rpm-wa
-  needs: [build-centos-8-amd64]
+  needs: [ build-centos-8-amd64 ]
   image: registry.nic.cz/labs/bird:centos-8-amd64
 
-pkg-debian-10-amd64:
-  <<: *pkg-deb
-  needs: [build-debian-10-amd64]
-  image: registry.nic.cz/labs/bird:debian-10-amd64
-
-pkg-debian-10-i386:
-  <<: *pkg-deb
-  needs: [build-debian-10-i386]
-  image: registry.nic.cz/labs/bird:debian-10-i386
-
-pkg-debian-11-amd64:
-  <<: *pkg-deb
-  needs: [build-debian-11-amd64]
-  image: registry.nic.cz/labs/bird:debian-11-amd64
+pkg-fedora-32-amd64:
+  <<: *pkg-rpm-wa
+  needs: [ build-fedora-32-amd64 ]
+  image: registry.nic.cz/labs/bird:fedora-32-amd64
 
-pkg-debian-11-i386:
-  <<: *pkg-deb
-  needs: [build-debian-11-i386]
-  image: registry.nic.cz/labs/bird:debian-11-i386
+pkg-fedora-33-amd64:
+  <<: *pkg-rpm-wa
+  needs: [ build-fedora-33-amd64 ]
+  image: registry.nic.cz/labs/bird:fedora-33-amd64
 
-pkg-debian-12-amd64:
-  <<: *pkg-deb
-  needs: [build-debian-12-amd64]
-  image: registry.nic.cz/labs/bird:debian-12-amd64
+pkg-opensuse-15.0-amd64:
+  <<: *pkg-rpm-wa
+  needs: [ build-opensuse-15.0-amd64 ]
+  image: registry.nic.cz/labs/bird:opensuse-15.0-amd64
 
-pkg-debian-12-i386:
-  <<: *pkg-deb
-  needs: [build-debian-12-i386]
-  image: registry.nic.cz/labs/bird:debian-12-i386
+pkg-opensuse-15.1-amd64:
+  <<: *pkg-rpm-wa
+  needs: [ build-opensuse-15.1-amd64 ]
+  image: registry.nic.cz/labs/bird:opensuse-15.1-amd64
 
-pkg-debian-testing-amd64:
-  <<: *pkg-deb
-  needs: [build-debian-testing-amd64]
-  image: registry.nic.cz/labs/bird:debian-testing-amd64
+pkg-opensuse-15.2-amd64:
+  <<: *pkg-rpm-wa
+  needs: [ build-opensuse-15.2-amd64 ]
+  image: registry.nic.cz/labs/bird:opensuse-15.2-amd64
 
-pkg-debian-testing-i386:
-  <<: *pkg-deb
-  needs: [build-debian-testing-i386]
-  image: registry.nic.cz/labs/bird:debian-testing-i386
+pkg-opensuse-15.3-amd64:
+  <<: *pkg-rpm-wa
+  needs: [ build-opensuse-15.3-amd64 ]
+  image: registry.nic.cz/labs/bird:opensuse-15.3-amd64
 
-pkg-fedora-32-amd64:
+pkg-opensuse-15.4-amd64:
   <<: *pkg-rpm-wa
-  needs: [build-fedora-32-amd64]
-  image: registry.nic.cz/labs/bird:fedora-32-amd64
+  needs: [ build-opensuse-15.4-amd64 ]
+  image: registry.nic.cz/labs/bird:opensuse-15.4-amd64
 
-pkg-fedora-33-amd64:
+pkg-opensuse-15.5-amd64:
   <<: *pkg-rpm-wa
-  needs: [build-fedora-33-amd64]
-  image: registry.nic.cz/labs/bird:fedora-33-amd64
+  needs: [ build-opensuse-15.5-amd64 ]
+  image: registry.nic.cz/labs/bird:opensuse-15.5-amd64
 
 pkg-fedora-34-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-34-amd64]
+  needs: [ build-fedora-34-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-34-amd64
 
 pkg-fedora-35-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-35-amd64]
+  needs: [ build-fedora-35-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-35-amd64
 
 pkg-fedora-36-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-36-amd64]
+  needs: [ build-fedora-36-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-36-amd64
 
 pkg-fedora-37-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-37-amd64]
+  needs: [ build-fedora-37-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-37-amd64
 
 pkg-fedora-38-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-38-amd64]
+  needs: [ build-fedora-38-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-38-amd64
 
 pkg-fedora-39-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-39-amd64]
+  needs: [ build-fedora-39-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-39-amd64
 
 pkg-fedora-40-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-40-amd64]
+  needs: [ build-fedora-40-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-40-amd64
 
 pkg-fedora-41-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-41-amd64]
+  needs: [ build-fedora-41-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-41-amd64
 
 pkg-fedora-42-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-42-amd64]
+  needs: [ build-fedora-42-amd64 ]
   image: registry.nic.cz/labs/bird:fedora-42-amd64
 
-pkg-opensuse-15.0-amd64:
- <<: *pkg-rpm-wa
needs: [build-opensuse-15.0-amd64]
image: registry.nic.cz/labs/bird:opensuse-15.0-amd64
+pkg-ubuntu-18.04-amd64:
+  <<: *pkg-deb-legacy
 needs: [ build-ubuntu-18.04-amd64 ]
 image: registry.nic.cz/labs/bird:ubuntu-18.04-amd64
 
-pkg-opensuse-15.1-amd64:
- <<: *pkg-rpm-wa
needs: [build-opensuse-15.1-amd64]
image: registry.nic.cz/labs/bird:opensuse-15.1-amd64
+pkg-debian-10-amd64:
+  <<: *pkg-deb
 needs: [ build-debian-10-amd64 ]
 image: registry.nic.cz/labs/bird:debian-10-amd64
 
-pkg-opensuse-15.2-amd64:
- <<: *pkg-rpm-wa
needs: [build-opensuse-15.2-amd64]
- image: registry.nic.cz/labs/bird:opensuse-15.2-amd64
+pkg-debian-10-i386:
+  <<: *pkg-deb
 needs: [ build-debian-10-i386 ]
+  image: registry.nic.cz/labs/bird:debian-10-i386
 
-pkg-opensuse-15.3-amd64:
-  <<: *pkg-rpm-wa
-  needs: [build-opensuse-15.3-amd64]
-  image: registry.nic.cz/labs/bird:opensuse-15.3-amd64
+pkg-debian-11-amd64:
+  <<: *pkg-deb
+  needs: [ build-debian-11-amd64 ]
+  image: registry.nic.cz/labs/bird:debian-11-amd64
 
-pkg-opensuse-15.4-amd64:
-  <<: *pkg-rpm-wa
-  needs: [build-opensuse-15.4-amd64]
-  image: registry.nic.cz/labs/bird:opensuse-15.4-amd64
+pkg-debian-11-i386:
+  <<: *pkg-deb
+  needs: [ build-debian-11-i386 ]
+  image: registry.nic.cz/labs/bird:debian-11-i386
 
-pkg-opensuse-15.5-amd64:
-  <<: *pkg-rpm-wa
-  needs: [build-opensuse-15.5-amd64]
-  image: registry.nic.cz/labs/bird:opensuse-15.5-amd64
+pkg-debian-12-amd64:
+  <<: *pkg-deb
+  needs: [ build-debian-12-amd64 ]
+  image: registry.nic.cz/labs/bird:debian-12-amd64
 
-pkg-ubuntu-18.04-amd64:
-  <<: *pkg-deb-legacy
-  needs: [build-ubuntu-18_04-amd64]
-  image: registry.nic.cz/labs/bird:ubuntu-18.04-amd64
+pkg-debian-12-i386:
+  <<: *pkg-deb
+  needs: [ build-debian-12-i386 ]
+  image: registry.nic.cz/labs/bird:debian-12-i386
+
+pkg-debian-testing-amd64:
+  <<: *pkg-deb
+  needs: [ build-debian-testing-amd64 ]
+  image: registry.nic.cz/labs/bird:debian-testing-amd64
+
+pkg-debian-testing-i386:
+  <<: *pkg-deb
+  needs: [ build-debian-testing-i386 ]
+  image: registry.nic.cz/labs/bird:debian-testing-i386
 
 pkg-ubuntu-20.04-amd64:
   <<: *pkg-deb
-  needs: [build-ubuntu-20_04-amd64]
+  needs: [ build-ubuntu-20.04-amd64 ]
   image: registry.nic.cz/labs/bird:ubuntu-20.04-amd64
 
 pkg-ubuntu-22.04-amd64:
   <<: *pkg-deb
-  needs: [build-ubuntu-22_04-amd64]
+  needs: [ build-ubuntu-22.04-amd64 ]
   image: registry.nic.cz/labs/bird:ubuntu-22.04-amd64
 
 pkg-ubuntu-24.04-amd64:
   <<: *pkg-deb
-  needs: [build-ubuntu-24_04-amd64]
+  needs: [ build-ubuntu-24.04-amd64 ]
   image: registry.nic.cz/labs/bird:ubuntu-24.04-amd64
 
 pkg-ubuntu-24.10-amd64:
   <<: *pkg-deb
-  needs: [build-ubuntu-24_10-amd64]
+  needs: [ build-ubuntu-24.10-amd64 ]
   image: registry.nic.cz/labs/bird:ubuntu-24.10-amd64
 
+
+###################################
+## Non-linux build tests in QEMU ##
+###################################
+.build-birdlab-base: &build-birdlab-base
+  <<: *test-job
+  stage: build
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - autoreconf
+    - ./configure $CONFIGURE_OPTIONS
+    - gmake
+    - gmake check
+
+
+build-birdlab-openbsd-75:
+  <<: *build-birdlab-base
+  variables:
+    AUTOCONF_VERSION: '2.71'
+  tags:
+    - birdlab-openbsd-75
+    - amd64
+
+build-birdlab-openbsd-76:
+  <<: *build-birdlab-base
+  variables:
+    AUTOCONF_VERSION: '2.72'
+  tags:
+    - birdlab-openbsd-76
+    - amd64
+
+build-birdlab-netbsd-09:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-netbsd-09
+    - amd64
+
+build-birdlab-netbsd-10:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-netbsd-10
+    - amd64
+
+build-birdlab-freebsd-13:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-freebsd-13
+    - amd64
+
+build-birdlab-freebsd-13-netlink:
+  <<: *build-birdlab-base
+  variables:
+    CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
+  tags:
+    - birdlab-freebsd-13
+    - amd64
+
+build-birdlab-freebsd-14:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-freebsd-14
+    - amd64
+
+build-birdlab-freebsd-14-netlink:
+  <<: *build-birdlab-base
+  variables:
+    CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
+  tags:
+    - birdlab-freebsd-14
+    - amd64
+
+
+#########################
+## Partial build tests ##
+#########################
+
+.build-only: &build-only
+  <<: *build-docker-linux-amd64
+  image: registry.nic.cz/labs/bird:debian-12-amd64
+  needs:
+    - job: docker-debian-12-amd64
+      optional: true
+
+
+partial-build-linux-aggregator:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=aggregator
+
+partial-build-linux-babel:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=babel
+
+partial-build-linux-bfd:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=bfd
+
+partial-build-linux-bgp:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=bgp
+
+partial-build-linux-bgp,bmp:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=bgp,bmp
+
+partial-build-linux-l3vpn:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=l3vpn
+
+partial-build-linux-mrt:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=mrt
+
+partial-build-linux-ospf:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=ospf
+
+partial-build-linux-pipe:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=pipe
+
+partial-build-linux-radv:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=radv
+
+partial-build-linux-rip:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=rip
+
+partial-build-linux-rpki:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=rpki
+
+partial-build-linux-static:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=static
+
+
+################################
+## Netlab functionality tests ##
+################################
+
 build-netlab:
+  <<: *test-job
   stage: build
   variables:
     BDIR: build-netlab
@@ -750,11 +950,9 @@ build-netlab:
       - $BDIR/bird
       - $BDIR/birdc
     expire_in: 2 hours
-  rules:
-  - *never_wip
-  - when: always
 
-.test: &test-base
+.netlab-test: &test-base
+  <<: *test-job
   stage: test
   needs: [build-netlab]
   tags:
@@ -765,14 +963,12 @@ build-netlab:
     - cd $TOOLS_DIR
     - sudo git clean -fx
     - git pull --ff-only
-    - mv $DIR/build-netlab/* netlab/common/
+    - "mv $DIR/build-netlab/* netlab/common/"
     - ln -s $STAYRTR_BINARY netlab/common/stayrtr
     - cd netlab
     - sudo ./stop
     - sudo ./runtest -s v2 -m check $TEST_NAME
-  rules:
-  - *never_wip
-  - when: always
+
 
 test-babel-base:
   <<: *test-base
@@ -869,6 +1065,11 @@ test-bgp-rs-singletab:
   variables:
     TEST_NAME: cf-bgp-rs-singletab
 
+test-ebgp-graceful:
+  <<: *test-base
+  variables:
+    TEST_NAME: cf-ebgp-graceful
+
 test-ebgp-loop:
   <<: *test-base
   variables:
@@ -884,11 +1085,6 @@ test-ebgp-role:
   variables:
     TEST_NAME: cf-ebgp-role
 
-test-ebgp-graceful:
-  <<: *test-base
-  variables:
-    TEST_NAME: cf-ebgp-graceful
-
 test-ebgp-import-limit:
   <<: *test-base
   variables:
@@ -934,106 +1130,3 @@ test-mpls-bgp-l3vpn:
   variables:
     TEST_NAME: cf-mpls-bgp-l3vpn
 
-
-.build-birdlab-base: &build-birdlab-base
-  stage: build
-  script:
-    - autoreconf
-    - ./configure $CONFIGURE_OPTIONS
-    - gmake
-    - gmake check
-  rules:
-  - *never_wip
-  - when: always
-
-# There is no docker for BSD's, these are proper virtuals in QEMU.
-build-birdlab-freebsd-13:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-freebsd-13
-    - amd64
-
-build-birdlab-freebsd-13-netlink:
-  <<: *build-birdlab-base
-  variables:
-    CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
-  tags:
-    - birdlab-freebsd-13
-    - amd64
-
-build-birdlab-freebsd-14:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-freebsd-14
-    - amd64
-
-build-birdlab-freebsd-14-netlink:
-  <<: *build-birdlab-base
-  variables:
-    CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
-  tags:
-    - birdlab-freebsd-14
-    - amd64
-
-build-birdlab-openbsd-75:
-  <<: *build-birdlab-base
-  variables:
-    AUTOCONF_VERSION: "2.71"
-  tags:
-    - birdlab-openbsd-75
-    - amd64
-
-build-birdlab-openbsd-76:
-  <<: *build-birdlab-base
-  variables:
-    AUTOCONF_VERSION: "2.72"
-  tags:
-    - birdlab-openbsd-76
-    - amd64
-
-build-birdlab-netbsd-09:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-netbsd-09
-    - amd64
-
-build-birdlab-netbsd-10:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-netbsd-10
-    - amd64
-
-# We have also some virtuals for these but there are working dockers as well
-# so no need to bother again
-#build-birdlab-debian-11:
-#  <<: *build-birdlab-base
-#  tags:
-#    - birdlab-debian-11
-#    - amd64
-#
-#build-birdlab-centos-08:
-#  <<: *build-birdlab-base
-#  tags:
-#    - birdlab-centos-08
-#    - amd64
-#
-#build-birdlab-fedora-37:
-#  <<: *build-birdlab-base
-#  tags:
-#    - birdlab-fedora-37
-#    - amd64
-
-# Release confirmation job for tag pushing. As soon as we finish our web
-# deployment automatic machinery, clicking the button is expected to
-# publish the release info on our website.
-#
-# We are not there yet tho, too many other fish to fry.
-
-publish-release:
-  stage: release
-  script:
-  - "true"
-  rules:
-  - if: '$CI_COMMIT_TAG'
-    when: manual
-  - when: never
index 321fe817ec94d5bd9755eae5fdf865905070ba5f..bbc1ef29da88e15573b29cd0d806b70822f25eb4 100644 (file)
@@ -68,7 +68,7 @@ endif
 docgoals := docs userdocs progdocs
 testgoals := check test tests tests_run
 cleangoals := clean distclean testsclean
-.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope prepare
+.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope prepare gitlab
 
 all: daemon cli
 
@@ -203,6 +203,18 @@ tags:
 cscope:
        cd $(srcdir) ; find $(dirs) -name '*.[chY]' > cscope.files ; cscope -b
 
+# Gitlab CI tests
+gitlab: .gitlab-ci.yml
+.gitlab-ci.yml: $(addprefix misc/gitlab/,pipeline.py data.yml.j2 template.yml.j2)
+       ( \
+               VENV=$$(mktemp -d); \
+               python3 -m venv $$VENV; \
+               . $$VENV/bin/activate; \
+               pip3 install jinja2 pyaml; \
+               python3 misc/gitlab/pipeline.py > $@ \
+               rm -rf $$VENV \
+               )
+
 # Install
 
 install: all
diff --git a/misc/gitlab/data.yml.j2 b/misc/gitlab/data.yml.j2
new file mode 100644 (file)
index 0000000..6fd6c62
--- /dev/null
@@ -0,0 +1,120 @@
+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: pkg-rpm-wa
+
+  {% for name in (
+    'centos-8',
+    'fedora-32',
+    'fedora-33',
+  ) -%}
+  - name: {{ name }}-amd64
+    type: pkg-rpm-wa
+  {% endfor %}
+
+  # For some unknown reason we also require older Python packages
+  # for OpenSUSE even with the recent versions.
+  {% for num in (0,1,2,3,4,5) -%}
+  - name: opensuse-15.{{ num }}-amd64
+    type: pkg-rpm-wa
+  {% endfor %}
+
+  # Fedora regular builds
+  {% for num in (34, 35, 36, 37, 38, 39, 40, 41, 42) -%}
+  - name: fedora-{{ num }}-amd64
+    type: pkg-rpm
+  {% endfor %}
+
+  # Ubuntu legacy build
+  - name: ubuntu-18.04-amd64
+    type: pkg-deb-legacy
+
+  # Debian regular builds
+  {% for num in (10, 11, 12, 'testing') -%}
+  {% for arch in ('amd64', 'i386') -%}
+  - name: debian-{{num}}-{{arch}}
+    type: pkg-deb
+  {% endfor %}
+  {% endfor %}
+
+  # Ubuntu regular builds
+  {% for num in ('20.04', '22.04', '24.04', '24.10') -%}
+  - name: ubuntu-{{ num }}-amd64
+    type: pkg-deb
+  {% endfor %}
+
+birdlab:
+  - name: openbsd-75
+    variables:
+      AUTOCONF_VERSION: "2.71"
+
+  - 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: ibgp-loop
+  - name: ibgp-loop-big
+  - name: ibgp-flat
+  - name: rip-base
+  - name: kernel-learn
+  - name: mpls-bgp
+  - name: mpls-bgp-l3vpn
diff --git a/misc/gitlab/pipeline.py b/misc/gitlab/pipeline.py
new file mode 100755 (executable)
index 0000000..1ac7678
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+
+import importlib
+import jinja2
+import pathlib
+import subprocess
+import sys
+import yaml
+
+# Find where we are
+localdir = pathlib.Path(__file__).parent
+
+# Prepare Jinja2 environment
+env = jinja2.Environment(loader=jinja2.FileSystemLoader(str(localdir)))
+env.filters.update({ "to_yaml": lambda x: "" if type(x) is jinja2.runtime.Undefined else yaml.dump(x).rstrip() })
+
+# Load and process input data
+try:
+    data = yaml.safe_load(rendered := env.get_template(f'data.yml.j2').render({}))
+except yaml.parser.ParserError as e:
+    print("Failed to render input data, generated output here:")
+    print(rendered)
+    raise e
+
+# Load the actual template
+template = env.get_template(f'template.yml.j2')
+
+# Render the template
+final = template.render({ **data })
+
+# YAML is picky about tabs, forbid them
+assert('\t' not in final)
+
+# Produce output
+print(final)
diff --git a/misc/gitlab/template.yml.j2 b/misc/gitlab/template.yml.j2
new file mode 100644 (file)
index 0000000..b6c77c6
--- /dev/null
@@ -0,0 +1,340 @@
+###########################################################
+#####                                                 #####
+#####       DO  NOT  EDIT  THIS  FILE  BY  HAND       #####
+#####                                                 #####
+###########################################################
+#####                                                 #####
+##### This file is autogenerated from misc/gitlab/.   #####
+##### Edit those files and run `make gitlab` instead. #####
+#####                                                 #####
+###########################################################
+
+variables:
+  DEBIAN_FRONTEND: noninteractive
+  LC_ALL: C.UTF-8
+  GIT_STRATEGY: fetch
+  DOCKER_CMD: docker --config="$HOME/.docker/$CI_JOB_ID/"
+  IMG_BASE: registry.nic.cz/labs/bird
+  TOOLS_DIR: /home/gitlab-runner/bird-tools
+  STAYRTR_BINARY: /usr/bin/stayrtr
+
+stages:
+  - consistency
+  - image
+  - build
+  - pkg
+  - test
+
+## Common rules
+# Ignore WIP commits
+.never-wip: &never-wip
+  if: $CI_COMMIT_MESSAGE =~ /^(fixup! )*WIP/
+  when: never
+# Run for stable branches
+.if-stable: &if-stable
+  if: $CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/
+  when: always
+
+## Consistency checks for stable branches
+commit-messages:
+  stage: consistency
+  script:
+  - tools/git-check-commits
+  rules:
+  - *if-stable
+  - when: never
+
+## Default test job rules
+.test-job: &test-job
+  rules:
+  - *never-wip
+  - when: always
+
+############################
+## Docker builder rebuild ##
+############################
+# We are running all the build / packaging tests in Dockers (unless otherwise)
+# and these are rules to build these docker images. These are expensive to run
+# and should run only if needed.
+#
+# Modify the appropriate dockerfile to rebuild these images
+
+.docker: &docker-build
+  stage: image
+  script:
+  - $DOCKER_CMD login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.nic.cz
+  # Make sure we refresh the base image if it updates (eg. security updates, etc)
+  # If we do just the build, cache is always reused and the freshness of the
+  # base image is never checked. However, pull always asks and updates the
+  # image only if it changed ‒ therefore, the cache is used unless there's a
+  # change.
+  - $DOCKER_CMD pull `sed -ne 's/^FROM //p' "misc/docker/$IMG_NAME/Dockerfile"`
+  - $DOCKER_CMD build -t "bird:$IMG_NAME" "misc/docker/$IMG_NAME"
+  - $DOCKER_CMD tag "bird:$IMG_NAME" "$IMG_BASE:$IMG_NAME"
+  - $DOCKER_CMD push "$IMG_BASE:$IMG_NAME"
+  after_script:
+  - rm -f "$HOME/.docker/$CI_JOB_ID/" # cleanup the credentials
+  tags:
+  # That's Docker in Docker
+  - dind
+  rules:
+    # Never rebuild for WIP commits
+  - *never-wip
+
+    # Never rebuild for tags
+  - if: '$CI_COMMIT_TAG'
+    when: never
+
+    # Never rebuild for new branches
+  - if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
+    when: never
+
+    # Do any change in Dockerfile (e.g. change a comment) to rebuild the image
+    # FIXME: This probably belongs to bird-tools instead, we may end up with
+    # screwed up docker repository in case of colliding image updates
+  - changes:
+    - misc/docker/$IMG_NAME/Dockerfile
+    when: always
+
+  - when: never
+
+{% for docker in [ { "name": "docbuilder" } ] + distros %}
+docker-{{ docker["name"] }}:
+  variables:
+    IMG_NAME: "{{ docker["name"] }}"
+  <<: *docker-build
+{% endfor %}
+
+#####################################################
+## Linux distro build tests inside Docker builders ##
+#####################################################
+
+## Build stage
+#
+# Now we compile and run unit tests ... in every single distribution.
+# Every task needs its docker, see above.
+
+.build: &build-base
+  <<: *test-job
+  stage: build
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - autoreconf
+    - ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" $CONFIGURE_OPTIONS
+    # Detect which make is available
+    - MAKE=make
+    - which gmake 2>/dev/null >/dev/null && MAKE=gmake
+    - $MAKE
+    - $MAKE check
+    # Build docs when tools are available
+    - if which linuxdoc pdflatex sgmlsasp >/dev/null ; then $MAKE docs ; fi
+
+.build-docker-linux-amd64: &build-docker-linux-amd64
+  <<: *build-base
+  tags:
+    - docker
+    - linux
+    - amd64
+
+{% for dist in distros %}
+build-{{dist["name"]}}:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-{{ dist["name"] }}
+      optional: true
+  image: registry.nic.cz/labs/bird:{{ dist["name"] }}
+{%- if 'variables' in dist %}
+  variables:
+{{ dist["variables"] | to_yaml | indent(4, true) }}
+{%- endif %}
+{% endfor %}
+
+#######################################################
+## A special task for preparing the release archives ##
+#######################################################
+build-release:
+  <<: *test-job
+  image: registry.nic.cz/labs/bird:docbuilder
+  needs: 
+    - job: docker-docbuilder
+      optional: true
+  stage: build
+  tags:
+    - docker
+    - linux
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - autoreconf
+    - ./configure --with-protocols= --disable-client
+    - make obj/doc/bird-singlepage.html
+    - tools/make-archive
+  artifacts:
+    paths:
+      - obj/doc/bird-singlepage.html
+      - bird-*.tar.gz
+    expire_in: 1 day
+
+# Packaging rules
+# As we support some ancient versions of different distributions,
+# we need to keep several different machineries. It's not so bad
+# but it's bad nevertheless.
+#
+# We do NOT build separate documentation packages in these rules.
+
+.pkg-deb: &pkg-deb
+  <<: *test-job
+  stage: pkg
+  script:
+    # create venv only if it's installed
+    - if python3 -m venv venv; then . venv/bin/activate; fi
+    - pip3 install apkg
+    - BRANCH=$CI_COMMIT_BRANCH ARCHIVE_DOCS=false apkg build
+    #- apkg install -y pkg/pkgs/*/*/*.deb
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+
+.pkg-deb-legacy: &pkg-deb-legacy
+  <<: *test-job
+  stage: pkg
+  script:
+    # create venv only if it's installed
+    - if python3 -m venv venv; then . venv/bin/activate; fi
+    # install older version of bs4 that does not use python version >= 3.6
+    # apkg depends on bs4, and unless we want to backport python 3.6
+    # to ancient distros, we need to do this workaround
+    - pip3 install beautifulsoup4==4.11.2
+    - pip3 install apkg
+    - BRANCH=$CI_COMMIT_BRANCH ARCHIVE_DOCS=false apkg build
+    #- apkg install -y pkg/pkgs/*/*/*.deb
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+
+.pkg-rpm: &pkg-rpm
+  <<: *test-job
+  stage: pkg
+  script:
+    - pip3 install apkg
+    - BRANCH=$CI_COMMIT_BRANCH ARCHIVE_DOCS=false apkg build
+    #- apkg install -y pkg/pkgs/*/*/*.rpm
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+
+.pkg-rpm-wa: &pkg-rpm-wa
+  <<: *test-job
+  stage: pkg
+  script:
+    - sed -i "s/runstatedir/with-runtimedir/" distro/pkg/rpm/bird.spec
+    # install older version of bs4 that does not use python version >= 3.6
+    - pip3 install beautifulsoup4==4.11.2
+    - pip3 install apkg
+    - BRANCH=$CI_COMMIT_BRANCH ARCHIVE_DOCS=false apkg build
+    #- apkg install -y pkg/pkgs/*/*/*.rpm
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+
+
+{% for dist in distros %}
+pkg-{{ dist["name"] }}:
+  <<: *{{ dist["type"] }}
+  needs: [ build-{{ dist["name"] }} ]
+  image: registry.nic.cz/labs/bird:{{ dist["name"] }}
+{%- if 'variables' in dist %}
+  variables:
+{{ dist["variables"] | to_yaml | indent(4, true) }}
+{%- endif %}
+{% endfor %}
+
+###################################
+## Non-linux build tests in QEMU ##
+###################################
+.build-birdlab-base: &build-birdlab-base
+  <<: *test-job
+  stage: build
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - autoreconf
+    - ./configure $CONFIGURE_OPTIONS
+    - gmake
+    - gmake check
+
+{% for test in birdlab %}
+build-birdlab-{{ test['name'] }}:
+  <<: *build-birdlab-base
+{%- if 'variables' in test %}
+  variables:
+{{ test['variables'] | to_yaml | indent(4, true) }}{%- endif %}
+  tags:
+    - birdlab-{{ test['dist'] if 'dist' in test else test['name'] }}
+    - amd64
+{% endfor %}
+
+#########################
+## Partial build tests ##
+#########################
+
+.build-only: &build-only
+  <<: *build-docker-linux-amd64
+  image: registry.nic.cz/labs/bird:{{ partial_build_image["name"] }}
+  needs:
+    - job: docker-{{ partial_build_image["name"] }}
+      optional: true
+
+{% for test in partial_build %}
+partial-build-linux-{{ test["protocols"] }}:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols={{ test["protocols"] }}
+{% endfor %}
+
+################################
+## Netlab functionality tests ##
+################################
+
+build-netlab:
+  <<: *test-job
+  stage: build
+  variables:
+    BDIR: build-netlab
+  tags:
+    - netlab
+    - amd64
+  script:
+    - autoreconf
+    - mkdir $BDIR
+    - cd $BDIR
+    - ../configure
+    - BRANCH=$CI_COMMIT_BRANCH make
+  artifacts:
+    paths:
+      - $BDIR/bird
+      - $BDIR/birdc
+    expire_in: 2 hours
+
+.netlab-test: &test-base
+  <<: *test-job
+  stage: test
+  needs: [build-netlab]
+  tags:
+    - netlab
+    - amd64
+  script:
+    - DIR=$(pwd)
+    - cd $TOOLS_DIR
+    - sudo git clean -fx
+    - git pull --ff-only
+    - "mv $DIR/build-netlab/* netlab/common/"
+    - ln -s $STAYRTR_BINARY netlab/common/stayrtr
+    - cd netlab
+    - sudo ./stop
+    - sudo ./runtest -s v2 -m check $TEST_NAME
+
+{% for test in netlab %}
+test-{{ test["name"] }}:
+  <<: *test-base
+  variables:
+    TEST_NAME: cf-{{ test["name"] }}
+{% endfor %}
diff --git a/tools/git-is-stable-branch b/tools/git-is-stable-branch
new file mode 100755 (executable)
index 0000000..1cef969
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+case "$1" in
+  master | thread-next | stable-* )
+    exit 0;
+esac
+
+exit 1