I am wondering if it is possible to create new Jenkins build-jobs from within the pipeline groovy script. I know that it is possible to start existing jobs, but I would also like to create new jobs in the script and then start them.
This would allow me to create a "job-graph" in my script. With job-graph I mean a collection of build-jobs that may rely on each others results and the graph determines which jobs can be run in parallel. Something like
/- WindowsBuild---------- WindowsRunTests -------------\
/ \
JobRoot --- LinuxBuild------------ LinuxRunTests ----------------/-- AllDone
\ \ /
\ \- LinuxRunDynamicAnalysis ----/
\- StaticCodeAnalysis -------------------------------/
Before I switched to the Pipeline job I did this by manually creating the jobs and setting their dependencies. Now I would like to create the necessary jobs in the script.
With the current model for parallalism in the jenkins pipeline I have a build-stage, a test-stage, etc but the stages slow down the overall execution because for example the WindowsRunTests-step will not be started before all build-steps on all platforms have finished although it only needs the results from the WindowsBuild-step.
It may also improve visualizing the pipeline and separating the console ouput which gets mixed together with the parallel()
command.