| I have a similar need here but a bit more complex than the original reporter. I see that this issue is closed but hopefully we can re-examine the use case. I can also make a new issue. In my case I'd much rather omit buildDiscarder(). Also the original solution doesn't really work with things like disableConcurrentBuilds(). For example, it is not possible AFAIK to do something like: pipeline { options { disableConcurrentBuilds(env.FOO ? true : false) } } Either way I'd much prefer to do something like this:
pipeline {
options {
script {
if (env.FOO) {
buildDiscarder logRotator(daysToKeepStr: '30')
disableConcurrentBuilds()
}
}
}
}
|