Compare commits

...

3 Commits

Author SHA1 Message Date
Bo-Yi Wu
dd0f09ca07
docs: improve README clarity and completeness
- Update the README table formatting to include an additional column separator
- Add documentation for the SSH protocol version option in the README table

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-03-16 16:04:59 +08:00
appleboy
1991c553ec
chore(file): update target file
Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-03-16 15:59:42 +08:00
Bo-Yi Wu
fe44be0b96
docs: improve documentation and CI robustness
- Add backticks around `GITHUB_` and `INPUT_` in the README for clarity

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-03-16 15:47:10 +08:00
2 changed files with 39 additions and 38 deletions

View File

@ -17,12 +17,13 @@ This thing is built using [Golang](https://go.dev) and [drone-ssh](https://githu
See [action.yml](./action.yml) for more detailed information. See [action.yml](./action.yml) for more detailed information.
| Input Parameter | Description | Default Value | | Input Parameter | Description | Default Value |
|-------------------------|-----------------------------------------------------------------|---------------| |---------------------------|------------------------------------------------------------------------------------------|---------------|
| host | SSH host address | | | host | SSH host address | |
| port | SSH port number | 22 | | port | SSH port number | 22 |
| passphrase | SSH key passphrase | | | passphrase | SSH key passphrase | |
| username | SSH username | | | username | SSH username | |
| password | SSH password | | | password | SSH password | |
| protocol | SSH protocol version (tcp, tcp4, tcp6) | tcp |
| sync | Enable synchronous execution if multiple hosts | false | | sync | Enable synchronous execution if multiple hosts | false |
| use_insecure_cipher | Include more ciphers with use_insecure_cipher | false | | use_insecure_cipher | Include more ciphers with use_insecure_cipher | false |
| cipher | Allowed cipher algorithms. If unspecified, a sensible default | | | cipher | Allowed cipher algorithms. If unspecified, a sensible default | |
@ -47,7 +48,7 @@ See [action.yml](./action.yml) for more detailed information.
| envs | Pass environment variables to shell script | | | envs | Pass environment variables to shell script | |
| envs_format | Flexible configuration of environment value transfer | | | envs_format | Flexible configuration of environment value transfer | |
| debug | Enable debug mode | false | | debug | Enable debug mode | false |
| allenvs | pass the environment variables with prefix value of GITHUB_ and INPUT_ to the script | 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 | | request_pty | Request a pseudo-terminal from the server | false |
## Usage ## Usage

View File

@ -6,6 +6,7 @@ set -o pipefail
export GITHUB="true" 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_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}"
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.7.4}" DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.7.4}"
@ -36,8 +37,6 @@ function detect_client_info() {
if [ -n "${SSH_CLIENT_ARCH-}" ]; then if [ -n "${SSH_CLIENT_ARCH-}" ]; then
CLIENT_ARCH="${SSH_CLIENT_ARCH}" CLIENT_ARCH="${SSH_CLIENT_ARCH}"
else else
# TODO: migrate the kube::util::host_platform function out of hack/lib and
# use it here.
local machine local machine
machine="$(uname -m)" machine="$(uname -m)"
case "${machine}" in case "${machine}" in
@ -60,7 +59,8 @@ function detect_client_info() {
detect_client_info detect_client_info
DOWNLOAD_URL_PREFIX="${DRONE_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}" DOWNLOAD_URL_PREFIX="${DRONE_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}"
CLIENT_BINARY="drone-ssh-${DRONE_SSH_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}" 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}" echo "Will download ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
curl -fL --retry 3 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o ${GITHUB_ACTION_PATH}/drone-ssh curl -fL --retry 3 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o ${TARGET}
chmod +x ${GITHUB_ACTION_PATH}drone-ssh chmod +x ${TARGET}
sh -c "${GITHUB_ACTION_PATH}/drone-ssh $*" sh -c "${TARGET} $*"