Jenkins SSH Plugin: Remote Host Parameterization

In Jenkins, I use the SSH plugin to run shell commands on a remote machine via ssh. I have added my SSH sites to the global configuration. But in the "Execute shell script on the remote host using ssh" section of my Jobs configuration, instead of just selecting one of the SSH sites from the drop-down list, I would like to use the build option. Thus, I would like to generalize this task for remote access to various environments depending on my requirements.

Is there a way to parameterize the ssh site crash? Or reach my requirement differently?

By the way, one option that I already have is ssh for the remote machine as part of the script and execute it there.

+4
source share
2 answers

You can parameterize an SSH server. See more details.

+2
source

Two plugins are available for you. Assuming you have limited ssh connections, the following might help you.

1) MultiJob Plugin: - You can create downstream jobs that will accept input from previous builds. So based on your settings, you can configure new tasks for different SSH connections. For example: -

if you have 4 ssh connections A, B, C, D do 4 auxiliary tasks for each connection. you can write simple if else conditions that Job sets, if the input parameters are A, B, C, D.

2) JobDSL : - , .. groovy if else, , , A, B, C, D.

, .

+1

Source: https://habr.com/ru/post/1612186/


All Articles