Reputation: 1706
Snippet generator created a properties
block for me. First run reported
WorkflowScript: 1: The properties section has been renamed as of version 0.8. Use options instead. @ line 1, column 1.
pipeline {
Replacing properties
to options
results with the following error:
Errors encountered validating Jenkinsfile:
WorkflowScript: 4: options can not be empty @ line 4, column 5.
options([$class: 'ThrottleJobProperty',
Here is the full jenkinsfile
for reference
pipeline {
agent any
options([[$class: 'ThrottleJobProperty',
categories: ['xcodebuild'],
limitOneJobWithMatchingParams: false,
maxConcurrentPerNode: 0,
maxConcurrentTotal: 0,
paramsToUseForLimit: '',
throttleEnabled: true,
throttleOption: 'category']])
stages {
stage("Empty" {
steps {
echo "Do nothing"
}
}
}
}
Upvotes: 12
Views: 33397
Reputation: 301
its work for me.
properties([parameters([choice(choices: 'test\ndeploy', name: 'baranch')])])
pipeline{
agent any
stages{
stage('param check'){
when {
expression{
params.baranch == 'test'
}
}
steps{
echo "testing"
}
}
}
}
Upvotes: 6
Reputation: 1706
It's no longer possible to use custom $class
in the options
Note that
[$class: 'Foo', arg1: 'something', ...]
syntax can not be used, onlybooleanParam(...)
and the like.
JobProperty
s, such as buildDiscarder
or disableConcurrentBuilds
, Declarative-specifc options, such as skipDefaultCheckout
, and "wrappers" that should wrap the entire build, such as timeout
.pipeline
closure only.@Symbol
names for constructors.
[$class: 'Foo', arg1: 'something', ...]
syntax can not be used, only booleanParam(...)
and the like.parameters
and pipelineTriggers
@Symbol
s cannot be used here directly.Example:
options {
buildDiscarder(logRotator(numToKeepStr:'1'))
disableConcurrentBuilds()
}
Upvotes: 15