Jenkins : Triggering Jobs in Sequence
Introduction
In this article, I will show you how to trigger jobs in sequence in Jenkins
1. Create Job TestJob1
2. Create Job TestJob2
3. Build Job TestJob1
Step1: Create Job TestJob1
Create a FreeStyle Project named TestJob1 as shown in blog titled 'Step by step guide for Jenkins FreeStyle Project'
After that go to TestJob1->Build tab and add buid step as shown below:
Step2: Create Job TestJob2
Same way create TestJob2. But message in Command keep as 'Test Job2 executed successfully'.
Now here, I want to execute TestJob2 automatically after TestJob1 is executed.
So go to TestJob2->BuildTriggers section and make the changes as shown below:
Step3: Build TestJob1
Now, Go to Home->TestJob1 and click Build Now button shown in left menu.
It will build the TestJob1 which can be shown in Build History marked as shown in image
You can view the console for the Build #1 for TestJob1 by going to Build History->#1.
Now go to Home->TestJob2. Here, Build History shows that TestJob2 is also built without manually building it.
You can view the console for the Build #1 for TestJob2 by going to Build History->#1
You can see that TestJob2 is automatically built while building TestJob1. Same way, you can create your actual jobs for automating your scenarios.







Comments
Post a Comment