Skip to content

Variables expansion in the payload #363

@lisotton

Description

@lisotton

Jenkins and plugins versions report

In one of my jobs I have this with credentials:

credentialsBinding {
  string('BOT_TOKEN', 'bot-token')
  usernamePassword('OTHER_CREDENTIALS', 'other-credentials')
}

Then I have this with Generic Webhook Trigger:

genericVariable {
  key("COMMENT_TEXT")
  value("\$.comment.text")
}

If in the comment text I have something like:

Use the variable ${BOT_TOKEN} and ${OTHER_CREDENTIALS}.

Then inside of the shell command I have

echo "${COMMENT_TEXT}"

The output will be:

Use the variable **** and ****.

I have this job working as a webhook for Bitbucket, so when someone adds a comment to a PR a message is sent in Mattermost to the user. Then the person will receive not the ***, they are receiving the actual credentials, but they were supposed to receive the literal Use the variable ${BOT_TOKEN} and ${OTHER_CREDENTIALS}..

I believe the plugin is doing the expansion or I'm missing some configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions