Reputation: 173
In Jenkins, I am using SSH Plugin to run shell commands on a remote machine via ssh. I have added my SSH sites to global configuration. But under "Execute shell script on remote host using ssh" section of my Jobs configuration, instead of just selecting one of the SSH sites from the drop down, I would like to consume a build parameter. This way I would like to generalize this job to remote to different environments depending on my requirements.
Is there a way to parameterize ssh site drop down? Or achieve my requirement in a different way?
BTW one option I already have is, to have ssh to remote machine as part of the script and execute it there.
Upvotes: 5
Views: 5375
Reputation: 459
Yes. Defenately possible with Publish Over SSH plugin.
You can also refer the link here for detailed steps.
Upvotes: 1
Reputation: 2839
It is possible to parameterize the SSH server. Refer this post for details.
Upvotes: 2
Reputation: 1507
There are two plugin's available to help you. Assuming you have limited ssh connections following may help you.
1) MultiJob Plugin:- You can create downstream Jobs which will take input from previous builds.So based on your parameters you can configure new jobs for different SSH connections. For eg:-
if you have 4 ssh connections A,B,C,D make 4 sub jobs for each connection. you can write simple if else conditions which Job to select if input parameter is A,B,C,D.
2) JobDSL Plugin:- Similar way you need to schedule your build jobs based on input from previous i.e you need to write some groovy if else conditions to select which connection you want to use if input parameter is A,B,C,D.
Hope it helps.
Upvotes: 1