Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The SSH Run Script Action is used premium action which used to run scripts on an SSH server. The action can either run an entire script or a list of commands. All output is written to the build log as it is received from the host. 

...

titleNote:

...

SSH Run Script

Name

A friendly name for this action (will be displayed in the actions workflow area).

...

The port number that the SSH host will be listening on. Port 22 is the default port for SSH hosts.

Run Type

Select whether you want to specify a sequence of Commands

...

or a Script File to run. 

Script

This text area is shown when the Commands option is selected for the Run Type. Enter a list of commands to run one after the other on the target host. When run, the The commands option allows for running of a sequence of commands in the action. The action will open a channel once connected and proceed to call each command in sequence waiting for the previous command to complete. Once all commands have been run, the channel and connection will be closed and the action will completed, returning the exit code of the last run command.

Script

Note: For each subsequent command to be run, the terminal must return to a shell prompt. It is suggested that this method is used only when running simple commands.

Script File

This input box is shown when the Script file option is selected for the Run Type. Enter the path to the script file.

When the action is run, the script file is uploaded to the SSH host using SFTP and placed The script option allows for a script to be uploaded to the SSH host and run locally under the users account. This allows for commands to be run in the context of the SSH host and to avoid any translation issues between the actions client implementation and the host in question. The script is uploaded using SFTP, placing the file in the base directory of the logged in user. This .  The script is then updated to be executable and executed under the users account.  This requires the user to be able to write and execute files in their base directory. The script is then updated to be executable, and then executed from the users base directory. The  The action will then wait for the script to complete , and then sets before setting the Exit Code Variable to the last error code of the script. Before completing the action will remove the script file, and then close closing the channel and connection.

Commands

Script

The set of commands to run one after the other on the target host.

Note: For each subsequent command to be run, the terminal must return to a shell prompt. It is suggested that this method is used only when running simple commands.

Script file

Script File

The location of the script file to run. The script should be written as though it was run from the users login base directory and as the logged in user.

Convert any Windows newlines (CLRF) in script file to UNIX newlines (LF)

This is shown when the Script file option is selected for the Run Type. If this is ticked, any Windows newlines (CLRF) in script file is converted are converted to UNIX newlines (LF).

Clean up script after run

If this is ticked, the script file will be removed after run is cleaned up.


Authentication

...

The password for the supplied user. This password is stored as an encrypted value within the action , and once entered will not cannot be able to be read by those editing the action. It will also not appear in any logs.

...

Use UTF8 Encoding

If this is ticked, UTF8 Encoding is usedencoding is used when communicating with the SSH server.

Character Encoding Name

Visible only if 'Use UTF8 Encoding' is not tickednot ticked.

Enter the international standard name for the encoding of you the response from your SSH server response. See Encoding for full list. Leave blank to use the current code page for on the agent operating system.

Fail on non-zero exit code

If this is ticked, a non-zero exit code causes it the action to fail.  

Ignore Exit Codes

The list of exit codes to ignore (Commacomma-delimited).

Exit Code Variable

The Select a build variable to store the last exit code received from the script or commands that were run. All commands are run through an SSH channel. On completion of After running all the commands supplied, the channel returns its exit status.

...

Continue running next command on failure

Visible only if 'Command' Run Type is selected under the 'SS Run Script' tab tab.

If this is ticked, the next command continues to run on failure.

...

The time in milliseconds to wait before the action should timeout when waiting for a response from the host. 

...