Skip to content

Instantly share code, notes, and snippets.

@visitbethel
Created April 12, 2017 19:35
Show Gist options
  • Save visitbethel/ce76b5dca568af6549ab641466d67404 to your computer and use it in GitHub Desktop.
Save visitbethel/ce76b5dca568af6549ab641466d67404 to your computer and use it in GitHub Desktop.
Dynamic creation of properties for Pipeline initialization
def props = []
if (config.enableReleaseControl) {
props.add(
[
$class: 'ParametersDefinitionProperty', parameterDefinitions: [
[$class: 'BooleanParameterDefinition', defaultValue: false, description: 'Perform release cut (1.0.0-SNAPSHOT to 1.0.0.1)', name : 'PERFORM_RELEASE_CUT'],
[$class: 'BooleanParameterDefinition', defaultValue: false, description: 'Perform incremental versioning from (1.0.0-SNAPSHOT to 1.0.1) mostly done after a sprint completion or demo', name : 'INCREMENTAL_VERSIONING'],
[$class: 'StringParameterDefinition', defaultValue: '', description: 'Placeholder for explicit release tag for manual assignment', name: 'RELEASE_TAG']
]
]
)
}
def cron = config.cron ?: 'H/3 * * * *'
props.add(
pipelineTriggers([
triggers: [
[
$class: 'hudson.triggers.SCMTrigger',
scmpoll_spec : cron
]
]
])
)
// install the properties
properties( props )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment