Simplifies commit message validation to the simplest possible logic: a
straightforward regex on the PR title.
### Testing
* (Note: the testing procedure below is based on v6.0, not v5.0;
however, the logic at play will apply regardless of v5.0 vs v6.0)
* I spawned a new "parent" branch from `v6.0`:
(`stevegrossmongodb-v6.0-mq`)
* I established GitHub configuration and Evergreen project to match what
is used in v6.0.
* I created [this PR](https://github.com/10gen/mongo/pull/22012) to test
changes to the message validation logic.
* I ran this [PB for a commit with an invalid
title](https://spruce.mongodb.com/task/stevegrossmongodb_v6.0_mq_commit_queue_validate_commit_message_patch_834c3296202453d3e555b76f06e91eb505ebf006_663b98b0e2c04200074f34a4_24_05_08_15_22_29/logs?execution=0&logtype=all),
which correct failed
* I ran this [PB for commit with a valid
title](https://evergreen.mongodb.com/version/663b9f0b1542760007b768d2?redirect_spruce_users=true),
which correctly passed
* I ran the unit tests for validate_commit_message.py:
```
> python -m unittest buildscripts.tests.test_validate_commit_message
Found a commit without a ticket
SERVER-
Found a commit without a ticket
Revert SERVER-60
Found a commit without a ticket
Found a commit without a ticket
nonsense
.Must specify non-empty value for --message
..
----------------------------------------------------------------------
Ran 3 tests in 0.003s
OK
```
GitOrigin-RevId: ec0b8cfc4a6433b1ad4572e1b910e6ad71ee36fd
This PR makes a subtle but necessary adjustment to commit message
validation to ensure it works in a branch managed via GitHub merge
queue.
### Implementation notes
* When a commit-queue branch is provided to Evergreen via a GH-managed
merge queue, Evergreen does not provide the commit message (== PR title)
as an Evergreen expansion. Instead, the recommended tactic is to obtain
the commit message via `git` command (see
[docs](https://docs.devprod.prod.corp.mongodb.com/evergreen/Project-Configuration/Merge-Queue#faq)).
* We explored changing our validation tactic to a GH ruleset, but that
doesn't quite work: it validates each commit in the branch, rather than
the PR title itself.
### Testing
* To test this, first I created a `v5.0-test-merge-queue` branch (with
corresponding Evergreen project and GitHub branch protection rule). I
adjusted settings as necessary to replicate the GitHub merge queue-based
strategy we're pursuing.
* In [this PR](https://github.com/10gen/mongo/pull/21614/files), I added
logic to obtain the `git log` information (in both commit-queue and
non-commit-queue modes), print it, and process it as expected (along
with a few more `echo` statements for debugging). Note that I added a
forced "exit 1" to the commit queue mode, so that I could repeatedly
test the commit queue without having to create a new PR each time.
* The test run of the
[commit-queue](https://spruce.mongodb.com/task/mongodb_mongo_v5.0_test_merge_queue_commit_queue_validate_commit_message_patch_977ba73081d8d0c8a48a42d5e87035e899945310_6630fc8f356572000703cf6e_24_04_30_14_13_40/logs?execution=0&logtype=all)
shows that git log correctly reports the PR title as the gitlog
(`SERVER-12345 testing it out (#21614)`), and that
`validate_commit_message.py` correctly returns exit code 0 (indicating
that it successfully processed the commit message).
GitOrigin-RevId: 122f4d1234fc8b35ed4d0b1a4928e96f0262c130