From: Maria Matejka Date: Thu, 12 Jun 2025 09:55:21 +0000 (+0200) Subject: CI: Fix tests for merge requests X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=739ba21c88f9f7e4cc44ed0bb0ea6b93412ea02d;p=thirdparty%2Fbird.git CI: Fix tests for merge requests The branch name check needed to be extended to include merge requests. Now for merge requests, we generate a fake branch name. --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d3c07be74..8666c0bda 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,7 +33,7 @@ stages: when: never # Run for stable branches .if-stable: &if-stable - if: $CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/ + if: ($CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/ || $CI_PIPELINE_SOURCE == "merge_request_event") when: always # Do run for tags .if-tag: &if-tag @@ -319,7 +319,7 @@ docker-ubuntu-24.10-amd64: <<: *test-job stage: build script: - - export BRANCH=$CI_COMMIT_BRANCH + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - tools/version && ( echo -n "BIRD version "; tools/version ) > version-expected - | STABLE_VERSION="`cat VERSION`" @@ -617,7 +617,7 @@ build-release: - docker - linux script: - - export BRANCH=$CI_COMMIT_BRANCH + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - autoreconf - ./configure --with-protocols= --disable-client - make obj/doc/bird-singlepage.html @@ -1368,11 +1368,12 @@ build-netlab: - netlab - amd64 script: + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - autoreconf - mkdir $BDIR - cd $BDIR - ../configure - - BRANCH=$CI_COMMIT_BRANCH make + - make artifacts: paths: - $BDIR/bird diff --git a/misc/gitlab/template.yml.j2 b/misc/gitlab/template.yml.j2 index 00019486f..743c442d1 100644 --- a/misc/gitlab/template.yml.j2 +++ b/misc/gitlab/template.yml.j2 @@ -33,7 +33,7 @@ stages: when: never # Run for stable branches .if-stable: &if-stable - if: $CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/ + if: ($CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/ || $CI_PIPELINE_SOURCE == "merge_request_event") when: always # Do run for tags .if-tag: &if-tag @@ -149,7 +149,7 @@ docker-{{ docker["name"] }}: <<: *test-job stage: build script: - - export BRANCH=$CI_COMMIT_BRANCH + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - tools/version && ( echo -n "BIRD version "; tools/version ) > version-expected - | STABLE_VERSION="`cat VERSION`" @@ -217,7 +217,7 @@ build-release: - docker - linux script: - - export BRANCH=$CI_COMMIT_BRANCH + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - autoreconf - ./configure --with-protocols= --disable-client - make obj/doc/bird-singlepage.html @@ -405,11 +405,12 @@ build-netlab: - netlab - amd64 script: + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - autoreconf - mkdir $BDIR - cd $BDIR - ../configure - - BRANCH=$CI_COMMIT_BRANCH make + - make artifacts: paths: - $BDIR/bird