NodeLabel Parameter

126 views
Skip to first unread message

Pankaj Malhotra

unread,
Aug 23, 2019, 8:59:38 PM8/23/19
to Jenkins Users
I am using jenkins pipeline to pass node parameter from one job to another.
Here is code:-
parameters: [
                        [
                             $class: 'NodeParameterValue', 
                             name: 'UPSTREAM_NODE', 
                             labels: ["${nodeToBeExecuted}"], 
                             nodeEligibility: [$class: 'AllNodeEligibility']
                         ],
                         [$class: 'StringParameterValue', name: 'ansibleHostFile', value: "a9mpcl1.hosts"]
                    ]


Above is working fine when I am passing it to Jenkins project, but it doesn;t work in case of Jenkins pipeline

Code for accepting Input as parameter:

import java.text.SimpleDateFormat
import java.util.Calendar
import java.io.File
import org.jvnet.jenkins.plugins.nodelabelparameter.*

pipeline {
    agent { node { label 'perf' } } 
    
    parameters {
NodeParam(name: 'UPSTREAM_NODE', description: 'select node', defaultNodes: ['perfslave1'], allowedNodes: ['perfslave1', 'perf slave2'], trigger: 'multiSelectionDisallowed', eligibility: 'IgnoreOfflineNodeEligibility')
}
}

Can you please suggest what should I use to accept the input as node parameter?
Reply all
Reply to author
Forward
0 new messages