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

New message templates show "is not supported in this context" in Pipeline builds

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • hipchat-plugin
    • None
    • HipChat plugin 2.1.0

      I upgraded to the new 2.1.0 release of the HipChat plugin and am now seeing messages like "HIPCHAT_CHANGES_OR_CAUSE is not supported in this context" when attempting commands like the following in a Jenkinsfile (multibranch pipeline):

      hipchatSend(message: '${CHANGES_OR_CAUSE}', room: 'Some Room')
      

      Note that this example uses the existing (now deprecated) CHANGES_OR_CAUSE template, not its HIPCHAT_CHANGES_OR_CAUSE replacement. This same sort of error happens for several other new templates as well, such as BUILD_DURATION, COMMIT_MESSAGE, and HIPCHAT_CHANGES.

      Additionally, the DURATION template is now rendering as "0 ms" regardless of actual duration.

      These messages were working as expected with the 2.0.0 version, aside from the "and counting" issue I logged as JENKINS-40461.

      Is there something new that must be done to support these particular templates in a Jenkinsfile/pipeline build, as of 2.1.0, or is this a regression?

          [JENKINS-41861] New message templates show "is not supported in this context" in Pipeline builds

          Code changed in jenkins
          User: Peter Major
          Path:
          src/main/java/jenkins/plugins/hipchat/ext/tokens/BuildDurationMacro.java
          src/test/java/jenkins/plugins/hipchat/ext/tokens/BuildDurationMacroTest.java
          http://jenkins-ci.org/commit/hipchat-plugin/c2bb55ebc511698b6cfcf7088c3e6d468fb8b40c
          Log:
          JENKINS-41861 Fix BUILD_DURATION for pipeline builds

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Peter Major Path: src/main/java/jenkins/plugins/hipchat/ext/tokens/BuildDurationMacro.java src/test/java/jenkins/plugins/hipchat/ext/tokens/BuildDurationMacroTest.java http://jenkins-ci.org/commit/hipchat-plugin/c2bb55ebc511698b6cfcf7088c3e6d468fb8b40c Log: JENKINS-41861 Fix BUILD_DURATION for pipeline builds

          Code changed in jenkins
          User: Peter Major
          Path:
          src/main/java/jenkins/plugins/hipchat/ext/tokens/CommitMessageMacro.java
          src/main/java/jenkins/plugins/hipchat/ext/tokens/HipchatChangesMacro.java
          http://jenkins-ci.org/commit/hipchat-plugin/c2524866e24eab55d4560e04879d798bc7de64b5
          Log:
          JENKINS-41861 Attempt to support CHANGES_OR_CAUSE and COMMIT_MESSAGE for pipeline builds

          Compare: https://github.com/jenkinsci/hipchat-plugin/compare/9ab63eb119e1...c2524866e24e

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Peter Major Path: src/main/java/jenkins/plugins/hipchat/ext/tokens/CommitMessageMacro.java src/main/java/jenkins/plugins/hipchat/ext/tokens/HipchatChangesMacro.java http://jenkins-ci.org/commit/hipchat-plugin/c2524866e24eab55d4560e04879d798bc7de64b5 Log: JENKINS-41861 Attempt to support CHANGES_OR_CAUSE and COMMIT_MESSAGE for pipeline builds Compare: https://github.com/jenkinsci/hipchat-plugin/compare/9ab63eb119e1...c2524866e24e

          aldaris added a comment -

          Hopefully the issues raised here are now all addressed. If HIPCHAT_CHANGES_OR_CAUSE and COMMIT_MESSAGE is still acting up: pull requests welcome.

          Will wait for a week or so to see if any other issues get reported, and then I'll release 2.1.1.

          aldaris added a comment - Hopefully the issues raised here are now all addressed. If HIPCHAT_CHANGES_OR_CAUSE and COMMIT_MESSAGE is still acting up: pull requests welcome. Will wait for a week or so to see if any other issues get reported, and then I'll release 2.1.1.

          Nick Jones added a comment -

          I did some additional testing of 2.0.0 vs. 2.1.0:

          These work in both versions:

          • BRANCH_NAME
          • BUILD_NUMBER
          • BUILD_URL
          • JOB_DISPLAY_NAME
          • JOB_NAME
          • URL

          These don't work in either version:

          • BUILD_DURATION (doesn't render at all in 2.0, renders as "0 ms" in 2.1)
          • CHANGE_ID
          • EXECUTOR_NUMBER
          • JOB_URL
          • NODE_NAME
          • WORKSPACE
          • others from the Global Variable Reference

          These only work in 2.0.0:

          • DURATION (renders as "0 ms" in 2.1.0)
          • CHANGES ("not supported in this context" in 2.1.0)
          • CHANGES_OR_CAUSE ("not supported in this context" in 2.1.0)
          • COMMIT_MESSAGE_TEXT ("not supported in this context" in 2.1.0)

          These only work in 2.1.0 (as expected):

          • BLUE_OCEAN_URL
          • TEST_REPORT_URL
          • PROJECT_DISPLAY_NAME
          • TEST_COUNT
          • FAILED_TEST_COUNT
          • SKIPPED_TEST_COUNT
          • SUCCESS_TEST_COUNT

          Nick Jones added a comment - I did some additional testing of 2.0.0 vs. 2.1.0: These work in both versions: BRANCH_NAME BUILD_NUMBER BUILD_URL JOB_DISPLAY_NAME JOB_NAME URL These don't work in either version: BUILD_DURATION (doesn't render at all in 2.0, renders as "0 ms" in 2.1) CHANGE_ID EXECUTOR_NUMBER JOB_URL NODE_NAME WORKSPACE others from the Global Variable Reference These only work in 2.0.0: DURATION (renders as "0 ms" in 2.1.0) CHANGES ("not supported in this context" in 2.1.0) CHANGES_OR_CAUSE ("not supported in this context" in 2.1.0) COMMIT_MESSAGE_TEXT ("not supported in this context" in 2.1.0) These only work in 2.1.0 (as expected): BLUE_OCEAN_URL TEST_REPORT_URL PROJECT_DISPLAY_NAME TEST_COUNT FAILED_TEST_COUNT SKIPPED_TEST_COUNT SUCCESS_TEST_COUNT

          aldaris added a comment -

          I'm a bit puzzled as to how could the CHANGES variable work in 2.0.0, looking at the code, I just don't see how it could have worked :/
          I will have a second stab at trying to get CHANGES* and COMMIT_MESSAGE* working with pipeline jobs..

          aldaris added a comment - I'm a bit puzzled as to how could the CHANGES variable work in 2.0.0, looking at the code, I just don't see how it could have worked :/ I will have a second stab at trying to get CHANGES* and COMMIT_MESSAGE* working with pipeline jobs..

          Nick Jones added a comment -

          I should have clarified – CHANGES in 2.0 renders as "No changes", which I assumed to be functional but some byproduct of the way the multibranch pipeline job works. CHANGES_OR_CAUSE for the same build renders as "Branch indexing" in 2.0. In 2.1, both render as "... is not supported in this context".

          Nick Jones added a comment - I should have clarified – CHANGES in 2.0 renders as "No changes", which I assumed to be functional but some byproduct of the way the multibranch pipeline job works. CHANGES_OR_CAUSE for the same build renders as "Branch indexing" in 2.0. In 2.1, both render as "... is not supported in this context".

          aldaris added a comment -

          Ah, so it never really worked well then. CHANGES_OR_CAUSE just falled back to CAUSE because it was never able to calculate CHANGES.

          aldaris added a comment - Ah, so it never really worked well then. CHANGES_OR_CAUSE just falled back to CAUSE because it was never able to calculate CHANGES.

          aldaris added a comment -

          Reopening to track the development of real support for CHANGES and COMMIT_MESSAGE tokens.

          aldaris added a comment - Reopening to track the development of real support for CHANGES and COMMIT_MESSAGE tokens.

          Code changed in jenkins
          User: Peter Major
          Path:
          src/main/java/jenkins/plugins/hipchat/ext/tokens/CommitMessageMacro.java
          src/main/java/jenkins/plugins/hipchat/ext/tokens/HipchatChangesMacro.java
          src/main/java/jenkins/plugins/hipchat/utils/TokenMacroUtils.java
          http://jenkins-ci.org/commit/hipchat-plugin/8d9167cf7db2791c9278b5da762d0154b810f5f9
          Log:
          JENKINS-41861 Add full support for HIPCHAT_CHANGES* and COMMIT_MESSAGE tokens in pipeline builds

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Peter Major Path: src/main/java/jenkins/plugins/hipchat/ext/tokens/CommitMessageMacro.java src/main/java/jenkins/plugins/hipchat/ext/tokens/HipchatChangesMacro.java src/main/java/jenkins/plugins/hipchat/utils/TokenMacroUtils.java http://jenkins-ci.org/commit/hipchat-plugin/8d9167cf7db2791c9278b5da762d0154b810f5f9 Log: JENKINS-41861 Add full support for HIPCHAT_CHANGES* and COMMIT_MESSAGE tokens in pipeline builds

          aldaris added a comment -

          Should work properly in the upcoming 2.1.1 version.

          aldaris added a comment - Should work properly in the upcoming 2.1.1 version.

            aldaris aldaris
            medianick Nick Jones
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: