Concurrent instances of the same hudson / jenkins work

I would like for individual users to send the repo path to the hudson server and the server starts building this repo. I do not want to leave a trace of the dynamically created task configuration. I would like to run several simultaneous instances of the same work. Obviously, this requires workspaces to be different for different instances. I believe this is not possible using any current extensions. I am open to different approaches to what I am trying to accomplish.

I just want the hudson server to be able to receive build requests from external sources and run them as long as there are free executors. I want the build configuration to be the same for all builds except the repo location. I do not want to have dozens of identical jobs sitting with automatically generated names.

Is there anyone out there using Hudson or Jenkins for something like that? How do you configure it? I assume that with enough scripts, I could dynamically create the necessary job configuration via the CLI API using a script, and then destroy it when that is done. But I want to keep artifacts around, so disrupting the work when it is done is a problem. I really don't want to write and maintain my own extension.

+4
source share
1 answer

This should be pretty simple to do with Jenkins, without requiring any plugins, although it depends on the type of SCM used.
In any case, there is an update from Hudson; no doubt the features needed to support your use case have been enhanced in many versions, starting with the formation of Jenkins.

You want to pass the repo path as a parameter to your assembly, so you must select the This assembly parameter is parameterized " option in the assembly configuration. There you can add the string parameter REPO_PATH or the like.

Next, where you indicate where the code is downloaded, replace the path with ${REPO_PATH} .
If you are checking the code β€” or otherwise need access to the repo path β€” from the script, the variable will automatically be added to your environment, so you can reference ${REPO_PATH} from your script or Ant shell file.

At this point, when you click Build Now, you will be prompted to enter the repo path before the build begins. As mentioned in the above wiki page, you can call the buildWithParameters URL to start building directly with the desired parameter, for example. http://server/job/myjob/buildWithParameters?REPO_PATH=foo

Finally, if you want assemblies to run simultaneously, Jenkins can manage this for you by creating temporary workspaces for parallel assemblies. Just enable the option "Perform parallel assemblies if necessary" in your job configuration.

Artifacts will be available, like any other Jenkins builds. Although you probably want to control the amount of recent artifacts; this can be done by checking the "Cancel old builds" checkbox, and then under Advanced ... you can select the value "Maximum number of lines for storing artifacts".

+5
source

All Articles