Automatically build remote Jenkins projects with Parameterized Remote Trigger
As I am working more and more with building a Disaster Recovery plan , I dive more and more in automating different aspects of the infrastructure.
This week it was Jenkin's turn.
I had a use case where I had to keep the code of a Jenkins project in one EC2 [server2.com] always updated with the latest version based on the state of another project in a different EC2 [server2.com]. So, I set up Jenkins in server1 to build the remote server [server2] right after it's own successful build .
Let's see how....
- Install the Parameterized Remote Trigger Plugin only in server1. There is no need for it in server2.
- In order to set it up pay close attention to the screenshots in the above link, but I am going also to show how.
- Go to the server1 Jenkin's configuration and do the following [see screenshot]
Note: The 'Validate Address' button checks the format and connection of the remote address and credentials
4. Go to server1's Jenkin's->Job->Configuration to configure the remote trigger for the specific job and do the following [see screenshot]
5. Now go to the server2's Jenkin's->Job->Configuration , and configure the parameterised build to match the server1's parameter configuration [see screenshot].
Note: If you make remote triggers for more than one project, make sure to use distinct [Name=Default Value] pairs in your configurations otherwise you are going to build project SpawnUnicorns in server1 and the project DestroyWorld will be built in server2 .... like I was doing :P
So, like that, you can have a chain of builds in remote jenkins instances that will follow only one initial build.
Have a coffee, you have a lot of spare time to watch this while the magic happens on the wire :]