• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • youtrack-plugin
    • None
    • jenkins 1.576, youtrack plugin 0.6

      While the youtrack plugin seems to be working fine generally, I do miss the option to execute a custom command from a build step. The description says "Execute commands from build steps", but I do miss the youtrack command options besides other available build step actions like "Execute a shell command".

      Are there any prerequesites for it appear? Or maybe it's not implemented although the docs suggest it? (There is no further mention of it).

          [JENKINS-24333] No action for executing command from build step

          Thanks a lot for implementing this!

          Sry, it took me a while to come back to this, but I tested it now. I used 1.6.1 as I figured it's already included in there.

          The configuration options look good to me, however I had some troubles configuring it properly for my needs. I have two problems:

          • I'd need the build changelog in a variable, such that I can add it to the comment and to "find issues ids in text". Google told me ${CHANGES} should be there, but that does not work for me. Any idea how I could access the build changelog?
          • I tried manually inserting issue ids in the "find issues ids in text" by inputting "#XYZ-123 something" in there, but it tried to send the command to "XYZ" instead of "XYZ". So looks like the issue parsing does not work properly here?

          Lastly, a minor issue, but I noted there is "and and" in the following help text:
          >Text to search for issues ids for which the command will be applied. If both search query and and issue in text is set, the command will be applied to the union of the two.

          Wolfgang Ziegler added a comment - Thanks a lot for implementing this! Sry, it took me a while to come back to this, but I tested it now. I used 1.6.1 as I figured it's already included in there. The configuration options look good to me, however I had some troubles configuring it properly for my needs. I have two problems: I'd need the build changelog in a variable, such that I can add it to the comment and to "find issues ids in text". Google told me ${CHANGES} should be there, but that does not work for me. Any idea how I could access the build changelog? I tried manually inserting issue ids in the "find issues ids in text" by inputting "#XYZ-123 something" in there, but it tried to send the command to "XYZ" instead of "XYZ". So looks like the issue parsing does not work properly here? Lastly, a minor issue, but I noted there is "and and" in the following help text: >Text to search for issues ids for which the command will be applied. If both search query and and issue in text is set, the command will be applied to the union of the two.

          Erik Zielke added a comment -

          About changelog in an environmnet variable, I had a similar need once, and as far as I can remember there is only IMHO weird ways to get it, e.g. by calling the xml/json api from the build. Maybe there is some plugin which sets that variable. Developing this plugin I have found that the Git Plugin only shows the first line or 80 chars (can't remember which) of the commit message, I get the remaining text by reflection as do the view renders. This might also be an issue when calling the api.

          Am I overlooking something or haven't you written the same project twice ("XYZ" instead of "XYZ")? I haven't have time to test it my self yet.

          Thanks for mentioning the typo.

          Erik Zielke added a comment - About changelog in an environmnet variable, I had a similar need once, and as far as I can remember there is only IMHO weird ways to get it, e.g. by calling the xml/json api from the build. Maybe there is some plugin which sets that variable. Developing this plugin I have found that the Git Plugin only shows the first line or 80 chars (can't remember which) of the commit message, I get the remaining text by reflection as do the view renders. This might also be an issue when calling the api. Am I overlooking something or haven't you written the same project twice ("XYZ" instead of "XYZ")? I haven't have time to test it my self yet. Thanks for mentioning the typo.

          Sry, it should have been '"XYZ" instead of "XYZ-123"' - the number and the dash is missing from the detected issue ID.

          Without a changelog variable, I've no idea how I'd get to the right youtrack issue for posting a comment to - so it looks like I'll have to figure this one out. Thanks for the tip with the API - http://stackoverflow.com/questions/11823826/get-access-to-build-changelog-in-jenkins describes this also.

          Basically it's about having a custom comment message (where I can make use of environment variables) instead of "Update YouTrack issue with link to build". Thus, appending information to the default comment posted to the issue would be already helpful as well. Does it post "build notes" maybe, or is the posted text hard-coded right now?

          Thanks a lot!

          Wolfgang Ziegler added a comment - Sry, it should have been '"XYZ" instead of "XYZ-123"' - the number and the dash is missing from the detected issue ID. Without a changelog variable, I've no idea how I'd get to the right youtrack issue for posting a comment to - so it looks like I'll have to figure this one out. Thanks for the tip with the API - http://stackoverflow.com/questions/11823826/get-access-to-build-changelog-in-jenkins describes this also. Basically it's about having a custom comment message (where I can make use of environment variables) instead of "Update YouTrack issue with link to build". Thus, appending information to the default comment posted to the issue would be already helpful as well. Does it post "build notes" maybe, or is the posted text hard-coded right now? Thanks a lot!

          Erik Zielke added a comment -

          Ok, will look into it when I get time.

          Yes. A possibilty is that I could create a changelog string in the plugin and inject it into the environment, although I believe it is a bit out of scope for the plugin.

          For now the text in the "Update YouTrack issue with link to build" is hardcoded, but having the possibilty to specify it is something I have considered implementing.

          Erik Zielke added a comment - Ok, will look into it when I get time. Yes. A possibilty is that I could create a changelog string in the plugin and inject it into the environment, although I believe it is a bit out of scope for the plugin. For now the text in the "Update YouTrack issue with link to build" is hardcoded, but having the possibilty to specify it is something I have considered implementing.

          Erik Zielke added a comment -

          I can't reproduce the missing id, but it did not expand the issues in text field (making it useless). This I have now fixed and also added an environment variables YOUTRACK_CHANGES that just concatenates the commit messages for the build together.

          I have just uploaded to the experimental update center, but I can take up to a day before its available.

          Erik Zielke added a comment - I can't reproduce the missing id, but it did not expand the issues in text field (making it useless). This I have now fixed and also added an environment variables YOUTRACK_CHANGES that just concatenates the commit messages for the build together. I have just uploaded to the experimental update center, but I can take up to a day before its available.

          Wolfgang Ziegler added a comment - - edited

          Thanks, I tested the experiemental plugin.

          Having the YOUTRACK_CHANGES variables is great and it seems to generally work except for the option "find issues ids in text" as it still parses the wrong issue IDs for me. I tried it with the YOUTRACK_CHANGES variable as well as with customly entered text - it always parses the issue ID "XYZ" instead of "#XYZ-123". I tried it with DEV and ORD prefixes, but obviously the project shortnames do not matter - the number is always missing while the prefix is parsed. E.g., it tried to post to the youtrack issue "DEV" and "ORD" what obviously fails.

          When I enter an issue ID in the search query, it's working as it should.

          I'm curious, is that YOUTRACK_CHANGES variable now available in all build steps as well or just for those youtrack plugin related settings?

          Wolfgang Ziegler added a comment - - edited Thanks, I tested the experiemental plugin. Having the YOUTRACK_CHANGES variables is great and it seems to generally work except for the option "find issues ids in text" as it still parses the wrong issue IDs for me. I tried it with the YOUTRACK_CHANGES variable as well as with customly entered text - it always parses the issue ID "XYZ" instead of "#XYZ-123". I tried it with DEV and ORD prefixes, but obviously the project shortnames do not matter - the number is always missing while the prefix is parsed. E.g., it tried to post to the youtrack issue "DEV" and "ORD" what obviously fails. When I enter an issue ID in the search query, it's working as it should. I'm curious, is that YOUTRACK_CHANGES variable now available in all build steps as well or just for those youtrack plugin related settings?

          Erik Zielke added a comment -

          Sorry for not getting back sooner. I think I found an fixed the problem with the names. I have deployed to the live plugin center. Futhermore I have added the ability to customize the "related build" message.

          No, the variable is only available within that specific build step.

          Erik Zielke added a comment - Sorry for not getting back sooner. I think I found an fixed the problem with the names. I have deployed to the live plugin center. Futhermore I have added the ability to customize the "related build" message. No, the variable is only available within that specific build step.

          Wolfgang Ziegler added a comment - - edited

          Thanks for the update - now the issue parsing works fine. -> Resolving issue.

          Also, the option to customize the "related build" message is great. I noted the example just displays the commit id though, I'd suggest something showing the msg instead; e.g. I did:

          <% entries.each { %>

          • Commit: ${it.msgAnnotated} - view<%
            } %>

          Wolfgang Ziegler added a comment - - edited Thanks for the update - now the issue parsing works fine. -> Resolving issue. Also, the option to customize the "related build" message is great. I noted the example just displays the commit id though, I'd suggest something showing the msg instead; e.g. I did: <% entries.each { %> Commit: ${it.msgAnnotated} - view <% } %>

          I think this can be called fixed now.

          Wolfgang Ziegler added a comment - I think this can be called fixed now.

          Maybe one more thing, which probably would qualify as a follow-up: The comment to be created from the build step misses an option for adapting comment visibility, which the regular build notifier comment has. I guess it would make sense to provide it here as well.

          Wolfgang Ziegler added a comment - Maybe one more thing, which probably would qualify as a follow-up: The comment to be created from the build step misses an option for adapting comment visibility, which the regular build notifier comment has. I guess it would make sense to provide it here as well.

            erikzielke Erik Zielke
            fago Wolfgang Ziegler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: