[JIRA] (JENKINS-57390) Enable credentials in triggers using declarative pipelines

13 views
Skip to first unread message

tomas.bjerre85@gmail.com (JIRA)

unread,
May 9, 2019, 3:55:02 PM5/9/19
to jenkinsc...@googlegroups.com
Tomas Bjerre created an issue
 
Jenkins / Improvement JENKINS-57390
Enable credentials in triggers using declarative pipelines
Issue Type: Improvement Improvement
Assignee: Tomas Bjerre
Components: generic-webhook-trigger-plugin, pipeline-model-definition-plugin
Created: 2019-05-09 19:54
Labels: pipeline
Priority: Major Major
Reporter: Tomas Bjerre

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 credential, variables form the environment block, is not available in the triggers block.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

tomas.bjerre85@gmail.com (JIRA)

unread,
May 9, 2019, 3:56:02 PM5/9/19
to jenkinsc...@googlegroups.com
Tomas Bjerre updated an issue
Change By: Tomas Bjerre
h1. 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:
{code:java}

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

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

 

tomas.bjerre85@gmail.com (JIRA)

unread,
May 9, 2019, 3:57:02 PM5/9/19
to jenkinsc...@googlegroups.com
Tomas Bjerre assigned an issue to Unassigned
Change By: Tomas Bjerre
Assignee: Tomas Bjerre

anhtuan.phan87@gmail.com (JIRA)

unread,
Oct 2, 2019, 8:21:02 PM10/2/19
to jenkinsc...@googlegroups.com
Tuan Phan commented on Improvement JENKINS-57390
 
Re: Enable credentials in triggers using declarative pipelines

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

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

nisyarazh@gmail.com (JIRA)

unread,
Apr 16, 2020, 6:54:02 AM4/16/20
to jenkinsc...@googlegroups.com

Hello team!

Is it planned to be implemented in Jenkins?

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages