See commits from workflow

Whenever someones performs a commit wherein the SVN log message references an issue ID, I want a tag to be added to that issue. I already have TeamCity set up and integration turned on between it and YouTrack, and commits are showing up in the TeamCity tab on the issues. All I need now is to get the tag added any time a commit comes in.

I know a tag command could be added to the commit message, but I'd like this to happen automatically because I want it to reliably happen every time. If I'm relying on my developers to do it, or the tools they're using to do it, it's not going to be 100% reliable.

Is there some way to do this, either via the UI or via a workflow?
14 comments
Comment actions Permalink
Do you need to add the same unique tag on every commit? If so you can set the command "add tag #tagname" in TC mapping, please look at the reference > the section "Configuring Mapping Actions".
0
Comment actions Permalink
I saw that option in there, but I've not been able to get it to work. I think the problem is that I'm only using TeamCity to hook YouTrack to SVN, so it's not doing builds for me. The build configuration is just a dummy one that calls the command line "echo" utility.

Is there some way I can set up the project in TeamCity so that it can put together builds that will trigger the mapping command in YT, but not actually do builds?
0
Comment actions Permalink
All right, I played around some more with the project setup in TeamCity. I've now got it doing shell builds every time a commit is made (basically, I just needed to add a trigger), and it's showing those builds as successful. However, the mapping command on the YouTrack side still isn't being applied. What could I be missing?
0
Comment actions Permalink
Are you sure that the TC build number is set to appropriate issue, but not only TC changes are pulled? The command should be applied to an issue along with setting TeamCity build number.
0
Comment actions Permalink
With a little more tweaking, I've got the tag being added now. However, it only works if the commit includes a command that changes the state to a resolved state. Is there a way to get this to work for any commit?
0
Comment actions Permalink
Hi Bob,
have you managed to automatically set the TC build number into the appropriate resolved issues?
Also please note that the provided in mapping command is applied only to resolved issues.
0
Comment actions Permalink
Yes, the build number gets set if I want it to.

Your second sentence is the more problematic one. Is there a way to apply a tag to an issue every time a commit is made against it?

I was originally thinking I could just do it with a workflow. However, I don't seem to have access to TeamCity commit information from workflows. Is that correct? Is there any other way?
0
Comment actions Permalink
Hi Bob,
It may be not quite clear from the documentation, but the commands that you specify in the mapping is only applied to resolved issues regardless of how they are resolved – simply in YouTrack UI or by means of the integration.

Regards,
  Alexander
0
Comment actions Permalink
It seems like that's just not going to do the trick. Am I right, too, that there's no way to do this from a workflow?
0
Comment actions Permalink
I've created a feature request related to this.

http://youtrack.jetbrains.com/issue/JT-19028
0
Comment actions Permalink
Bob,
AFAIU, your initial goal was to set up TeamCity integration so that it adds a tag to each issue mentioned in a commit message. If this is the case, then it's a completely valid scenario, provided all issues you want to become tagged are in Resolved state.

Further, when an issue is changed by any means, project workflows get triggered for the issue.

Do I get it right that for your environment tagging issues mentioned in VCS commit messages does not work?

Regards,
  Alexander
0
Comment actions Permalink
provided all issues you want to become tagged are in Resolved state.


They all get to a resolved state eventually, but they might not get there via the commit. In particular, here's a scenario where tasks are slipping through untagged:

  • State is an unresolved one.
  • Developer does a commit.
    • Because the state is unresolved, the tag is not applied.
  • Developer later sets the state to a resolved one in the UI.
    • The state is changed, but the tag is not applied.

In other words, going to a resolved state in the UI does not trigger the command, even when there have been commits linked to the task. This suggests that what you wrote previously:

the commands that you specify in the mapping is only applied to resolved issues regardless of how they are resolved – simply in YouTrack UI or by means of the integration


is not working because of a bug, or perhaps I'm just misunderstanding what you're saying.

That said, even if tagging did work when the issue was resolved in the UI, that may leave me with another problem, which is that not every issue should be tagged when it gets resolved, only those issues with related commits. I say "may" because this is possibly the behavior that you're describing that's not working because of a presumed bug.

Further, when an issue is changed by any means, project workflows get triggered for the issue.


Does this include TeamCity events being pulled over? If so, then that opens the possibility of adding the tag from a workflow, but only if the workflow is able to check for commits. Is that possible?

Do I get it right that for your environment tagging issues mentioned in VCS commit messages does not work?


It does work, but I need to cover the edge cases as described above.

Thanks.
0
Comment actions Permalink
In other words, going to a resolved state in the UI does not trigger the command, even when there have been commits linked to the task. This >suggests that what you wrote previously:
the commands that you specify in the mapping is only applied to resolved issues regardless of how they are resolved – simply in YouTrack UI >>or by means of the integration
is not working because of a bug, or perhaps I'm just misunderstanding what you're saying.


I meant that only if the issue is already in resolved state, the mapping command will be applied to it. The command won't be applied in case the issue was mentioned and then became resolved. I appologize for not being specific enough from the very beginning.
Please also be aware that the following scenario is completely valid:
  • ISS-1 is in unresolved state (say, Open)
  • a developer makes a commit with a message '#ISS-1 fixed'
  • the commit gets processed by the integration, fixed is applied to ISS-1 as a command (for more information please refer to the documentation)
  • a command from a mapping gets applied which happens straight after the previous step

There's another feature request that, when implemented, will allow specifying states in which an issue becomes legible for a command application: JT-10056.
0
Comment actions Permalink
Bob - I have the same issue.. basically looking for a way to have TC mappings apply to any issue whether its resolved or unresolved. Also, I found out that the API doesn't expose a method for linking issues to builds manually so a less-than-ideal solution using the API is not an option either.

See
http://forum.jetbrains.com/thread/YouTrack-956?message=YouTrack-956-3
0

Please sign in to leave a comment.