Reputation: 1
I switched from declerativ pipeline to scripted pipeline. Everything works fine only the Parameterized Scheduler Plugin makes problems. If i have one Trigger it works and the pipeline is scheduled. If i add another trigger only the second one works. May be it's a syntax problem but everything i tried doesn't work. Any ideas?
properties([
parameters([
booleanParam (defaultValue: true, description: 'test', name: 'test')
]),
pipelineTriggers([
parameterizedCron('15 20 * * * test=true'),
parameterizedCron('05 20 * * * test=false')
])
])//properties
Upvotes: 0
Views: 2393
Reputation: 4678
according to official documentation your syntax is wrong, you are missing %
. Also you can use one multiline parameterizedCron
.
pipeline {
agent any
parameters {
string(name: 'PLANET', defaultValue: 'Earth', description: 'Which planet are we on?')
string(name: 'GREETING', defaultValue: 'Hello', description: 'How shall we greet?')
}
triggers {
cron('* * * * *')
parameterizedCron('''
# leave spaces where you want them around the parameters. They'll be trimmed.
# we let the build run with the default name
*/2 * * * * %GREETING=Hola;PLANET=Pluto
*/3 * * * * %PLANET=Mars
''')
}
stages {
stage('Example') {
steps {
echo "${GREETING} ${PLANET}"
script { currentBuild.description = "${GREETING} ${PLANET}" }
}
}
}
}
So in your case it should be
properties([
parameters([
booleanParam (defaultValue: true, description: 'test', name: 'test')
]),
pipelineTriggers([
parameterizedCron('''
15 20 * * * %test=true
05 20 * * * %test=false''')
])
])//properties
Also please note that there's this open issue, which indicates that for your trigger to register for the scripted, it would need to be run manually at least twice.
Upvotes: 3