According to this section, I have created the following entries in the gerrrit.config file:
[trackingid "jira-issue"]
footer = Issue:
match = "\\[PROJECT-\\d+\\]"
system = JIRA
When I commit a new patchset (or a new change) with the following commit message, the tracking id is not created.
[PROJECT-123] My commit message
Change-Id: Ia5b58dda57ef12632075738d1301f2e143066d45
I have checked the tracking_ids table in database and it's empty. Filtering changes with tr:PROJECT-123 have no results. What can be wrong?
I have restarted Gerrit after making the configuration change. Gerrit v2.8.
Currently the tracking ID needs to go in the footer of the commit message, using the footer argument as its name. In your case:
My commit message
Change-Id: Ia5b58dda57ef12632075738d1301f2e143066d45
Issue: [PROJECT-123]
The order of the name: value pairs in the footer doesn't matter - they just must all be in one paragraph (no blank lines between items).
If it does work in the body of the commit message, then it is probably this issue: Support TrackingIds in subject as well as footer.
Related
I want to setup a simple pre hook in bitbucket that simply checks that there's a JIRA number in commit message. When I attempt to save it, I get a message that I should enter a valid JQL query to match the desired issues. How can I write this query to match ANY issue?
Can you please provide the JQL Query you are providing? If you want to get "All" Issues you can simply give a created > 0 or project = "Proj", either of which would catch all of your tickets. You could then use this to loop through your commit message and check your Jira Key (i.e. Proj-####) as a loop. I might also recommend on the Bitbucket you have a regex check whick looks for that specific pattern on your prehook, depending on how you write it.
Although, if you have configured it correctly it might actually be able to do it automatically. Check the documents here: https://support.atlassian.com/jira-software-cloud/docs/reference-issues-in-your-development-work/
How can we append/add new row/new cell at the top of the table, to act as the first row, below the headers using wiki mark up tokens. ?
I use Jenkins confluence publisher to send values from Jenkins build to a cell in a table in the confluence page. As I run the job daily, I need the Jenkins job to append the new details at the first row and eventually the yesterday's job details will be pushed down to the second row.
before21 token returns results that should come under the column H1 while before 31 values under column H2. I tried to create a cell within the existing cell using |cell| and {{!}}, but none of them works for me as these tokens are inside the table. As shown in the screenshot below, the values are getting added to the same cell instead of new cell.
I am unsure if I can create a row for before21 and use the same new row for before31. The values for these tokens are passed as plain text option from the Jenkins confluence publisher, which will eventually be in the new rows. The plain text supports wiki markup format.
https://www.jenkins.io/doc/pipeline/steps/confluence-publisher/
Can you guys please direct me where am I doing wrong and how can I achieve this?
I use confluence 7X. In Edit mode the page looks like
This is post update
This is achieved by posting content in HTML format.
Our team is migrating to BitBucket. Our workflow requires certain formatting for commit messages for code that is merged into the main origin repo.
Each developer has one (or more) fork(s). Our workflow is to push a feature/bug branch to the fork and create a pull request from that branch. Two other devs must review and +1 the pull request before it can be merged.
When someone clicks Merge, BitBucket displays a dialog with the title "Merge Pull Request". At that point, the dev can edit the text message that is logged for the merge before clicking the second Merge button. This is the message that needs to conform to a specific format.
I have read the documentation here: https://scriptrunner.adaptavist.com/latest/bitbucket/StashMergeChecks.html It has several very specific examples, but nothing that pertains to our use case. I have not been able to find a good, general-purpose reference for how to create merge checks.
I can write a condition that checks for a specific string value:
mergeRequest.message == "My Message"
But I need it to check against a regular expression.
How can I write a pre-merge hook to reject the merge if the message doesn't conform to a regex?
Addition
From the documentation, it seems like the condition check script code would be the right place to enforce this condition. The script can be added in Repository Settings > SCRIPTRUNNER > Script Merge Checks > Conditional merge check. There is a long list of examples shown for the conditional merge check, including things like:
Current user in a particular group
Changed files contains .XYZ files
Changed files in sensitive directory
Target branch is release
After some search & experiment I found I could block merges based on the commit message. But so far I have only found examples of comparing entire strings against constant string expressions. I haven't found how to use a regex in this comparison.
OP here after pushing this issue to the back burner for a few weeks. Issue is solved. You can check your merge commit messages against a regular expression without using a plugin. Solution is here for those who come searching with the same problem.
First, it was more challenging than it should have been to find the documentation for the objects that are most relevant to writing a Merge Check script. So here are a couple of links for the current 6.3.0 API:
PullRequest - In the end, my script didn't use this object, but the pull request is closely related to the merge request and others may need the documentation.
MergeRequest - This object has a method to determine the context (see below).
Second, the Merge Check script fires in two distinct contexts: (1) when bitbucket is trying to determine if it should enable/disable the Merge button on the Pull Request page, and (2) when someone clicks the Merge button on the Merge pull request dialog. In the first context the merge message is null, so it cannot match a regex. And anyway it doesn't make sense to disable the button in this case. I really only wanted the check to occur in the second context. So the script needs a way to distinguish the contexts.
Third, the message object is a Java String, so the script can call the matches() method to check if the message matches a regex.
After you have all the information at your fingertips, writing the script is pretty easy:
// the message regex
String pattern = "(PATTERN1|PATTERN2|etc)"
// reject if not dry-run and
// message doesn't match regex
! mergeRequest.isDryRun() &&
! mergeRequest.message.matches(pattern)
You could try some of the plugins for Bitbucket like YACC:
https://marketplace.atlassian.com/apps/1211854/yet-another-commit-checker?hosting=server&tab=overview
If that doesn't meet your requirements, you could write your own:
https://developer.atlassian.com/server/bitbucket/how-tos/hooks-merge-checks-guide/
While commenting on JIRA tickets, #username can be used to tag a team member. The thing that bugs me is that when I try to tag any team member, there is a special encoded text appear (something like this [~gbuc13]) for every person you tag in.
Now its very difficult to find which member you tagged in your comment by seeing this code. Is there any way that this strange encoded name could be replaced with a proper, meaningful names so that when a user is being tagged, [mike] is appeared instead of [~gbuc13]? I know this change will have to be adopted by every team member to define their aliases, but I am wondering where this (alias?) could be set.
The change you describe is is the difference between the saved view and the edited view and can't be changed:
at edit time you see the alias
once saved you see the full user name (which links to the Jira profile page showing all their activity)
Our team uses a standard of prefixing all commit messages with "bz12345:" (where 12345 is replaced by the bug you're working on) and I'd like to be able to search for all commits that have that bug number.
I've read http://gerrit.googlecode.com/svn/documentation/2.1.6/user-search.html over and over and haven't figured out a way to search for commit message titles. Does anybody have a trick for searching the first line of a commit message for arbitrary text? None of message:, tr:, and bug: work.
Ah, I figured it out. You MUST have a status: query too. For example, this works:
status:merged message:bz12345
This does not:
message:bz12345
This could be because we're on an older version of Gerrit (2.2.1 I think).
message:bz12345 should work.
See the latest documentation
Note that it searches the whole message body though, not just the subject.
message:'MESSAGE'
Changes that match MESSAGE arbitrary string in the commit message body.