Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

add build parameter in jenkins build schedule

I have a jenkins job. i want to build my job in a specific time with a build parameter.

I want to do this by using the Build periodically option.

I have input like this:

*/1 * * * * Parameter1

If I do this, jenkins show an error.

Is this possible without using any plugin.

if not, than which plugin will be better

Alternatively is there a way to give parameter's here in the schedule?

My actual requirement is like this:

 build in morning using one parameter
 build in evening using another parameter.    
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Basically, with the 'Build periodically' option you can't schedule a Jenkins job with parameters.

However, to schedule a job at different times that needs to use different environments, you have to use the parameterized-scheduler plugin or search for it in (Manage Jenkins -> Manage Plugins -> Parameterized Scheduler).

Examples:

 # Parameter1
 H/15 * * * * %Parameter1
 # Parameter2
 H/30 * * * * %Parameter2

Remember you have to have your parameters already setup because the plugin is visible only for jobs with parameters.

The Node and Label parameter plugin can help since it allows you to select individual nodes assuming your different servers qa1 and qa2 are already configured. Hope that clarifies things for you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...