How do I trigger another job from hudson as a pre-build step?
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.
A build job is a particular way of compiling, testing, packaging, deploying or otherwise doing something with your project.
There is a Parameterized Trigger Plugin, which enables "Trigger/call builds on other projects" in "Add build step" menu.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With