From 792115b20c84aa1cdee64272a5dbc44342710038 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 30 Aug 2023 20:24:11 -0500 Subject: [PATCH 1/3] Add Dockerfile used to build CI image Signed-off-by: Mario Limonciello --- Dockerfile | 10 ++++++++++ check_whence.py | 1 + 2 files changed, 11 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..9350dc71 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +# Leverage FDO CI fairy, but add pre-commit to it +FROM quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-eb20531b68e57da06f4e631402fd494869b1529e2c4ad05cfe24ef3fb8038815 +RUN apk add python3-dev +RUN apk add gcc +RUN apk add musl-dev +RUN apk add git +RUN apk add npm +RUN apk add rdfind +RUN apk add shellcheck +RUN pip install pre-commit --ignore-installed distlib diff --git a/check_whence.py b/check_whence.py index 884e8d0c..59a71990 100755 --- a/check_whence.py +++ b/check_whence.py @@ -81,6 +81,7 @@ def main(): "README.md", "copy-firmware.sh", "WHENCE", + "Dockerfile", ] ) known_prefixes = set(name for name in whence_list if name.endswith("/")) From 69e68cde08fa58f2c53c5cac0b2148f833f08123 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Tue, 29 Aug 2023 22:00:04 -0500 Subject: [PATCH 2/3] Add gitlab ci for calling pre-commit and ci-fairy Signed-off-by: Mario Limonciello --- .gitlab-ci.yml | 11 +++++++++++ check_whence.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..ae001d16 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,11 @@ + +check-commits: + image: registry.gitlab.com/kernel-firmware/linux-firmware + script: + - ci-fairy check-commits --signed-off-by + +pre-commit: + image: registry.gitlab.com/kernel-firmware/linux-firmware + script: + - pre-commit run --all-files + diff --git a/check_whence.py b/check_whence.py index 59a71990..db6ac0f5 100755 --- a/check_whence.py +++ b/check_whence.py @@ -74,6 +74,7 @@ def main(): [ ".gitignore", ".codespell.cfg", + ".gitlab-ci.yml", ".pre-commit-config.yaml", "check_whence.py", "configure", From b2f03c845a210dc9f8ef48c0db761e3e02575eec Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 30 Aug 2023 21:19:49 -0500 Subject: [PATCH 3/3] Add a rule for automatic tagging releases by pipeline schedule This requires a personal access token with write repository permissions to be created and a pipeline scheduled with the RELEASE_TOKEN masked variable set. When that combination is done, a tag is automatically created following `YYYYMMDD` syntax when the pipeline runs. Signed-off-by: Mario Limonciello --- .gitlab-ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae001d16..7e5abc58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,23 @@ - check-commits: + stage: test image: registry.gitlab.com/kernel-firmware/linux-firmware script: - ci-fairy check-commits --signed-off-by pre-commit: + stage: test image: registry.gitlab.com/kernel-firmware/linux-firmware script: - pre-commit run --all-files +release: + stage: deploy + rules: + - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME + when: never + - if: $RELEASE_TOKEN + script: + - CI_PUSH_REPO=`echo "$CI_REPOSITORY_URL" | sed 's/^.*@/@/g'` + - git remote set-url --push origin "https://gitlab-ci-token:${RELEASE_TOKEN}$CI_PUSH_REPO" + - git tag `date "+%Y%m%d"` + - git push --tags