Skip to content

Commit 69b3109

Browse files
committed
ci: add ci-fairy linter to make sure commits are GPG signed
1 parent 558a3c2 commit 69b3109

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.gitlab-ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
include:
22
- template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'
33

4+
# https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
5+
workflow:
6+
rules:
7+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
8+
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
9+
when: never
10+
- if: $CI_COMMIT_BRANCH
11+
- if: $CI_COMMIT_TAG
12+
413
default:
514
tags:
615
- docker
@@ -24,6 +33,26 @@ whitespace:
2433
script:
2534
- git diff-tree --check origin/master HEAD
2635

36+
# Make sure commits are GPG signed
37+
ci-fairy:
38+
image: 'debian:bookworm-slim'
39+
stage: test
40+
script:
41+
- apt update
42+
- apt install -y python3-pip git
43+
- pip3 install --break-system-packages git+https://gitlab.freedesktop.org/freedesktop/ci-templates@7811ba9814a3bad379377241c6c6b62d78b20eac
44+
- echo Checking commits $CI_FAIRY_BASE_COMMIT..HEAD
45+
- ci-fairy check-commits --gpg-signed-commit $CI_FAIRY_BASE_COMMIT..HEAD
46+
tags:
47+
- 'docker'
48+
rules:
49+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
50+
variables:
51+
CI_FAIRY_BASE_COMMIT: $CI_MERGE_REQUEST_DIFF_BASE_SHA
52+
- if: $CI_PIPELINE_SOURCE != "merge_request_event"
53+
variables:
54+
CI_FAIRY_BASE_COMMIT: 'HEAD^1'
55+
2756
autoconf:
2857
stage: build
2958
before_script:

0 commit comments

Comments
 (0)