Commit 0f1abc24 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

ci-fairy: allow a Revert commit shortlog to exceed the text width

Fixes #27

Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 210e847c
Pipeline #243900 passed with stages
in 2 minutes and 20 seconds
......@@ -154,7 +154,7 @@ ci-fairy images:
.ci-fairy-tag:
variables:
FDO_DISTRIBUTION_TAG: sha256-7c065dbe56844cd44c7149a82f53e9b9d7ac2b24d61daba53bf7a08615bdca38
FDO_DISTRIBUTION_TAG: sha256-936060119966b261c07af69d9422ee970cb2f37a355ba8509dceeaee70633349
.ci-fairy-local-image:
extends:
......@@ -292,7 +292,7 @@ test published images:
script:
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:buildah-aarch64-2020-10-30.1
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:buildah-x86_64-2020-10-30.1
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-7c065dbe56844cd44c7149a82f53e9b9d7ac2b24d61daba53bf7a08615bdca38
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-936060119966b261c07af69d9422ee970cb2f37a355ba8509dceeaee70633349
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:qemu-base-x86_64-2020-10-30.1
- skopeo inspect docker://quay.io/freedesktop.org/ci-templates:qemu-mkosi-base-x86_64-2020-10-30.1
rules:
......
......@@ -19,7 +19,7 @@ ci-fairy-base-image:
.ci-fairy-tag:
variables:
FDO_DISTRIBUTION_TAG: sha256-7c065dbe56844cd44c7149a82f53e9b9d7ac2b24d61daba53bf7a08615bdca38
FDO_DISTRIBUTION_TAG: sha256-936060119966b261c07af69d9422ee970cb2f37a355ba8509dceeaee70633349
# The actual ci-fairy image with ci-fairy installed
# This image uses the sha of the ci-fairy script itself as tag.
......
......@@ -31,6 +31,6 @@
# Variables provided by this template should be considered read-only.
#
.fdo.ci-fairy:
image: quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-7c065dbe56844cd44c7149a82f53e9b9d7ac2b24d61daba53bf7a08615bdca38
image: quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-936060119966b261c07af69d9422ee970cb2f37a355ba8509dceeaee70633349
variables:
FDO_DISTRIBUTION_IMAGE: quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-7c065dbe56844cd44c7149a82f53e9b9d7ac2b24d61daba53bf7a08615bdca38
\ No newline at end of file
FDO_DISTRIBUTION_IMAGE: quay.io/freedesktop.org/ci-templates:ci-fairy-sha256-936060119966b261c07af69d9422ee970cb2f37a355ba8509dceeaee70633349
\ No newline at end of file
......@@ -216,7 +216,9 @@ class GitCommitValidator(object):
lines = self.commit.message.split('\n')
shortlog = lines[0]
if len(shortlog) >= tw:
self.__error(f'Commit message subject must not exceed {tw} characters')
is_revert = shortlog.startswith('Revert "') and "This reverts commit" in self.commit.message
if not is_revert:
self.__error(f'Commit message subject must not exceed {tw} characters')
@property
def failed(self):
......
......@@ -896,6 +896,25 @@ def test_commits_msgformat(caplog, gitlab_default_env):
result = runner.invoke(ci_fairy.ci_fairy, args)
assert result.exit_code == 0
# Fake the revert here because ci-fairy runs against the previous
# commits too. If we have a commit with a long line and revert that
# we would pass the revert commit but still fail on the original
# commit. Easiest to just fake a revert commit ourselves.
b = repo.create_head('mybranch4', 'master')
repo.head.reference = b
repo.head.reset(index=True, working_tree=True)
with open('test', 'w') as fd:
fd.write('bar')
repo.index.add(['test'])
msg = '''Revert "one two three one two three one two three one two three one two three"
This reverts commit 123456
'''
repo.index.commit(msg)
result = runner.invoke(ci_fairy.ci_fairy, args)
# Revert line may have a longer line than allowed
assert result.exit_code == 0
def test_commits_gitlabemail(caplog, gitlab_default_env):
env = gitlab_default_env
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment