mirror of
https://github.com/appleboy/ssh-action.git
synced 2026-07-01 17:41:42 +00:00
Compare commits
No commits in common. "dd0f09ca072e60babe3cc58ed83c66a86176300c" and "c78141851a6d716353b2ce13c978924e0300775e" have entirely different histories.
dd0f09ca07
...
c78141851a
67
README.md
67
README.md
@ -16,40 +16,39 @@ This thing is built using [Golang](https://go.dev) and [drone-ssh](https://githu
|
||||
|
||||
See [action.yml](./action.yml) for more detailed information.
|
||||
|
||||
| Input Parameter | Description | Default Value |
|
||||
|---------------------------|------------------------------------------------------------------------------------------|---------------|
|
||||
| host | SSH host address | |
|
||||
| port | SSH port number | 22 |
|
||||
| passphrase | SSH key passphrase | |
|
||||
| username | SSH username | |
|
||||
| password | SSH password | |
|
||||
| protocol | SSH protocol version (tcp, tcp4, tcp6) | tcp |
|
||||
| sync | Enable synchronous execution if multiple hosts | false |
|
||||
| use_insecure_cipher | Include more ciphers with use_insecure_cipher | false |
|
||||
| cipher | Allowed cipher algorithms. If unspecified, a sensible default | |
|
||||
| timeout | Timeout duration for SSH to host | 30s |
|
||||
| command_timeout | Timeout duration for SSH command | 10m |
|
||||
| key | Content of SSH private key. e.g., raw content of ~/.ssh/id_rsa | |
|
||||
| key_path | Path of SSH private key | |
|
||||
| fingerprint | SHA256 fingerprint of the host public key | |
|
||||
| proxy_host | SSH proxy host | |
|
||||
| proxy_port | SSH proxy port | 22 |
|
||||
| proxy_username | SSH proxy username | |
|
||||
| proxy_password | SSH proxy password | |
|
||||
| proxy_passphrase | SSH proxy key passphrase | |
|
||||
| proxy_timeout | Timeout for SSH to proxy host | 30s |
|
||||
| proxy_key | Content of SSH proxy private key | |
|
||||
| proxy_key_path | Path of SSH proxy private key | |
|
||||
| proxy_fingerprint | SHA256 fingerprint of the proxy host public key | |
|
||||
| proxy_cipher | Allowed cipher algorithms for the proxy | |
|
||||
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false |
|
||||
| script | Execute commands | |
|
||||
| script_stop | Stop script after first failure | false |
|
||||
| envs | Pass environment variables to shell script | |
|
||||
| envs_format | Flexible configuration of environment value transfer | |
|
||||
| debug | Enable debug mode | false |
|
||||
| allenvs | pass the environment variables with prefix value of `GITHUB_` and `INPUT_` to the script | false |
|
||||
| request_pty | Request a pseudo-terminal from the server | false |
|
||||
| Input Parameter | Description | Default Value |
|
||||
|-------------------------|-----------------------------------------------------------------|---------------|
|
||||
| host | SSH host address | |
|
||||
| port | SSH port number | 22 |
|
||||
| passphrase | SSH key passphrase | |
|
||||
| username | SSH username | |
|
||||
| password | SSH password | |
|
||||
| sync | Enable synchronous execution if multiple hosts | false |
|
||||
| use_insecure_cipher | Include more ciphers with use_insecure_cipher | false |
|
||||
| cipher | Allowed cipher algorithms. If unspecified, a sensible default | |
|
||||
| timeout | Timeout duration for SSH to host | 30s |
|
||||
| command_timeout | Timeout duration for SSH command | 10m |
|
||||
| key | Content of SSH private key. e.g., raw content of ~/.ssh/id_rsa | |
|
||||
| key_path | Path of SSH private key | |
|
||||
| fingerprint | SHA256 fingerprint of the host public key | |
|
||||
| proxy_host | SSH proxy host | |
|
||||
| proxy_port | SSH proxy port | 22 |
|
||||
| proxy_username | SSH proxy username | |
|
||||
| proxy_password | SSH proxy password | |
|
||||
| proxy_passphrase | SSH proxy key passphrase | |
|
||||
| proxy_timeout | Timeout for SSH to proxy host | 30s |
|
||||
| proxy_key | Content of SSH proxy private key | |
|
||||
| proxy_key_path | Path of SSH proxy private key | |
|
||||
| proxy_fingerprint | SHA256 fingerprint of the proxy host public key | |
|
||||
| proxy_cipher | Allowed cipher algorithms for the proxy | |
|
||||
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false |
|
||||
| script | Execute commands | |
|
||||
| script_stop | Stop script after first failure | false |
|
||||
| envs | Pass environment variables to shell script | |
|
||||
| envs_format | Flexible configuration of environment value transfer | |
|
||||
| debug | Enable debug mode | false |
|
||||
| allenvs | pass the environment variables with prefix value of GITHUB_ and INPUT_ to the script | false |
|
||||
| request_pty | Request a pseudo-terminal from the server | false |
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ set -o pipefail
|
||||
|
||||
export GITHUB="true"
|
||||
|
||||
GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"
|
||||
DRONE_SSH_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}"
|
||||
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.7.4}"
|
||||
|
||||
@ -37,6 +36,8 @@ function detect_client_info() {
|
||||
if [ -n "${SSH_CLIENT_ARCH-}" ]; then
|
||||
CLIENT_ARCH="${SSH_CLIENT_ARCH}"
|
||||
else
|
||||
# TODO: migrate the kube::util::host_platform function out of hack/lib and
|
||||
# use it here.
|
||||
local machine
|
||||
machine="$(uname -m)"
|
||||
case "${machine}" in
|
||||
@ -59,8 +60,7 @@ function detect_client_info() {
|
||||
detect_client_info
|
||||
DOWNLOAD_URL_PREFIX="${DRONE_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}"
|
||||
CLIENT_BINARY="drone-ssh-${DRONE_SSH_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}"
|
||||
TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
|
||||
echo "Will download ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
|
||||
curl -fL --retry 3 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o ${TARGET}
|
||||
chmod +x ${TARGET}
|
||||
sh -c "${TARGET} $*"
|
||||
curl -fL --retry 3 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o ${GITHUB_ACTION_PATH}/drone-ssh
|
||||
chmod +x ${GITHUB_ACTION_PATH}drone-ssh
|
||||
sh -c "${GITHUB_ACTION_PATH}/drone-ssh $*"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user