It will be possible create an issue with Resolution different from Unresolved

fabio marcelo October 14, 2012

Hi All,

Please , It will be possible create a new issue with the resolution equal "Initial" ?

Everytime that i create a new issue the resolution is set to Unresolved.

Please could you help me ?

Thanks in Advance

BR

Fabio

5 answers

2 votes
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2012

Not a good idea. The 'Assigned to Me' built in filter, along with many others, rely on the resolution field being empty, which is the condition for UNRESOLVED. If you populate it with ANYTHING the filters will not show any issues. Not Started sounds more like a status in a workflow than a resolution to an issue. You can change the workflow to show Not Started instead of Open.

fabio marcelo October 15, 2012

Hi Nic,

Yes, the user have the "resolve issue" permission.

The problem to set the resolution only happens in the creation from issue.

When i changed the issue to "Open" the post function change my Resoluon to "Initial

Please o you have any other idea?

Thanks in Advance

BR

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2012

Yup,

I was assuming Fabio had understood that any issues created with this would be automatically considered as "closed" by most of Jira. I shouldn't assume that people know this stuff...

fabio marcelo October 15, 2012

Hi all,

Let me explain better my problem.

We are using the plugin commit acceptance to block commits in SVN.

The commmit only is accepted when the Resolution from issue is "Unresolved".

The resolution only can be Unresolved when the status was "In Progress", so the commmits only will be permitted in the status "In progress".

But when i created the issue, his status is Draft and the resolution is Unresolved, so in this case commits will be accepted, but i would like to change this resolution on creation from issue for that this resolution was different from Unresolved with the objective from block commmits.

Thanks in Advance

Best Regards

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2012

Ok, good, if they have the permission, that rules out one potential problem.

The explanation of why you want "closed" issues to be created doesn't feel right to me as a usability thing (as Joe pointed out - there's a lot of stuff in Jira that says "ignore resolved issues because they're technically dealt with and don't need to be looked at any more"), but it does make sense as technical solution to what you're doing.

I don't think we need to look at that any more, because I think it all hinges off getting the field populated correctly for you (i.e. if the field updates work, your commit stuff will work too). Having said that, I'd be immensely tempted to look at changing the commit rule to look at the status, so that instead of "unresolved", it looks for "unresolved and not in status = draft". That would avoid the current problem, and make your resolution field look more intuitive.

But, back to the reported problem. Can you check a couple of things quickly?

  1. What does the resolution in the issue navigator say after you create a new issue
  2. What does the resolution on the issue view itself say
  3. What are all of the post-functions on the create transition
  4. What order are those transitions in

(I ask because it's good to be clear. The first two questions ask you to look in different places because I'm trying to rule in or out the indexing as the problem, and those two ways of looking at an issue do two different things!)

fabio marcelo October 15, 2012

Hi Nic,

Follow the answer:

What does the resolution in the issue navigator say after you create a new issue.

Resolution: Fixed

What does the resolution on the issue view itself say

Resolution: Unresolved

What are all of the post-functions on the create transition

The Approved of the issue will be set to No.
Edit | Move Down | Delete
— THEN
Creates the issue originally.
— THEN
Assign the issue to the reporter.
Move Up | Move Down | Delete
— THEN
The Resolution of the issue will be set to 13.
Edit | Move Up | Move Down | Delete
— THEN
Re-index an issue to keep indexes in sync with the database.
— THEN
Fire a Issue Created event that can be processed by the listeners.
Edit

13 is equal "Not Started"

  1. What order are those transitions in

The same above

It strange the issue navigator show "Fixed" and the issue view show "Unresolved". It shows the default value.

Thanks in Advance

BR

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2012

Ok, well, that explains your svn problem - the index and the issue are not matched - that's going to break all sorts of stuff!

Next thing is to fix that. Can you try moving the "update resolution" to the same place as "set approved to no" and retest the search/view mismatch? (Oh, and check for mismatches in that field too!)

