Normally, Jenkins pipeline settings can done in UI. However, it cannot be version control if settings changed.
Actually, version control can implement in decorative pipeline in jenkinsfile. In this example, it will setup schedule to execute job and setup clean build history settings.
pipeline {
agent any
triggers {
// setup schedule job.
cron('H */4 * * 1-5')
}
options {
// Setup pipeline options.
buildDiscarder logRotator(numToKeepStr: '7')
}
// Setup pipeline parametets
properties([
parameters([
choice(
choices: ['ONE', 'TWO'],
name: 'PARAMETER_01'
),
booleanParam(
defaultValue: true,
description: '',
name: 'BOOLEAN'
),
text(
defaultValue: '''
this is a multi-line
string parameter example
''',
name: 'MULTI-LINE-STRING'
),
string(
defaultValue: 'scriptcrunch',
name: 'STRING-PARAMETER',
trim: true
)
])
])
currentBranch = GIT_BRANCH
currentRepositoryPath = sh(returnStdout: true, script: 'git config remote.origin.url').trim()
}
Leave a Reply