Closed Bug 1546925 Opened 6 years ago Closed 6 years ago

Allow preceding text in try comment

Categories

(NSS :: Build, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pmoore, Assigned: pmoore)

References

Details

Attachments

(1 file, 3 obsolete files)

Bug 1525946 introduced a bug in the try syntax parsing.

Previously, the try commit syntax allowed text to appear before the try syntax, e.g. "Bug 12345 - fix some issue; try: -p win64 -u all -t none".

However, since bug 1525946 landed, it is no longer possible to have preceding text, i.e. you would need to commit with "try -p win64 -u all -t none".

The reason for this is that prior to that bug, mozilla-taskcluster was stripping out the try comment here. It was then referenced in .taskcluster.yml to place it in the environment variable TC_COMMENT. Later on this is matched against a regular expression here (credits to Martin Thomson for spotting this) which allows only whitespace padding from the start of the line.

With bug 1525946, the raw hg commit comment is passed through to the regular expression, and therefore fails to match, thereby causing all tasks to get executed.

Attached patch bug1546925_nss_v1.patch (obsolete) — Splinter Review

The regular expression I went for is to allow:

  • any text preceding 'try:' as long as the last character is not [a-zA-Z]
  • no text preceding 'try:'

This is in order to match e.g.

  • try: ...
  • Bug 12345 - lorem ipsum;try: ...

But to not match:

  • Psychiatry: A Clinical Treatise On Diseases of the Fore-Brain Based Upon a Study of Its Structure, Functions, and Nutrition by Theodor Meynert
Attachment #9060673 - Flags: review?(mt)

Unfortunately the try push doesn't seem to be running...

Attached patch bug1546925_nss_v2.patch (obsolete) — Splinter Review

I've improved the commit comment, and made the regular expression a multiline regular expression (/m at end), since we used to allow this too here.

Attachment #9060673 - Attachment is obsolete: true
Attachment #9060673 - Flags: review?(mt)
Attachment #9060679 - Flags: review?(mt)
Attached patch bug1546925_nss_v3.patch (obsolete) — Splinter Review

Applied simplification (and improvement!) suggested by :mt in IRC.

Attachment #9060679 - Attachment is obsolete: true
Attachment #9060679 - Flags: review?(mt)
Attachment #9060692 - Flags: review?(mt)

Weird - the v3 try push didn't filter the platforms, but the v2 try push did. They used the same commit comment.

The difference was,

  • v2: let match = comment.match(/^(?:.*[^a-zA-Z])?try:\s*(.*)\s*$/m);
  • v3: let match = comment.match(/^\btry:\s*(.*)\s*$/m);

The commit comment used in both cases was:

Bug 1546925 - allow arbitrary leading text before try syntax,try: -p win64 -u none -t none

Let's see how this goes...

Should we go back to v2 version, or shall we try to find out why v3 version failed?

Ahhhhh - I should have removed the ^ !!

Fourth time lucky?! :D

Attachment #9060692 - Attachment is obsolete: true
Attachment #9060692 - Flags: review?(mt)
Attachment #9060695 - Flags: review?(mt)

(In reply to Pete Moore [:pmoore][:pete] from comment #2)

Unfortunately the try push doesn't seem to be running...

Seems to be a problem either with the hook definition, or the hooks service. Created bug 1546951 for this.

See Also: → 1546951
See Also: → 1436195
Attachment #9060695 - Flags: review?(mt)
Attachment #9060695 - Flags: review+
Attachment #9060695 - Flags: checked-in+
Status: NEW → RESOLVED
Closed: 6 years ago
OS: Unspecified → All
Hardware: Unspecified → All
Resolution: --- → FIXED
Target Milestone: --- → 3.44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: