forked from osmocom/wireshark
GitLab CI: Fix our common rules.
There are three ways to reuse configuration blobs in .gitlab-ci.yml: The "extends" keyword, YAML anchors, and "!reference" tags. As noted in https://gitlab.com/gitlab-org/gitlab/-/issues/322992, only the last method works for job rules. Clean up our common rules and apply them using "!reference".
This commit is contained in:
parent
6555cfe885
commit
3de0a93759
109
.gitlab-ci.yml
109
.gitlab-ci.yml
|
@ -33,33 +33,32 @@ variables:
|
|||
# - coverity-visual-c++: Monday, Wednesday, & Friday at 12:00 UTC
|
||||
# - coverity-gcc: Sunday, Tuesday, Thursday & Saturday at 12:00 UTC
|
||||
|
||||
# Common rules
|
||||
# Common rule stanzas
|
||||
# These must currently be including using "!reference tags". "extends:" and
|
||||
# YAML anchors won't work:
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/322992
|
||||
|
||||
# Commits that have been approved and merged. Run automatically in the main
|
||||
# repo and allow manual runs in forks.
|
||||
.if-merged:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_URL =~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
when: always
|
||||
- if: '$CI_PROJECT_URL !~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
when: manual
|
||||
- when: never
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_URL =~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
when: always
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_URL !~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
when: manual
|
||||
# Incoming merge requests.
|
||||
.if-merge-request:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
when: always
|
||||
# Incoming non-detached merge requests. Must be used for runners which are only
|
||||
# available in wireshark/wireshark, e.g. wireshark-windows-*
|
||||
.if-attached-merge-request:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_PROJECT_URL =~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
when: always
|
||||
# Daily jobs
|
||||
# Schedules don't appear to work with "extends" or YAML anchors, unfortunately.
|
||||
# .if-daily-schedule
|
||||
# rules:
|
||||
# - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "daily"'
|
||||
# when: always
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_PROJECT_URL =~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
when: always
|
||||
# Daily jobs. Care should be taken when changing this since the scheduler
|
||||
# often doesn't report errors.
|
||||
.if-daily-schedule:
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "daily"'
|
||||
when: always
|
||||
|
||||
.build:
|
||||
stage: build
|
||||
|
@ -148,18 +147,16 @@ variables:
|
|||
|
||||
# Rely on fedora:latest and debian-stable jobs for testing a recent GCC version.
|
||||
clang-latest:
|
||||
extends:
|
||||
- .build-ubuntu
|
||||
- .if-merged
|
||||
extends: .build-ubuntu
|
||||
rules: !reference [.if-merged]
|
||||
variables:
|
||||
CC: "clang-$CLANG_VERSION"
|
||||
CXX: "clang++-$CLANG_VERSION"
|
||||
|
||||
build:ubuntu-dist:
|
||||
extends: .build-ubuntu
|
||||
stage: .pre
|
||||
extends:
|
||||
- .build-ubuntu
|
||||
- .if-merged
|
||||
rules: !reference [.if-merged]
|
||||
script:
|
||||
- perl ../tools/make-version.pl --set-release || ../perl make-version.pl --set-release
|
||||
- cmake -G Ninja $CMAKE_ARGS -DENABLE_CCACHE=ON ..
|
||||
|
@ -179,6 +176,7 @@ build:ubuntu-dist:
|
|||
# https://gitlab.com/wireshark/wireshark-containers/-/tree/master/dev/centos-7
|
||||
build:rpm-centos-7:
|
||||
extends: .build-rpm
|
||||
rules: !reference [.if-merged]
|
||||
image: wireshark/wireshark-centos-7-dev
|
||||
script:
|
||||
- cmake3 -GNinja ..
|
||||
|
@ -186,6 +184,7 @@ build:rpm-centos-7:
|
|||
needs:
|
||||
- build:ubuntu-dist
|
||||
test:rpm-centos-7:
|
||||
rules: !reference [.if-merged]
|
||||
stage: test
|
||||
image: wireshark/wireshark-centos-7-dev
|
||||
script:
|
||||
|
@ -198,6 +197,7 @@ test:rpm-centos-7:
|
|||
|
||||
build:rpm-centos-8:
|
||||
extends: .build-rpm
|
||||
rules: !reference [.if-merged]
|
||||
image: wireshark/wireshark-centos-8-dev
|
||||
script:
|
||||
- cmake -GNinja ..
|
||||
|
@ -205,6 +205,7 @@ build:rpm-centos-8:
|
|||
needs:
|
||||
- build:ubuntu-dist
|
||||
test:rpm-centos-8:
|
||||
rules: !reference [.if-merged]
|
||||
stage: test
|
||||
image: wireshark/wireshark-centos-8-dev
|
||||
script:
|
||||
|
@ -216,14 +217,16 @@ test:rpm-centos-8:
|
|||
GIT_STRATEGY: none
|
||||
|
||||
build:rpm-opensuse-15.2:
|
||||
image: wireshark/wireshark-opensuse-15.2-dev
|
||||
extends: .build-rpm
|
||||
rules: !reference [.if-merged]
|
||||
image: wireshark/wireshark-opensuse-15.2-dev
|
||||
script:
|
||||
- cmake -GNinja ..
|
||||
- ninja rpm-package
|
||||
needs:
|
||||
- build:ubuntu-dist
|
||||
test:rpm-opensuse-15.2:
|
||||
rules: !reference [.if-merged]
|
||||
image: wireshark/wireshark-opensuse-15.2-dev
|
||||
stage: test
|
||||
script:
|
||||
|
@ -236,6 +239,7 @@ test:rpm-opensuse-15.2:
|
|||
|
||||
build:rpm-fedora:
|
||||
extends: .build-rpm
|
||||
rules: !reference [.if-merged]
|
||||
image: wireshark/wireshark-fedora-dev
|
||||
script:
|
||||
# Shared GitLab runners limit the log size to 4M, so reduce verbosity. See
|
||||
|
@ -246,6 +250,7 @@ build:rpm-fedora:
|
|||
needs:
|
||||
- build:ubuntu-dist
|
||||
# test:rpm-fedora:
|
||||
# rules: !reference [.if-merged]
|
||||
# image: fedora
|
||||
# stage: test
|
||||
# script:
|
||||
|
@ -258,9 +263,8 @@ build:rpm-fedora:
|
|||
|
||||
# Job to generate packages for Debian stable
|
||||
build:debian-stable:
|
||||
extends:
|
||||
- .build
|
||||
- .if-merged
|
||||
extends: .build
|
||||
rules: !reference [.if-merged]
|
||||
image: wireshark/wireshark-debian-stable-dev
|
||||
script:
|
||||
- perl tools/make-version.pl --set-release
|
||||
|
@ -276,6 +280,7 @@ build:debian-stable:
|
|||
- debian-packages/*.deb
|
||||
expire_in: 3 days
|
||||
test:debian-stable:
|
||||
rules: !reference [.if-merged]
|
||||
image: wireshark/wireshark-debian-stable-dev
|
||||
stage: test
|
||||
script:
|
||||
|
@ -292,9 +297,13 @@ docbook:
|
|||
stage: build
|
||||
image: wireshark/wireshark-ubuntu-dev
|
||||
rules:
|
||||
- changes:
|
||||
- "docbook/**"
|
||||
- "epan/wslua/**"
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_URL =~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
changes:
|
||||
- "docbook/**"
|
||||
- "epan/wslua/**"
|
||||
when: always
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_URL !~ /.*gitlab.com\/wireshark\/wireshark/'
|
||||
when: manual
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
|
@ -317,9 +326,7 @@ docbook:
|
|||
# Build all doxygen docs
|
||||
doxygen_all:
|
||||
image: wireshark/wireshark-ubuntu-dev
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "daily"'
|
||||
when: always
|
||||
rules: !reference [.if-daily-schedule]
|
||||
stage: build
|
||||
script:
|
||||
- mkdir build
|
||||
|
@ -341,9 +348,8 @@ doxygen_all:
|
|||
# https://docs.gitlab.com/ee/user/gitlab_com/index.html#linux-shared-runners
|
||||
|
||||
merge-req:commit-checks:
|
||||
extends:
|
||||
- .build-ubuntu
|
||||
- .if-merge-request
|
||||
extends: .build-ubuntu
|
||||
rules: !reference [.if-merge-request]
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
|
@ -353,9 +359,8 @@ merge-req:commit-checks:
|
|||
- tools/validate-commit.py
|
||||
|
||||
merge-req:ubuntu-dpkg:
|
||||
extends:
|
||||
- .build-ubuntu
|
||||
- .if-merge-request
|
||||
extends: .build-ubuntu
|
||||
rules: !reference [.if-merge-request]
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
|
@ -369,9 +374,8 @@ merge-req:ubuntu-dpkg:
|
|||
- ccache --max-size $( du --summarize --block-size=1M --total "$CI_PROJECT_DIR"/obj-* | awk '/total$/ {printf ("%dM", $1 * 1.25)}' )
|
||||
|
||||
merge-req:ubuntu-gcc-ctest:
|
||||
extends:
|
||||
- .build-ubuntu
|
||||
- .if-merge-request
|
||||
extends: .build-ubuntu
|
||||
rules: !reference [.if-merge-request]
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
|
@ -387,9 +391,8 @@ merge-req:ubuntu-gcc-ctest:
|
|||
- gcc_report.html
|
||||
|
||||
merge-req:ubuntu-clang-other-tests:
|
||||
extends:
|
||||
- .build-ubuntu
|
||||
- .if-merge-request
|
||||
extends: .build-ubuntu
|
||||
rules: !reference [.if-merge-request]
|
||||
tags:
|
||||
- docker
|
||||
variables:
|
||||
|
@ -421,9 +424,8 @@ merge-req:ubuntu-clang-other-tests:
|
|||
# Windows runners are still beta, at least technically:
|
||||
# https://docs.gitlab.com/ee/user/gitlab_com/index.html#windows-shared-runners-beta
|
||||
merge-req:windows:
|
||||
extends:
|
||||
- .build-windows
|
||||
- .if-attached-merge-request
|
||||
extends: .build-windows
|
||||
rules: !reference [.if-attached-merge-request]
|
||||
tags:
|
||||
- wireshark-windows-merge-req
|
||||
script:
|
||||
|
@ -486,9 +488,7 @@ coverity-visual-c++:
|
|||
|
||||
clang-scan-build:
|
||||
image: wireshark/wireshark-ubuntu-dev
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "daily"'
|
||||
when: always
|
||||
rules: !reference [.if-daily-schedule]
|
||||
stage: analysis
|
||||
needs: []
|
||||
variables:
|
||||
|
@ -525,13 +525,10 @@ build:windows-vs-code-analysis:
|
|||
|
||||
sloccount:
|
||||
extends: .build-ubuntu
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "daily"'
|
||||
when: always
|
||||
rules: !reference [.if-daily-schedule]
|
||||
stage: analysis
|
||||
variables:
|
||||
SLOC_OUT: sloccount.txt
|
||||
needs: []
|
||||
script:
|
||||
- cmake -G Ninja ..
|
||||
- ninja
|
||||
|
|
Loading…
Reference in New Issue