1

In Jenkins, I know that input can be combined with timeout (example), but what about Build with Parameters?

My (maybe incorrect) thought is to have "default" parameters set on a declarative pipeline Jenkinsfile, so that if a human runs it, he can enter the parameters, but when it runs periodically (e.g., daily at 12pm), the prompt is not required and the "default" parameters are used.

mellow-yellow
  • 1,670
  • 1
  • 18
  • 38
  • If you wan't the automatic builds to use the default parameters, then you should be able to use a regular periodic scheduled trigger, and the users will be able to build using build with parameters. – Jon S Nov 08 '19 at 20:13

2 Answers2

0

It seems like what you're looking for is the parameterized scheduler plugin perhaps? See my answer Here

Adam vonNieda
  • 1,635
  • 2
  • 14
  • 22
0

You are correct with regard to setting default values and can do this:

options {
    timeout(time: params.timeoutTime, unit: params.timeoutUnit)
}
parameters {
    string(name: 'timeoutTime', defaultValue: '30', description: '')
    string(name: 'timeoutUnit', defaultValue: 'MINUTES', description: '')
}

When you trigger the build manually, it will use the parameters that you provide. For timer triggered builds, it will use the default values.

Dibakar Aditya
  • 3,893
  • 1
  • 14
  • 25
  • Thank you! Before you posted this, I had solved my own question with the Extended Choice Parameter plugin (https://wiki.jenkins.io/display/JENKINS/Extended+Choice+Parameter+plugin) which allows default values in the Jenkinsfile (https://github.com/jenkinsci/extended-choice-parameter-plugin/pull/25). – mellow-yellow Nov 10 '19 at 01:09