I want Jenkins to be able to kick off a deployment process on another server, but I want a process on that server to actually do the deplyoment process (for security reasons e.g. rather than having a user on the jenkins server ssh to the remote server and perform the deployment) and report the status of the deployment back to Jenkins.
It looks like the way to do this is to leverage Jenkins ability to have slave processes which can run on other servers, executing scripts and reporting console output, status, etc back to the master server.
So the sequence would be:
jenkins (master)
1. build ->
2. create artifacts ->
3. kick off deployment (using ssh kick off of slave job)jenkins (slave)
4. perform deployment ->
5. report status back to master jenkins server
Is this the appropriate way to achieve what I want to do?
You can deploy to multiple servers using the Node and Label parameter plugin. Add the servers you want to deploy your code using Jenkins nodes: Manage Jenkins > Manage nodes > New node. Be sure to add a label to each node so you can group them together and deploy to that group.
A Jenkins server available on the public Internet and configured with Git, Maven, Notification plugin, and Build Authorization Token Root plugin. You would also need the Admin privileges of the Jenkins server to install the plugins, if they are not already installed. Note: This tutorial is created using Jenkins ver.
Create a remote Jenkins build trigger in three stepsCreate a Jenkins build job and enable the Trigger builds remotely checkbox. Provide an authentication token; This can be any text string of your choice. Invoke the Jenkins build URL to remotely trigger the build job.
This is basic "Master - Slave" behavior in Jenkins - check the Distributed builds for that.
A) Install a Jenkins-slave on the remote machine.
B) Make this slave run "Tied Jobs" only.
C) Set step '4.' in your example to run on the remote Slave (or 'Node').
D) Step '3.' in your example should probably be a 'post-build-trigger' of step '2.'
(and not a step of its own).
The result of step '4.' in your example will be available to the master-machine.
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