Or the best fix - change the commit script to check status as well (yes, I'm going to keep saying it...)

1 vote
Matheus Fernandes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 15, 2012

This can be achieved by setting up a Update Field post-function in the Create Issue transition of your workflow and setting it to update the Resolution field. Basically, you'll need to:

  1. Go to Administration » Workflows
  2. Click the link for the workflow in 'Steps' column
  3. Click 'Open' link in the Step Name column
  4. Click 'Create Issue' link in the Workflow browser (the inbound transition that arrives into the Open step)
  5. Add a post-function, 'Update Issue Field', and set the Resolution field to desired value (if necessary, create a draft so the workflow is editable)
fabio marcelo October 15, 2012

Hi Matheus,

Thanks for your help.

I tried it with the value "Not Started" but the issue continue being created with Resolution = Unresolved

Follow my workflow:

Create Issue --> Draft --> Open --> In Progress --> Closed

In the first status Draft the issue is with Resolution = Unresolved

Is there any way to set this field Resolution to "Not Started" when i create the issue ?

Thanks in Advance

BR

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2012

Does the user creating the issue have the "resolve issue" permission?

Matheus Fernandes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 24, 2012

Also, what is the ordering of the post-functions?

You have to set it right after the "Create Issue" post-function, if I'm not mistaken.

0 votes
Norman Abramovitz
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.
October 24, 2012

Follow the answer here to update your language packs.

https://answers.atlassian.com/questions/66852/language-files-appear-not-to-be-present-in-jira_root-atlassian-jira-web-inf-lib

Here is

0) Locate your JiraWebActionSupport.properties file if and only if you are using the default english language. Otherwise follow the directions to find your language pack as noted in the url above.

2) Edit the file JiraWebActionSupport.properties or your language pack properties file after it is unpacked in a text editor

3) Search for the word resolution and you should find these lines

# resolution
common.resolution.UNRESOLVED = UNRESOLVED
common.resolution.unresolved = Unresolved

4) change the values after the equal signs

common.resolution.UNRESOLVED = INITIAL
common.resolution.unresolved = Initial

5) Save your changes and repackage your language package if and only if you are updating a language pack

6) restart Jira

Any new issue without an resolution value should be showing one of your new values.

Norman Abramovitz
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.
October 24, 2012

You might need to disable your post functions or display an older issue where the post function was not applied and is showing unresolved.

0 votes
Norman Abramovitz
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.
October 23, 2012

Could this just be a simple language translation issue? My resolution database table does not contain a row for the unresolved resolution type, so I was guessing the unresolved resolution must be defined somewhere else.

I found this reference in one of the issue field resolution vm files:


$i18n.getText('common.resolution.unresolved')

I found these references in the english uk language pack file:

# resolution
common.resolution.UNRESOLVED = UNRESOLVED
common.resolution.unresolved = Unresolved

So, maybe just updating your language packs, you can get a different word to display for unresolved.

fabio marcelo October 23, 2012

Hi Norman,

Thanks for your help.

Sorry, how can i update my language packs ?

Thanks in Advance

BR

Fabio

fabio marcelo October 23, 2012

Nic,

Please did you find any error in the script above ?

Thanks in Advance

BR

Fabio

fabio marcelo October 23, 2012

Hi Nic, Norman and Renjith,

Finally i got create a issue with resolution different from Unresolved.

It s missing

the store the update issue value after of create the issue

Follow my Post Function:

Add a new post function to the unconditional result of the transition.

Creates the issue originally.
— THEN
Assign the issue to the reporter.
Move Up | Move Down | Delete
— THEN
The Approved of the issue will be set to No.
Edit | Move Up | Move Down | Delete
— THEN
The Resolution of the issue will be set to 13.
Edit | Move Up | Move Down | Delete
— THEN
Stores updates to an issue (no change history is created).
— THEN
Re-index an issue to keep indexes in sync with the database.
— THEN
Fire a Issue Created event that can be processed by the listeners.
Edit

fabio marcelo October 30, 2012

Hi all,

I got to create the issue with Resolution different form Unresolved.

But when i created this issue the " Issues: 30 day Summary" created vs resolved show that this issue already is resolved.

When my issue goes to Implementation and resolution Unresolved the " Issues: 30 day Summary" created vs resolved show that this issue wasn t resolved.

