Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I trigger another job from hudson as a pre-build step?

Tags:

jenkins

hudson

How do I trigger another job from hudson as a pre-build step?

like image 735
sorin Avatar asked Mar 30 '11 13:03

sorin


People also ask

How do I trigger another job in Jenkins?

Select a job that triggers a remote one and then go to Job Configuration > Build section > Add Build Step > Trigger builds on remote/local projects option. This configuration allows you to trigger another exciting job on a different CM (remote). The downstream job name part will autocomplete.

What is a build job?

A build job is a particular way of compiling, testing, packaging, deploying or otherwise doing something with your project.


2 Answers

There is a Parameterized Trigger Plugin, which enables "Trigger/call builds on other projects" in "Add build step" menu.

like image 89
Draco Ater Avatar answered Sep 20 '22 19:09

Draco Ater


You can use the plugin at http://wiki.jenkins-ci.org/display/JENKINS/Join+Plugin

Basically you create 3 jobs:

A = your prebuild ste

B = your main job

C = your trigger.

You 'build' C. It calls A, and once A is successful, it calls B. The plugin page gives you more information. The good thing about this plugin is that you can have any number of pre-build jobs.

We actually have a set of 5 pre-build jobs before our main is run.

================================================

If you don't want to try that:

If you are using Linux, you can do the following from within your "shell" script:

wget http://yourserver/hudson/job/MyJob/build?delay=0sec 

This will trigger the job. The bad part about this is that it will not wait for the job to finish.

like image 36
Sagar Avatar answered Sep 21 '22 19:09

Sagar