Declarative pipeline support#12
Declarative pipeline support#12greg2001 merged 1 commit intojenkinsci:masterfrom ro-kr:declarative_pipeline_support
Conversation
- added symbol names so this plugin can be used in declarative pipelines - bumped min Jenkins version to 2.164.1 (required for pipeline support) - moved determination of default value for build into method getDefaultParameterValue() (separates it from default value used for editing the parameter definition) - fixed and modernized Jelly code - added more text translations
|
Can someone please have a a look at it and merge? |
|
thanks for merging this. when will it be available for automatic upgrade from Jenkins ? our devops say Jenkins doesn't give them the option to upgrade from 1.2 and the github release is not in .hpi format. I created an issue #13 for the same. |
|
I am trying to add this in a seed job but I am getting this error: Any idea what I am doing wrong? This is my code: However this works no problem: |
|
I guess this is a limitation of the Jenkins Job DSL plugin, it only supports the parameter types listed here: https://jenkinsci.github.io/job-dsl-plugin/#path/job-parameters |
This adds support for declarative pipeline scripts, so that the persistent parameters can be created like the following (like requested in #8)
pipeline { parameters { persistentBoolean(name: 'Boolean', defaultValue: true, description: 'A boolean parameter', successfulOnly: false) persistentString(name: 'String', defaultValue: 'a single line', description: 'A string parameter', successfulOnly: false) persistentText(name: 'Text', defaultValue: 'text\nwith\nmultiple\nlines', description: 'A text parameter', successfulOnly: false) persistentChoice(name: 'Choices', choices: ['red', 'green', 'blue'], description: 'A choices parameter', successfulOnly: false) } ... stages { ... } }The parameters are also supported by the declarative snippet generator.
For this feature it's needed to bump the minimal required Jenkins version to 2.164.1. The additional code is basically copied from the build-in non-persistent variants of these parameter types.
Further visible improvements (as they exist on the non-persistent parameter types):
Code improvements:
getDefaultParameterValue()in order to separate it from the original default value used for editing the parameter definition.resolves #8, fixes #9, fixes #4