Hi Jan, Thanks for your reply! Tricky hack you suggested but I would rather not manipulate the config.xml files :)
I would like to start several jobs according to their names and avoid putting them all in the upstream job's configurations and having to add or remove when another relevant job created or deleted... Best, Daniel On Mar 28, 12:00 pm, Jan Seidel <wakkal...@gmail.com> wrote: > Hi Daniel, > > that is a wish probably many of us have in different situations ;) > As example: I would like to use vars or regex in URL for SCM check > out. That would reduce the amount of jobs significantly. > Using more jobs makes it easier. > > The question is, do you just want to use some specific jobs instead of > all or do you want to split each downstream job into its own config > line? > Just to bring each downstream job into a separate configuration > segment can be done with the parametrized trigger plugin. > A dynamic method is a bit more tricky. > > There is a dirty way to do it, well... 2 actually... Everybody asides > of Daniel should look the other way ^^ > What you should install: > - exclusive execution Jenkins plugin > - startup trigger Jenkins plugin > - GNU sed/awk > > You have to split your job into several build jobs. > Job #1 runs "normally" and has an additional build step. > The build step manipulates config.xml of job #3 to amend the > parametrized build call to match the needed downstream names and to > set the boolean value of the startup trigger plugin to true. > > Job #2 does simply restart the server either withhttp://hudson_url/restart > (easiest with sfk, curl or wget) or by restarting the service itself > on OS level with the command 'start /B CMD /C "sc stop jenkins && sc > start jenkins"'. The latter is used if Jenkins does not allow > anonymous and your authentification method does not work with the > Jenkins CLI (e.g. TeamForge as auth realm). > This job has "Set exclusive execution" enabled. The job is then first > executed when all other running jobs have finished. > > Job #3 will run automatically after restart. > Last build step here will "reset" the config.xml of job #3. It will > set the boolean value of the startup trigger plugin to false to > prevent an automated run after a restart. > Finally does job #3 call job #2 to put the changes into effect. > > Job#2 is separated for a simple reason. A restart from a build would > always leave the build history empty as the server restarts > unexpected. That's not good for your productive build jobs. The job > would not have the time to write the build history log to state the > status of the job. But that's ok for job #2. > > You could also copy templates to job #3 instead of using regex > manipulation. You need then a parameter as switch to determine which > config template has to be copied. It's up to you but this approach is > static compared to the regex manipulation. ;) > > Hope this helped > Jan > > On 28 Mrz., 10:33, Daniel Tkatch <daniel.tka...@smeet.com> wrote: > > > > > > > > > I would like a Jenkins job to trigger others according to a regular > > expression matching of their names or at least using wildcards. At the > > moment I can only trigger multiple downstream jobs if I list them all > > comma separated. > > > TestSuite-production -> *Test-production > > instead of > > TestSuite-production -> FirstTest-production, SecondTest-production, > > ThirdTest-production, ... > > > Does somebody know a plugin or another possible which would make it > > possible? > > > Thanks in advance, > > Daniel