Declarative pipeline support #12
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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