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

Enable credentials in triggers using declarative pipelines

    Details

    • Similar Issues:

      Description

      Background

      This issue originates from this issue in Generic Webhook Trigger Plugin: https://github.com/jenkinsci/generic-webhook-trigger-plugin/issues/107

      The reporter is using declarative pipeline.

      The user wants to get the credential, secret text, and use it when configuring triggers. More specifically as value of the 'token' configuration parameter in the plugin.

      Something like this:

      ...
        environment {
          JENKINS_TOKEN = credentials('JENKINS_TOKEN')
        }
          
        triggers {
          GenericTrigger(
           genericVariables: [
             ...
           ],
           causeString: 'Triggered by $image',
           token: env.JENKINS_TOKEN,
           printContributedVariables: true,
           printPostContent: true
          )
        }
      ...
      

      Problem

      The problem is that the credential, or variables form the environment block, is not available in the triggers block.

       

        Attachments

          Activity

          Hide
          phananhtuan Tuan Phan added a comment -

           Hi team,
          Any update in this ticket? We meet the same issue with them

          Show
          phananhtuan Tuan Phan added a comment -  Hi team, Any update in this ticket? We meet the same issue with them

            People

            • Assignee:
              Unassigned
              Reporter:
              tomasbjerre Tomas Bjerre
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: