I need help here!
I have about 600 jobs in Jenkins and I have the process of creating
the job automated. I'm creating the config.xml file for the job with
all necessary parameters changed depending on the particular project
and then I'm creating new folder in Jenkins jobs folder with this
config file in place.
After that I'm forced to reload the server environment in order to
pick up new job.
The problem with this approach is obvious - reload takes a lot of
time, i have to maintain a cron job that polls the amount of jobs has
changed and it all makes it cumbersome. Plus i have two instances of
jenkins and one of them is using promotion plugin, so because of
promotion plugin being so special and having separate config file i
have to also create this file for the new job in specific folder and
then reload the environment to pick up the new job.
Now I know there is an option to create the job via cli by providing
the XMl file in STDIN. The problem is I cannot understand how it
supposed to work?
I'm trying to provide path to the xml file (like this : java -jar
jenkins-cli.jar -s http://myserver:port create-job myname
path/to/the/config.xml) - it fails with "Too many arguments". What
this command expects user to do?
How can i pass xml file content to this from another program other
than a file name? I tried to use a stream - it doesn't work...
Another problem that i kind of foresee - promotion plugin and the fact
that this plugin suddenly has its own configuration file in its own
place??? I don't think it supposed to happen in a first place, but
nonetheless if it happened how am i supposed to configure new job via
cli with promotion plugin???
May be there are better ways of automating job submissions? Please advise!
Thanks!
java -jar -cli.jar -s http://myserver:port create-job myname path/to/the/config.xml
java -jar -cli.jar -s http://myserver:port create-job < myname path/to/the/config.xml