2

I could find that “submitter” parameter accepts individual user IDs and external LDAP groups. But “Jenkins-local” groups defined by any authorization strategy are not working. I have a limitation not to use external LDAP groups.

The workaround that I have used is define the comma separated list of individual users as a Jenkins global variable and manage the list from there. This gives a better maintainability. However, it mandates that the stage is wrapped within node. As the pipeline waits for the approver to approve this step, it holds a node instance and this causes the rest of the jobs to wait for available instances. Is there a way to use a Jenkins global variable outside of node for the input step?

node{
stage ('Approve?')
{
    timeout(time:2, unit:'DAYS')
    {
        input message: 'Can you approve this ??', submitter: MY_APPROVERS
    }
}

}

1
  • Got any solution? I'm Facing the same issue
    – pbms
    Apr 26 '19 at 7:55
1

We have moved onto using Jenkins templates and I have a workaround to keep the individual approver names list in one place. Sharing the sample code for your reference.

#!/usr/bin/env groovy
import com.mm.Constants 
def call(String teamName = 'LOGIN') {
   // team name of null means UI
   teamName = teamName ?: 'UI'

   timeout(time:2, unit:'DAYS')
       {                                                              
           input message: 'Can you approve this ??', submitter: Constants."${teamName}_APPROVERS"
      }

}

#!/usr/bin/env groovy
class Constants {
   static final LOGIN_APPROVERS = 'approver1,approver2';
   static final UI_APPROVERS = 'approver2,approver3';
}

Below is how you call from the pipeline

stage ('Ship to QA?'){
    echo "Waiting for QA approval"
    shipToQA('LOGIN')
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.