[SERVER-45074] Commit queue commit message validation should double check the ticket ID (ticket key) Created: 11/Dec/19  Updated: 29/Oct/23  Resolved: 23/Jan/20

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.3.2

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: James O'Leary
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-45730 update commit queue message validation Closed
Backwards Compatibility: Fully Compatible
Sprint: DAG 2020-01-13, DAG 2020-01-27
Participants:
Story Points: 2

 Description   

It is a real pain if you make a commit that has the wrong ticket number prefix - you end up needing to do a bunch of manual work to reconcile the various places things got logged incorrectly to paper over the mistake.

Since we are adding validation for commit messages in other ways (formatting, etc.) we should see if it would be possible to also validate against JIRA that the ticket you are nominally committing to makes sense: is open, is assigned to you, etc.



 Comments   
Comment by Githook User [ 24/Jan/20 ]

Author:

{'username': 'dbradf', 'name': 'David Bradford', 'email': 'david.bradford@mongodb.com'}

Message: Revert "SERVER-45074 validate commit message against JIRA"

This reverts commit 1da2398abc11189a6d7706cfba12fa71a693e129.
Branch: master
https://github.com/mongodb/mongo/commit/544cd7662f2d8ba2d4067d5bc0f960c07ff40ce4

Comment by James O'Leary [ 24/Jan/20 ]

error for 'SERVER-44566 legacy logging cleanups':

 [2020/01/24 17:03:24.338] Traceback (most recent call last):
 [2020/01/24 17:03:24.338]   File "buildscripts/validate_commit_message.py", line 452, in <module>
 [2020/01/24 17:03:24.338]     sys.exit(main(sys.argv[1:]))
 [2020/01/24 17:03:24.338]   File "buildscripts/validate_commit_message.py", line 446, in main
 [2020/01/24 17:03:24.338]     ticket, violations = validate_message(message, args.author, jira)
 [2020/01/24 17:03:24.338]   File "buildscripts/validate_commit_message.py", line 160, in validate_message
 [2020/01/24 17:03:24.338]     violations = validate_ticket(ticket, author, jira)
 [2020/01/24 17:03:24.338]   File "buildscripts/validate_commit_message.py", line 178, in validate_ticket
 [2020/01/24 17:03:24.338]     violations = validate_public_ticket(ticket, author, jira)
 [2020/01/24 17:03:24.338]   File "buildscripts/validate_commit_message.py", line 241, in validate_public_ticket
 [2020/01/24 17:03:24.338]     violation = validate_author(issue, ticket, author)
 [2020/01/24 17:03:24.338]   File "buildscripts/validate_commit_message.py", line 209, in validate_author
 [2020/01/24 17:03:24.338]     if assignee.name != author:
 [2020/01/24 17:03:24.338] AttributeError: 'NoneType' object has no attribute 'name'

At the time of writing SERVER-44566 is unassigned. So we need to handle this case and print a good error message.

Comment by Githook User [ 23/Jan/20 ]

Author:

{'username': 'jimmongo', 'name': "Jim O'Leary", 'email': 'jim.oleary@mongodb.com'}

Message: SERVER-45074 validate commit message against JIRA
Branch: master
https://github.com/mongodb/mongo/commit/1da2398abc11189a6d7706cfba12fa71a693e129

Comment by David Bradford (Inactive) [ 13/Dec/19 ]

Yes, we would need to think through what this would look like for backports.

Also, we should consider how this should behave if Jira is unreasonable slow or down. Given that we have no validation for this right now, skipping the check if we cannot access Jira might be acceptable.

Comment by Eric Milkie [ 13/Dec/19 ]

You could amend the validation to check for either the ticket assigned to the commit author, OR, "(cherry picked from" text present in the commit description.

Comment by Eric Milkie [ 13/Dec/19 ]

The "assigned to the commit author" part will be weird with our current backport process.

Comment by David Bradford (Inactive) [ 13/Dec/19 ]

We should validate the following:

  • The Jira ticket is not in a closed state.
  • The Jira ticket is assigned to the commit author.
Generated at Thu Feb 08 05:07:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.