So, every issue that have resolution different from "Unresolved" the JIra think that this issue is resolved .

Is there any way to change it ?

Please could you help me ?

Thanks in Advance

Best Regards

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2012

Er, yes, that's because you're choosing to break it.

As has been pointed out several times above, Jira considers an issue "resolved" if there is ANYTHING in the field. Doesn't matter if you've filled in fixed, null, fred, unresolved, Mr Flibble - the system is asking the question "is there data in the field". If there is no data, the issue is unresolved. If there is any data, it is resolved.

So, "set resolution to 13" means "issue is resolved". Because you've set it to something.

What you need to do is use the resolution field as designed. Do not set it to anything until the issue is resolved.

fabio marcelo October 30, 2012

Hi Nic,

Thanks for the information.

But if don t set the resolution, the commmits in SVN will be accepted. This way that i did the commits in SVN are blocked while the issue is with resolution different from Unresolved. The commits only will be accepted if the issue is with resolution = Unresolved.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2012

Then change the SVN script to use status, as previously suggested.

Your script is making inaccurate and unhelpful assumptions about the way Jira works. You have two places you can "fix" this - there's either re-writing a huge chunk of the core of Jira and potentially any plugins that look at issues, or you can fix your script to use better data.

fabio marcelo October 31, 2012

I choose fix my script .

But i don t know why when i added the line bold below:

eval {
$jiraBaseURL =~ s/\/+$//; # remove trailing '/' if exists
my $s = XMLRPC::Lite->proxy($jiraBaseURL . "/rpc/xmlrpc");
my $result = $s->call("commitacc.acceptCommit", $jiraLogin, $jiraPassword, $committer, $projectKey, $commitMessage)->result();


my $issue = $s->call("jira1.getIssue", $jiraLogin, $jiraPassword, $1)->result();
($acceptance, $comment) = split('\|', $result);

if($issue.status() == "Draft")
{
$acceptance = 'false';
$comment = "Commits not accepted when the issue is in Draft state";
} };

it failed :(

Best Regards

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 31, 2012

I don't know enough Perl to help you here.

It's very good that you've raised https://answers.atlassian.com/questions/102032/how-can-i-include-the-status-from-the-issue-in-the-commit-acceptance though - a new question for this will get a lot more attention than this comment! :-)

fabio marcelo November 7, 2012

Hi Nic,

It will be possible make this script using Java ? Please How can we retrive the information about the status from issue through Java ?

I would like that this script block any commit in SVN if the status from issue in JIra was different from Implementing.

It will be possible make this using Java script instead commit acceptance plugin ?

Thanks in Advance

Best Regards

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 7, 2012

You should write the script in whatever is most appropriate for your server and organisation. If you write it in Java, you'll need to write something that can connect to Jira, extract the status information, parse it and be runnable by your subversion service.

I've only ever done commit hooks in shell scripts to be honest

0 votes
Renjith Pillai
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.
October 15, 2012

Fabio,

Rather than changing the default JIRA behaviour by setting the resolution initially, you can probaly achieve this by a simple change in the SVN hook script that you are using. I have not tested it, I just read the code (I am assuming perl script):

  • Locate the line "my $result = $s->call("commitacc.acceptCommit", $jiraLogin, $jiraPassword, $committer, $projectKey, $commitMessage)->result();" in the perl script
  • Add the below code (after that line):
$comment =~ m/($projectKey-\d+)/;
my $issue = $s->call("jira1.getIssue", $jiraLogin, $jiraPassword, $1)->result();
  • Add this line after "($acceptance, $comment) = split('\|', $result);"
if($issue.status() == "Draft")
{
 $acceptance = 'false';
 $comment = "Commits not accepted when the issue is in Draft state";
}

fabio marcelo October 21, 2012

Hi Renjith,

Thanks for your help.

I tried to do this but show me the error :

Please could you help us ?

To open Jira here it s necessary 2 authentication.

First in the portal and other in the JIra tool , the problem could be it ?

Thanks in Advance

Best Regards

Fabio

fabio marcelo October 22, 2012

Hi Nic and Renjith,

Please dou know the reason from the error that i mentioned above ?

Thanks in Advance

BR

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 22, 2012

You've got two - the second one MIGHT be caused by the first (I don't know perl well enough to tell you if that's the case). The first error is in the regular expression you're using. The second a connection error. Pretty much what the error messages are telling you - your code is wrong, and the connection possibly broken.

fabio marcelo October 23, 2012

Hi all,

Please what s the latest version of the script to perl from Commmit Acceptance ?

This jira1.getissue is not working for me. What are the parameters for this jira1.getissue ?

Thanks in Advance

BR

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 23, 2012

Don't know. Where did you get the script? What's it doing? What do the logs say (on both sides?)

fabio marcelo October 23, 2012

Hi Nic ,

I download the script through the link:

https://maven.atlassian.com/contrib/com/atlassian/jira/ext/commitacceptance/1.4.1/commitacceptance-1.4.1-client-scripts.zip

The original code for this script jira-client.pl works fine.

But i would like to block commits according the status from issue. I don t know what change in the script for it work.

I tried to include the line that Renjith passed but it s not working.

Show me the error:

Unable to connect JIra server.

Please could you help me ?

Thanks in Advance

BR

Fabio

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 23, 2012

I'm a bit lost - you've got a clear error with your regular expression, followed by a "cannot connect". You need to fix both of those. You're not telling us what you've done to the script, where you've inserted Renjith's code or how you've changed it to match your requirement. I've already pointed out that the connection error could easily be down to the fact that your change doesn't work, and could well be a complete dead end.

You need to do some basic debugging. Go back to the original script, as you say it is working. Test it clean, then add the new line where you think you need it. Read the error message. Tell us what the whole new block is, and what you've done that breaks it. Plus why you've done what you've done!

fabio marcelo October 23, 2012

The script below works fine.

use strict;
use warnings;

use XMLRPC::Lite;
use HTML::Entities ();


my $jiraBaseURL = http://jira:8080;
my $jiraLogin = "tra1";
my $jiraPassword = "tra1";
my $projectKey = "TRA";

# configure svnlook path
my $svnlookPath = "/usr/bin/svnlook";

# get committer
open IN, '-|', "$svnlookPath author $ARGV[0] --transaction $ARGV[1]" or die "Unable to get committer with svnlook.\n";
my $committer = <IN>;
close IN;
chomp($committer);

# get commit message
my $holdTerminator = $/;
undef $/;

open IN, '-|', "$svnlookPath log $ARGV[0] --transaction $ARGV[1]" or die "Unable to get commit message with svnlook.\n";
my $buffer = <IN>;
close IN;

$/ = $holdTerminator;
my @lines = split /$holdTerminator/, $buffer;
$buffer = "init";
$buffer = join $holdTerminator, @lines;
chomp($buffer);

my $commitMessage = $buffer;

# print arguments
select(STDERR);
print "Committer: " . $committer . "\n";
print "Commit message: \"" . $commitMessage . "\"\n";

# invoke JIRA web service
my $acceptance;
my $comment;

eval {
$jiraBaseURL =~ s/\/+$//; # remove trailing '/' if exists
my $s = XMLRPC::Lite->proxy($jiraBaseURL . "/rpc/xmlrpc");
my $result = $s->call("commitacc.acceptCommit", $jiraLogin, $jiraPassword, $committer, $projectKey, $commitMessage)->result();


#my $issue = $s->call("jira1.getIssue", $jiraLogin, $jiraPassword, $1)->result();
($acceptance, $comment) = split('\|', $result);

#if($issue.status() == "Draft")
#{
#$acceptance = 'false';
#$comment = "Commits not accepted when the issue is in Draft state";
#} };

if ($@) {
($acceptance, $comment) = ("false", "Unable to connect to the JIRA server at \"" . $jiraBaseURL . "\".");
};

if($acceptance eq 'true') {
print "Commit accepted.\n";
exit 0;
} else {
$comment = HTML::Entities::decode($comment);
print "Commit rejected: " . $comment . "\n";
exit 1;
}

The bold text is not working. Show me the message: Unable to connect in JIra server:

Suggest an answer

Log in or Sign up to answer