Commit graph

34 commits

Author SHA1 Message Date
Mark Andrews
d773b15561 Update dangerfile.py to know about ':cve:'
(cherry picked from commit dbc2167325)
2023-10-17 13:19:28 +11:00
Aram Sargsyan
b17948622b Don't warn about subject line length for the fixup commits
The fixup commits' subject line has a prefix which has its own
length, so warning about the exceeding length is not accurate.
Given that the fixup commits can not be merged, because they
cause a danger failure, it's safe to ignore the length check
for them.

(cherry picked from commit 3db2beef9f)
2023-09-14 11:00:10 +00:00
Michal Nowak
dd996601d0
Add a friendly Danger plea to run the pairwise CI job
Sometimes a pairwise definition for a new ./configure switch is added
but not tested in the CI.

(cherry picked from commit 96563c6020)
2023-05-19 14:34:54 +02:00
Mark Andrews
66da661eff Teach danger about amend
commit --fixup=amend:<hash> produces a subject starting with amend!
by default.  Have danger look for this to ensure that it is squashed
before merging.

(cherry picked from commit 9b12473292)
2023-01-28 09:18:32 +11:00
Tom Krizek
1ee31187db
danger: relax rules for single-line commits
The following are not also accepted as single-line commits without
generating warnings:
- CHANGES/release note may appear in the beginning of the commit message
- Release note may be capitalized
- Allow commits with "GL #" (e.g. Update documentation for [GL #XXXX])

(cherry picked from commit 79ae467973)
2023-01-27 14:50:14 +01:00
Tom Krizek
1bc4186e39
danger: update CHANGES rule to work with -S edition
When updating the -S edition, the CHANGES.SE file is modified. Make sure
danger accepts that.

(cherry picked from commit 1939e585c0)
2023-01-27 14:50:08 +01:00
Tom Krizek
122c3f00e9
danger: check the Affects labels are set
Unless the MR is a backport, the Affects labels should be used to
indicate which versions are affected by the issue that prompted the MR.

(cherry picked from commit 64d71a1f5f)
2022-12-23 09:53:34 +01:00
Tom Krizek
413e94f2ca
danger: check version in MR title
Enforce the version indicator to be at the start of the MR title.

(cherry picked from commit d1172e011c)
2022-12-23 09:53:31 +01:00
Tom Krizek
9438051e86
danger: remove obsolete check for cherry pick msg
With proper backport commit detection, this check has been made
redundant.

(cherry picked from commit e8a5ebaee5)
2022-12-16 14:22:05 +01:00
Tom Krizek
90ce669183
danger: check backport commits for original commit IDs
A full backport must have all the commit from the original MR and the
original commit IDs must be referenced in the backport commit messages.

If the criteria above is not met, the MR should be marked as a partial
backport. In that case, any discrepencies are only logged as informative
messages rather than failures.

(cherry picked from commit c617f97784)
2022-12-16 14:22:05 +01:00
Tom Krizek
d03cbcf1f5
danger: check that original MR has been merged
When checking a backport MR, ensure that the original MR has been merged
already. This is vital for followup checks that verify commit IDs from
original commits are present in backport commit messages.

(cherry picked from commit 89530f1a1c)
2022-12-16 14:22:05 +01:00
Tom Krizek
dcfaba5398
danger: check backport links to the original MR
When doing archeology, it is much easier to find stuff if it's properly
linked. This check ensures that backport MR are linked to their original
MR via a "Backport of !XXXX" message.

The regular expression is fairly broad and has been tested to accept the
following variants of the message:
Backport of MR !XXXX
Backport of: !XXXX
backport of mr !XXXX
Backport of   !XXXX
Backport of https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/XXXX

(cherry picked from commit 12e0b05738)
2022-12-16 14:22:05 +01:00
Tom Krizek
ef9cecb79a
danger: ensure target branch is in the MR title
Having the MR title clearly marked in its title can be very useful when
looking through older issues/MRs.

This check also ensures that the version from the version label matches
the proper version branch (i.e. v9.16 must be marked with [v9_16]).

(cherry picked from commit 14b027cf83)
2022-12-16 14:22:04 +01:00
Tom Krizek
5e31882596
danger: support partial backport label
Treat the Backport::Partial label as a backport as well.

(cherry picked from commit 1c0c1ba8b9)
2022-12-16 14:22:01 +01:00
Tom Krizek
df30dffdd1
Check for cherry pick message in backport commits in danger CI
Using the -x option for cherry pick makes it easy to link commits across
branches and it is recommended to use for all backport commits (with
exceptions -- thus a warning level rather than failure).

(cherry picked from commit 5ecb277090)
2022-11-08 14:40:14 +01:00
Tom Krizek
f8ed380890
Detect work-in-progress commits in danger CI
To avoid accidentally merging unfinished work, detect prohibited
keywords at the start of the subject line. If the first word is any of
the following, fail the check:
WIP, wip, DROP, drop, TODO, todo

The only slightly controversial is the lowercase "drop" which might have
a legitimate use - seems like four commits in the history used it as a
start of a sentence. However, since people commonly use "drop" to
indicate a commit should be dropped before merging, let's prohibit it as
well. In case of false-positive, "Drop" with a capitalized first letter
can always be used.

(cherry picked from commit 402b11431c)
2022-11-08 14:40:14 +01:00
Tom Krizek
3a6e014b20
Use approve button workflow in danger CI
Since the LGTM label was deprecated in favor of using the Approve button
in gitlab, adjust the detection in danger bot.

Unfortunately, danger-python seems no longer maintained since 2020 and
MR approvals aren't available in its Python API (even though they're
supported in its Ruby/JS APIs). Going forward, let's use the more
comprehensive python-gitlab API.

It still makes sense to utilize the danger-python, since it handles the
integration with gitlab which doesn't need to be reimplemented as long
as it works - same with the other checks.

(cherry picked from commit e901342dd9)
2022-11-08 14:40:08 +01:00
Tom Krizek
b3c7bd1c04
Auto-format Python files with black
This patch is strictly the result of:
$ black $(git ls-files '*.py' '*.py.in')

There have been no manual changes.
2022-06-08 13:34:19 +02:00
Petr Špaček
ef8e3c72c6
Flag new user-visible log messages for review
Messages with log levels INFO or higher are flagged for manual review.
Purpose of this check is to prevent debug logs to being released with
too-high log level.

(cherry picked from commit b0f59cb5cb)
2022-06-03 12:12:37 +02:00
Ondřej Surý
2bf7921c7e Update the copyright information in all files in the repository
This commit converts the license handling to adhere to the REUSE
specification.  It specifically:

1. Adds used licnses to LICENSES/ directory

2. Add "isc" template for adding the copyright boilerplate

3. Changes all source files to include copyright and SPDX license
   header, this includes all the C sources, documentation, zone files,
   configuration files.  There are notes in the doc/dev/copyrights file
   on how to add correct headers to the new files.

4. Handle the rest that can't be modified via .reuse/dep5 file.  The
   binary (or otherwise unmodifiable) files could have license places
   next to them in <foo>.license file, but this would lead to cluttered
   repository and most of the files handled in the .reuse/dep5 file are
   system test files.

(cherry picked from commit 58bd26b6cf)
2022-01-11 12:22:09 +01:00
Michal Nowak
c424aa3bc2 Update Danger check for GitLab references
Release notes now employ a custom :gl: Sphinx role for linking to GitLab
issues/MRs.  Tweak the relevant Danger checks to account for that.

(cherry picked from commit fe1dea6572)
2021-04-29 13:35:05 +02:00
Michał Kępień
ab8f013194 Skip subject line length check for merge commits
Some merge requests (e.g. those created for release branches) include
merge commits.  Prevent Danger from warning about excessive subject line
length for merge commits.  (While the proper way to detect a merge
commit would be to check the 'parents' attribute of a commit object,
Danger Python does not seem to populate that attribute, so a simple
string search is performed on the commit subject instead.)

(cherry picked from commit bc42690c99)
2021-01-18 15:13:34 +01:00
Michał Kępień
4aaab7a792 Skip length check for lines containing references
The Danger GitLab CI job currently flags excessively long lines in
commit log messages.  Exclude lines containing references (i.e. starting
with "[1]", "[2]", etc.) from this check.  This allows e.g. long URLs to
be included in commit log messages without triggering Danger warnings.

(cherry picked from commit 09964e8085)
2021-01-18 15:13:34 +01:00
Michał Kępień
c3341d3a85 Only warn about fixup commits once per run
The Danger GitLab CI job currently generates a separate error message
about fixup commits being present in a merge request for every such
commit found.  Prevent that by making it only log that error message
once per run.

(cherry picked from commit 801d13f62f)
2021-01-18 15:13:34 +01:00
Michał Kępień
bc6e0cd2b7 Flag trailing dots in commit subject lines
Make the Danger GitLab CI job fail when the subject line for any commit
belonging to a merge request contains a trailing dot.

(cherry picked from commit 953c810f41)
2021-01-18 15:13:34 +01:00
Michał Kępień
0c5612f399 Flag missing pairwise testing markers
Make the Danger GitLab CI job fail when a merge request adds a new
./configure switch without also adding a "# [pairwise: ...]" marker that
the relevant GitLab CI job uses for preparing the pairwise testing
model.  This helps to ensure that any newly added ./configure switches
are tested by the pairwise testing GitLab CI job.

(cherry picked from commit ff58ec8cef)
2021-01-18 15:13:34 +01:00
Michał Kępień
98a8970d39 Suggest adding release notes for customer issues
Make Danger suggest adding a release note to a merge request if the
latter is marked with the "Customer" label but not with the "Release
Notes" label.

(cherry picked from commit d81ad454cc)
2021-01-18 15:13:34 +01:00
Michał Kępień
f4e62d7102 Handle [placeholder] CHANGES entries
Make the Danger GitLab CI job fail when a merge request targeting a
branch different than "main" adds any [placeholder] entries to the
CHANGES file.  Prevent Danger from flagging missing GitLab identifiers
for [placeholder] CHANGES entries.

(cherry picked from commit 2f77c7680a)
2021-01-18 15:13:34 +01:00
Michał Kępień
7e86197136 Flag missing CVE identifiers
Make Danger ensure that if a merge request fixes a security issue then
that merge request includes a CHANGES entry and a release note, both of
which contain a CVE identifier.

(cherry picked from commit 97364f5518)
2021-01-18 15:13:34 +01:00
Evan Hunt
df698d73f4 update all copyright headers to eliminate the typo 2020-09-14 16:50:58 -07:00
Michał Kępień
09e8f41fd3 Prevent invalid warnings about missing identifiers
The Danger script inspects differences between the current version of a
given merge request's target branch and the merge request branch.  If
the latter falls behind the former, the Danger script will wrongly warn
about missing GitLab/RT identifiers because it incorrectly treats the
"+++" diff marker as an indication of the merge request adding new lines
to a file.  Tweak the relevant conditional expression to prevent such
invalid warnings from being raised.

(cherry picked from commit e062812c38)
2020-06-03 15:51:15 +02:00
Michał Kępień
102e9afc17 Make fetching target branch reliable
As GitLab Runner Docker executor caches Git repositories between jobs,
prevent the Danger script from attempting to update local refs to ensure
"git fetch" returns with an exit code of 0.  Use the FETCH_HEAD ref for
determining the differences between the merge request branch and its
target branch.

(cherry picked from commit d558c4cb78)
2020-06-03 15:51:13 +02:00
Michał Kępień
e4d99f2162 Tweak condition for missing log message warning
Commits adding CHANGES entries and/or release notes do not need a commit
log message.  Do not warn about a missing commit log message for such
commits to make the warning more meaningful.

(cherry picked from commit c13944ca46)
2020-06-03 15:51:13 +02:00
Michał Kępień
b594b1c95f Add Danger Python to GitLab CI
Certain rules of the BIND development process are not codified anywhere
and/or are used inconsistently.  In an attempt to improve this
situation, add a GitLab CI job which uses Danger Python to add comments
to merge requests when certain expectations are not met.  Two categories
of feedback are used, only one of which - fail() - causes the GitLab CI
job to fail.  Exclude dangerfile.py from Python QA checks as the way the
contents of that file are evaluated triggers a lot of Flake8 and PyLint
warnings.

(cherry picked from commit 36bb45a8b6)
2020-06-01 13:45:35 +02:00