jenkinsci / hipchat-plugin

HipChat notification plugin for Jenkins
https://plugins.jenkins.io/hipchat/
54 stars 85 forks source link

Message template tokens not available in pipeline #103

Closed perrefe closed 7 years ago

perrefe commented 7 years ago

I'm trying to use tokens like BLUE_OCEAN_URL or HIPCHAT_CHANGES_OR_CAUSE within hipchatSend step message parameter in a declarative pipeline but their values are always null.

The step looks like:

hipchatSend (color: 'RED', notify: true, room: '123', token: 'abc', textFormat: false, message: "${JOB_NAME} [#${BUILD_NUMBER}] FAILED after ${env.HIPCHAT_CHANGES} and ${env.HIPCHAT_CHANGES_OR_CAUSE} (<a href=${env.BUILD_URL}/console>View log</a>)")

And the hipchat message is:

job [#13] FAILED after null and null (View log)
aldaris commented 7 years ago

You should probably use single quotes around the message parameter value, and the HipChat specific tokens are not stored as environment variables. You should use them like $HIPCHAT_CHANGES and $HIPCHAT_CHANGES_OR_CAUSE instead..

perrefe commented 7 years ago

woah! Single quotes did the trick! I used to put double quotes when a templatable String were needed because of variable substitution.

Thanks!