Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31017

Description doesn't get the resolved variable

    XMLWordPrintable

Details

    Description

      The script trigger plugin parses the string between "<description>" and "</description>" and sets as description of the build. If I need to add some variable i.e sprint week, the variable is not picked up. The method parses the entire content of execution of build and FIRST match with the given condition returned as description. A sample example -
      wk=$(date +%W)
      ret=$(expr $wk % 2)
      echo "<cause>Tagging for end of sprint</cause>"
      echo "<description>Tag for week $wk</description>"
      exit $ret
      [Home] $ /bin/sh /Users/Shared/Jenkins/tmp/hudson6505104509343595225.sh
      <cause>Tagging for end of sprint</cause>
      <description>Tag for week 42</description>
      The exit code is '0'.

      I was actually willing to set the tag as "Tag for week 42", though I get this as "Tag for week $wk". As simple fix to get the last occurrence of the tags in the content would fix this problem. I made the changes and tested locally. It works fine for me.

      Attachments

        Activity

          Code changed in jenkins
          User: gboissinot
          Path:
          src/main/java/org/jenkinsci/plugins/scripttrigger/AbstractTrigger.java
          http://jenkins-ci.org/commit/scripttrigger-plugin/8677f5be2322754a9ddc24689b25248411a9c850
          Log:
          FIx JENKINS-31017 - Add a method comment

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: gboissinot Path: src/main/java/org/jenkinsci/plugins/scripttrigger/AbstractTrigger.java http://jenkins-ci.org/commit/scripttrigger-plugin/8677f5be2322754a9ddc24689b25248411a9c850 Log: FIx JENKINS-31017 - Add a method comment

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/scripttrigger/AbstractTrigger.java
          http://jenkins-ci.org/commit/scripttrigger-plugin/c8058eb1afc9e9b3621d93fb88762d9f1dc1cf54
          Log:
          Merge pull request #6 from nsharma-git/master

          JENKINS-31017: Description doesn't get the resolved variable

          Compare: https://github.com/jenkinsci/scripttrigger-plugin/compare/693a10f23dd6...c8058eb1afc9

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/scripttrigger/AbstractTrigger.java http://jenkins-ci.org/commit/scripttrigger-plugin/c8058eb1afc9e9b3621d93fb88762d9f1dc1cf54 Log: Merge pull request #6 from nsharma-git/master JENKINS-31017 : Description doesn't get the resolved variable Compare: https://github.com/jenkinsci/scripttrigger-plugin/compare/693a10f23dd6...c8058eb1afc9

          Code changed in jenkins
          User: Neeraj Sharma
          Path:
          src/main/java/org/jenkinsci/plugins/scripttrigger/AbstractTrigger.java
          http://jenkins-ci.org/commit/scripttrigger-plugin/1335ed67e82fbe820432b7482dc7101707cca0a9
          Log:
          JENKINS-31017: Description doesn't get the resolved variable

          Chaning the description method to take the last occurance of given tags in the content
          In this case user would be able to set the description with variables

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Neeraj Sharma Path: src/main/java/org/jenkinsci/plugins/scripttrigger/AbstractTrigger.java http://jenkins-ci.org/commit/scripttrigger-plugin/1335ed67e82fbe820432b7482dc7101707cca0a9 Log: JENKINS-31017 : Description doesn't get the resolved variable Chaning the description method to take the last occurance of given tags in the content In this case user would be able to set the description with variables
          nsharma Neeraj Sharma added a comment - https://github.com/nsharma-git/scripttrigger-plugin/commit/1335ed67e82fbe820432b7482dc7101707cca0a9

          People

            gbois Gregory Boissinot
            nsharma Neeraj Sharma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: