Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition not updating comments #45

Closed
astrostl opened this issue Jul 1, 2016 · 8 comments
Closed

Transition not updating comments #45

astrostl opened this issue Jul 1, 2016 · 8 comments

Comments

@astrostl
Copy link
Contributor

astrostl commented Jul 1, 2016

Howdy,

When I jira trans "Done" ID, I get an expected

update:
  comment:
    - add:
        body: |~

fields:
transition:
  id: 31
  name: Done

While the transition is successful, any comments put into the comment body don't appear anywhere in the JIRA GUI (Activity/All). I know this is a "custom" (default Scrum board) transition to a "Done" status, but aren't the comments a generic property of issues?

Thanks!

@coryb
Copy link
Contributor

coryb commented Jul 1, 2016

Not sure, adding comments in transitions seem to work for me, but I have not tried specifically with the Done status on Scrum board.

If you run the operation with --verbose you should see the content we actually send and the response we get back. I guess double-check that we are actually sending the comment you expect to see?

-Cory

@astrostl
Copy link
Contributor Author

astrostl commented Jul 1, 2016

2016-07-01T16:16:26.724-05:00 INFO  [cli.go:171] GET https://foo.atlassian.net/rest/api/2/issue/LTF-231/transitions?expand=transitions.fields
2016-07-01T16:16:27.045-05:00 INFO  [cli.go:171] GET https://foo.atlassian.net/rest/api/2/issue/LTF-231
2016-07-01T16:16:34.719-05:00 INFO  [cli.go:145] POST https://foo.atlassian.net/rest/api/2/issue/LTF-231/transitions
OK LTF-231 https://foo.atlassian.net/browse/LTF-231

@coryb
Copy link
Contributor

coryb commented Jul 1, 2016

Whelp, that was not useful :) I think a few extra -v -v options will make it more verbose.

I tried again on some of my issues and I can reproduce what you are seeing. I can set the comment in the document, which is getting posted:

2016-07-01T15:11:01.970-07:00 DEBUG [cli.go:114] POST /rest/api/2/issue/ISSUE-619/transitions HTTP/1.1
Host: jira
User-Agent: Go-http-client/1.1
Content-Length: 108

{"transition":{"id":21,"name":"In Progress"},"update":{"comment":[{"add":{"body":"comment in progress"}}]}}
OK ISSUE-619 https://jira/browse/ISSUE-619

But when I actually look at the issue there is no comment posted. I am not sure why Jira is accepting the update to comments then dropping it on the floor. Perhaps only some transitions allow for comments (like Close).

-Cory

@astrostl
Copy link
Contributor Author

astrostl commented Jul 2, 2016

Would there be any downside to switching it up so that it submits a comment, then submits a transition, as opposed to submitting both as a combo? The former would still work for "Close," but also add every other transition type.

@coryb
Copy link
Contributor

coryb commented Jul 2, 2016

Hey I tested out the "Close" case, it also does not seem to update a comment. I am confused, pretty sure this used to work, but not sure what is going on. Perhaps this never worked and I just never noticed.

We could split up the posts, but I am hoping not to. The YAML template that is edited is just literally posted to Jira (after converting YAML -> JSON), if we split up the steps then my code has to be smart enough to pull the YAML document apart and only post relevent piece for the comment/transition calls. Not impossible, just a lot more complicated that any other operation we support.

I am going to do a bit of research to see if I can figure out why this is not working as expected, and why Jira is not throwing an error on the comment update but seeming dropping it on the floor instead.

-Cory

@astrostl
Copy link
Contributor Author

astrostl commented Jul 2, 2016

Right on, thx. I hope to learn golang and jump in with PRs at some point!

@coryb
Copy link
Contributor

coryb commented Jul 6, 2016

I contacted my Jira admin and this is what he said:

The issue here is that the workflow that your project currently uses was setup for Agile, so that means issues can be moved to/from any status, without any comment screen during the transition. So since the API mirrors what happens in the Web UI, you're unable to make a comment.

So basically adding comments will only work with go-jira when the project type we are updating is not "Agile". We have a default template that assumes comments can be updated, but this is clearly not the case. Running jira transmeta ISSUE will show you the "fields" that can be updated during a transition, in my case it is empty: "fields": {}. go-jira should validate the fields we add to the template are indeed updatable, but that will take a bit of work.

To prevent go-jira from having to understand the structure of the YAML document to make multiple POSTS to jira for comments/transitions, I think the easiest thing to do would be to look for the --comment option on the command line and POST that comment when set and comment is not part of the 'fields' metadata, otherwise just POST the template data.

That said, I probably wont have time to work on this fix for a while.

-Cory

coryb added a commit that referenced this issue Sep 7, 2017
@coryb
Copy link
Contributor

coryb commented Sep 7, 2017

Fixed in latest release: https://github.com/Netflix-Skunkworks/go-jira/releases/tag/v1.0.3

We will now call the add-comment api directly if the comment is now allowed in transition.

@coryb coryb closed this as completed Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants