Issue
I am trying to write a pipeline using the Filesystem List Parameter
parameter:
but I am unable to find the correct syntax anywhere, even in Jenkins doc. Do this plugin is allowed in Jenkins pipeline? if so then what will be the syntax?
https://plugins.jenkins.io/filesystem-list-parameter-plugin/
Thanks
Solution
See Pipeline Syntax → input
→ parameters
→ $class: 'FileSystemListParameterDefinition'
:
stages {
stage('Parameters') {
steps {
script {
// one parameter
def value = input( message: 'Select parameter value:',
parameters: [
[$class: 'FileSystemListParameterDefinition',
name: 'SingleFileSystemObject',
description: 'Single file system object',
nodeName: 'master',
path: '/',
selectedType: 'ALL',
formSelectType: 'SINGLE_SELECT',
regexIncludePattern: '',
regexExcludePattern: '',
sortReverseOrder: false
] // parameters
] // input
)
// more parameters, displayed on a separate parameter input page
Map values = input( message: 'Select parameter values:',
parameters: [
[$class: 'FileSystemListParameterDefinition',
name: 'SingleFileSystemObject',
description: 'Single file system object',
nodeName: 'master',
path: '/',
selectedType: 'ALL',
formSelectType: 'SINGLE_SELECT',
regexIncludePattern: '',
regexExcludePattern: '',
sortReverseOrder: false
],
[$class: 'FileSystemListParameterDefinition',
name: 'MultipleFileSystemObjects',
description: 'Multiple file system objects',
nodeName: 'master',
path: '/',
selectedType: 'ALL',
formSelectType: 'MULTI_SELECT',
regexIncludePattern: '',
regexExcludePattern: '',
sortReverseOrder: false
]
] // parameters
) // input
echo value
print values['SingleFileSystemObject']
print values['MultipleFileSystemObjects']
}
}
}
}
Console Output
E.g.:
...
[Pipeline] echo
root
[Pipeline] echo
bin
[Pipeline] echo
home,usr
...
Answered By - Gerold Broser