Hello Team,
After look all the around in the web and not be able to get the solution i am reaching out here.
As of now I have code a test pipeline with 2 stages
A) stage-1 to scan for the available server from a file in remote remote
B) Stage-2 list all the server as option to select using extended choice parameter
GOAL: What i want to do is make use of active choice as this give filter option
below code works properly but i want to replace the stage('Select nodes') with active choice rather than extended Choice Parameter. And the build option should be "BUILD NOW rather than BUILD with PARAMETER (as the server info will be dynamic, hence reading the last info will not help"
node {
'Email_CC=',
'Email_ReplyTo=',
'EmailDev=',
'EmailTest=',
'EmailProd=',
'Jenkins_URL=http://jenkins-102.domain.local:8080']) {
stage('Scan Register Nodes') {
sh label: "Scanning for registered nodes", script: """
if [[ ! -e ~/tmp_dir ]]; then
mkdir ~/tmp_dir
fi
// cat node_list.lst => will be replace by actualy api query code
cat node_list.lst > ~/tmp_dir/reg_node_list.lst
echo "Total Registerd Nodes are as below"
echo "ALL" >> ~/tmp_dir/reg_node_list.lst
cat ~/tmp_dir/reg_node_list.lst
"""
}
stage('Select nodes') {
env.servers_list = input message: 'Select the Servers', parameters: [extendedChoice(description: 'Select the Servers to perform the operation in the pipeline', multiSelectDelimiter: ',', name: 'Servers', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', groovyScriptFile: "/xxxx/servers.gvy",defaultValue: 'None', visibleItemCount: '20')]
echo "${servers_list}"
}
}
}