Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

New Stash Plugin: Yet Another Commit Checker

Sean Ford January 10, 2014

For anyone interested in commit checking and validation in Atlassian Stash, I just released a beta verison of Yet Another Commit Checker. There are already a few commit checker plugins for Stash, but I needed the ability to validate issues against JIRA JQL queries. This allows things like ensuring a JIRA issue is assigned and "in progress". I looked into contributing to existing plugins but ultimately decided to create Yet Another Commit Checker :-)

See https://github.com/sford/yet-another-commit-checker

Key Features:

  • Fully configurable!
  • Require commit author name and email to match Stash user
  • Require commit messages to match regex
  • Require commit message to contain valid JIRA issue ids
  • Issue JQL matcher to validate JIRA issue against. Require issues to be assigned, not closed, in a certain project, etc. The possibilities are endless!
  • No extra JIRA configuration is required. Will use existing JIRA Application Link!
  • Branch friendly! Only new commits are checked. Commits that already exist in the repository will be skipped.

I still need to figure out how to get the plugin onto the Atlassian Marketplace, but the source code code is out and buildable for anyone who would like to check it out and test. Comments appreciated!

Thanks,

Sean

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Sean Ford January 20, 2014

For anyone interested, the plugin is now on the Atlassian Marketplace!

https://marketplace.atlassian.com/plugins/com.isroot.stash.plugin.yacc

0 votes
N August 14, 2014

Hi Sean,

Thank you for the advices. Seems like I found out why the plugin does not work. It actually works if I remove JQL query from settings. Another case when it works: I set JQL like 'project = "Project Name"', then try to push something, then I see debug message "c.i.stash.plugin.JiraServiceImpl issues found for JQL Query [list of issues]" - this list of issues contains only 50 the newest issues. If I push a commit with one of these issues then it works. But my Jira project contains much more tickets. And it does not work for rest of them.

I use version 1.2 of your plugin. I see that source code in 1.3-snapshot is changed and doesn't have this query any more. I guess my problem is fixed in 1.3-snapsht?

Thanks,

Natalia

Sean Ford August 14, 2014

Hi Natalia,

That should be fixed in 1.3-SNAPSHOT :-) There was a bug where it wouldn't find issues for JQL result sets containing >50 issues.

I plan on releasing 1.3 sometime next week.

Until then, you might be able to add some stuff to the JQL query to limit the result set... maybe "assignee is not null", "status in ('in progress')", or even "updatedDate > -7d" if tickets will typically be updated right before commits are pushed to them.

Thanks!

Sean

N August 14, 2014

Hi Sean,

Ok, then I'll use it without JQL until you release 1.3 :)

Thanks

0 votes
N July 15, 2014

Does not work for me.

I configured application link with cloud Jira. First time I had authentication error when tried to save JQL query, then I followed this instruction:

"To initialize the OAuth tokens, go into the Stash UI and do something that requires access to JIRA. For example, view the commits for a repository and click on an linked JIRA issue for an existing commit."

I got access request, accepted it, this let me save JQL in the plugin configuration. When I save it I see debug message in log:

2014-07-15 18:19:36,385 DEBUG [http-bio-7990-exec-8] admin 1099x81x0 ycur1t 10.1.0.1,10.1.0.9 "PUT /rest/api/latest/projects/AV/repos/test/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/settings HTTP/1.1" c.i.stash.plugin.JiraServiceImpl issues found for JQL Query "project="XX XX"": [IssueKey{UFV-368}, IssueKey{UFV-369}, .......

Then I tried to push commit with valid ticket number and it was rejected: "UFV-199: Unable to validate JIRA issue because there was an authentication failure when communicating with JIRA." Nothing in logs. Then I enabled debug logs, there are messages for 1 push:

2014-07-15 17:42:36,887 DEBUG [threadpool:thread-3] dummy 1062x73x0 13cownw 10.1.0.1,10.1.0.9 "POST /scm/av/test.git/git-receive-pack HTTP/1.1" c.i.stash.plugin.YaccServiceImpl checking ref change refId=refs/heads/feature/blablabla fromHash=e45bb195406ae70f725a4ba5e66add14ab70dbdf toHash=33a533e3d12920b6e62e5274b28a2ffc6b479bef type=UPDATE

2014-07-15 17:42:37,011 DEBUG [threadpool:thread-3] dummy 1062x73x0 13cownw 10.1.0.1,10.1.0.9 "POST /scm/av/test.git/git-receive-pack HTTP/1.1" c.i.stash.plugin.YaccServiceImpl checking commit id=33a533e3d12920b6e62e5274b28a2ffc6b479bef name=XXXX email=XXXX message=UFV-199: test bla3

2014-07-15 17:42:37,012 DEBUG [threadpool:thread-3] dummy 1062x73x0 13cownw 10.1.0.1,10.1.0.9 "POST /scm/av/test.git/git-receive-pack HTTP/1.1" c.i.stash.plugin.YaccServiceImpl requireMatchingAuthorEmail=false authorName=XXXX stashName=XXXX

2014-07-15 17:42:37,012 DEBUG [threadpool:thread-3] dummy 1062x73x0 13cownw 10.1.0.1,10.1.0.9 "POST /scm/av/test.git/git-receive-pack HTTP/1.1" c.i.stash.plugin.YaccServiceImpl requireMatchingAuthorName=false authorName=XXXX stashName=dummy

2014-07-15 17:42:37,018 DEBUG [threadpool:thread-3] dummy 1062x73x0 13cownw 10.1.0.1,10.1.0.9 "POST /scm/av/test.git/git-receive-pack HTTP/1.1" c.i.stash.plugin.YaccServiceImpl found jira issues [IssueKey{UFV-199}] from commit message: UFV-199: test bla3

2014-07-15 17:42:37,055 DEBUG [threadpool:thread-3] dummy 1062x73x0 13cownw 10.1.0.1,10.1.0.9 "POST /scm/av/test.git/git-receive-pack HTTP/1.1" com.isroot.stash.plugin.YaccHook error: refs/heads/feature/blablabla: 33a533e3d12920b6e62e5274b28a2ffc6b479bef: UFV-199: Unable to validate JIRA issue because there was an authentication failure when communicating with JIRA.

2014-07-15 17:42:37,055 DEBUG [threadpool:thread-3] dummy 1062x73x0 13cownw 10.1.0.1,10.1.0.9 "POST /scm/av/test.git/git-receive-pack HTTP/1.1" com.isroot.stash.plugin.YaccHook push rejected

Sean, please help!

Sean Ford July 17, 2014

Hey Natalia,

Sorry it isn't working :-( I have only really ever seen an authentication failure message when my OAuth tokens were not setup. After receiving that error, are you able to log into Stash and check a linked issue? (See 'See the details for JIRA issue' at https://confluence.atlassian.com/display/STASH/JIRA+integration)

Are you logging into the Stash using the same user that you are trying to git push with?

Another thing to check would be the JIRA Application Link properties. I have only tested using the 'OAuth' setup with trusted and basic authentication methods disabled.

Hope this helps,

Sean

0 votes
Sean Ford January 22, 2014

Kelly, cool! Let me know if you have any feedback!

0 votes
Kelly Schoenhofen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2014

This looks extremely interesting; we'll be installing it in our testbed Stash server and evaluating it.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events