Alternate title: Converting custom parameters from non-declarative pipeline to declarative pipeline
I’m trying to add a git parameter to a pipeline job using the newer declarative syntax.
What I found:
properties([
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false],
parameters([
[$class: 'GitParameterDefinition',
branch: '',
branchFilter: '.*',
defaultValue: '',
description: 'description',
name: 'BRANCH_PARAM',
quickFilterEnabled: false,
selectedValue: 'NONE', sortMode: 'NONE',tagFilter: '*', type: 'PT_BRANCH']
]),
pipelineTriggers([])
])
What I tried:
pipeline {
agent none
parameters {
[$class: 'GitParameterDefinition',
branch: '',
branchFilter: '.*',
defaultValue: '',
description: 'Version to release',
name: 'RELEASE_VERSION',
quickFilterEnabled: false,
selectedValue: 'NONE',
sortMode: 'DESCENDING_SMART',
tagFilter: '*',
type: 'PT_TAG']
}
[…]
}
Which doesn’t do anything, it is like I didn’t specify parameters at all.
I can’t find any examples of using a plugin provided parameter using the newer syntax. Is it even possible?
--
Thomas Suckow