У меня возникла следующая проблема с Дженкинсом и двумя Cronjobs: один утром и другой ночью.
Я использую Groovy:
![enter image description here](https://i.stack.imgur.com/g5RJL.png)
pipeline {
agent any
triggers {
parameterizedCron('''
*/1 * * * * %Cron_job=Morning
*/1 * * * * %Cron_job=Night
''')
}
stages {
stage('Stage 1') {
steps {
echo "Pass"
}
}
stage('Stage 2') {
steps {
echo "Pass"
}
}
stage('Stage 3') {
steps {
echo "Pass"
}
}
stage('Executing All - Morning') {
when {
allOf {
expression { params.Select_Type ==~ /(All|Computer)/ }
expression { params.Select_Option == 'Notebook' }
expression { params.Cron_job == 'Morning'}
}
}
steps {
sh
echo "${params.Cron_job} :)"
script { currentBuild.description = "${params.Cron_job}" }
}
}
}
stage('Executing All - Night') {
when {
allOf {
expression { params.Select_Type ==~ /(All|Computer)/ }
expression { params.Select_Option == 'Notebook' }
expression { params.Cron_job == 'Night'}
}
}
steps {
sh
echo "${params.Cron_job} :)"
script { currentBuild.description = "${params.Cron_job}" }
}
}
}
И все прошло хорошо, но только один раз.
Этапы сборки:
![enter image description here](https://i.stack.imgur.com/Vi2LX.png)
И журналы:
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Stage 3)
[Pipeline] echo
Stage 3
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Executing All use cases - Morning)
**Stage "Executing All - Morning" skipped due to when conditional**
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Executing All use cases - Night)
**Stage "Executing - Night" skipped due to when conditional**
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
Я не знаю, что я Я делаю неправильно.