问题描述:

I am integrating an external tool with Jenkins. Part of the integration requires that user must be able to invoke parametrized builds using Jenkins remoting Java API /as described here:

Kohsuke Kawaguchi's example git repo/;

The parameters will vary depending on what is being build, i.e. for maven they will be artefact & group ids, for freestyle projects - folder paths, file names etc.

Is there a plugin/setting which allows you to do that?

I though of creating a Jenkins pre-build step which parses and transforms whatever parameters we send through /relying on some naming convention/ and then invokes the main Jenkins build step.

网友答案:

I think what you're trying to do is create a single reusable Jenkins build job, passing in all the variables at run-time? Difficult to maintain that kind of setup, I'd argue it's simpler to use the Jenkins API to automatically generate a Jenkins job for each project.

For complex parameter handling, perhaps you should consider an alternative tool like rundeck? It is a tool that complements Jenkins (See Rundeck plugin) and is best suited to general automation tasks across a network of machines. I mention it in this context because it has a very flexible mechanism for configuring job options and you could use it to run your builds....

网友答案:

Take a look at Jenkins CLI which allows you to access Jenkins from a script or from your shell.

相关阅读:
Top