fix(sudo): support request_pty to execute sudo command (#288)

- Add a new job called `testing05` to the CI workflow
- Update the base image in the Dockerfile from `1.7.2` to `1.7.3`
- Update the action name, description, and author in the action.yml file
- Update the descriptions for various inputs in the action.yml file
- Add a new input `request_pty` with a description in the action.yml file
- Update the `using` and `image` fields in the action.yml file
- Update the `using` and `image` fields in the runs section of the action.yml file
- Update the `icon` and `color` fields in the branding section of the action.yml file

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2024-01-07 19:39:23 +08:00 committed by GitHub
parent 2451745138
commit d134a26a1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 38 deletions

View file

@ -261,3 +261,24 @@ jobs:
script_stop: true script_stop: true
script: | script: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
testing05:
name: switch user
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1
- name: switch to root user
uses: ./
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script_stop: true
request_pty: true
command_timeout: 30s
script: |
whoami && echo 'hello world' && touch todo.txt
sudo whoami

View file

@ -1,4 +1,4 @@
FROM ghcr.io/appleboy/drone-ssh:1.7.2 FROM ghcr.io/appleboy/drone-ssh:1.7.3
COPY entrypoint.sh /bin/entrypoint.sh COPY entrypoint.sh /bin/entrypoint.sh

View file

@ -1,76 +1,78 @@
name: 'SSH Remote Commands' name: "SSH Remote Commands"
description: 'Executing remote ssh commands' description: "Executing remote ssh commands"
author: 'Bo-Yi Wu' author: "Bo-Yi Wu"
inputs: inputs:
host: host:
description: 'SSH host address.' description: "SSH host address."
port: port:
description: 'SSH port number.' description: "SSH port number."
default: "22" default: "22"
passphrase: passphrase:
description: 'Passphrase for the SSH key.' description: "Passphrase for the SSH key."
username: username:
description: 'SSH username.' description: "SSH username."
password: password:
description: 'SSH password.' description: "SSH password."
sync: sync:
description: 'Enable synchronous execution if multiple hosts are involved.' description: "Enable synchronous execution if multiple hosts are involved."
use_insecure_cipher: use_insecure_cipher:
description: 'Include more ciphers by using insecure ciphers.' description: "Include more ciphers by using insecure ciphers."
cipher: cipher:
description: 'Allowed cipher algorithms. If unspecified, a sensible default is used.' description: "Allowed cipher algorithms. If unspecified, a sensible default is used."
timeout: timeout:
description: 'Timeout duration for establishing SSH connection to the host.' description: "Timeout duration for establishing SSH connection to the host."
default: "30s" default: "30s"
command_timeout: command_timeout:
description: 'Timeout duration for SSH commands execution.' description: "Timeout duration for SSH commands execution."
default: "10m" default: "10m"
key: key:
description: 'Content of the SSH private key. For example, the raw content of ~/.ssh/id_rsa.' description: "Content of the SSH private key. For example, the raw content of ~/.ssh/id_rsa."
key_path: key_path:
description: 'Path to the SSH private key file.' description: "Path to the SSH private key file."
fingerprint: fingerprint:
description: 'SHA256 fingerprint of the host public key.' description: "SHA256 fingerprint of the host public key."
proxy_host: proxy_host:
description: 'SSH proxy host address.' description: "SSH proxy host address."
proxy_port: proxy_port:
description: 'SSH proxy port number.' description: "SSH proxy port number."
default: "22" default: "22"
proxy_username: proxy_username:
description: 'SSH proxy username.' description: "SSH proxy username."
proxy_password: proxy_password:
description: 'SSH proxy password.' description: "SSH proxy password."
proxy_passphrase: proxy_passphrase:
description: 'SSH proxy key passphrase.' description: "SSH proxy key passphrase."
proxy_timeout: proxy_timeout:
description: 'Timeout duration for establishing SSH connection to the proxy host.' description: "Timeout duration for establishing SSH connection to the proxy host."
default: "30s" default: "30s"
proxy_key: proxy_key:
description: 'Content of the SSH proxy private key. For example, the raw content of ~/.ssh/id_rsa.' description: "Content of the SSH proxy private key. For example, the raw content of ~/.ssh/id_rsa."
proxy_key_path: proxy_key_path:
description: 'Path to the SSH proxy private key file.' description: "Path to the SSH proxy private key file."
proxy_fingerprint: proxy_fingerprint:
description: 'SHA256 fingerprint of the proxy host public key.' description: "SHA256 fingerprint of the proxy host public key."
proxy_cipher: proxy_cipher:
description: 'Allowed cipher algorithms for the proxy. If unspecified, a sensible default is used.' description: "Allowed cipher algorithms for the proxy. If unspecified, a sensible default is used."
proxy_use_insecure_cipher: proxy_use_insecure_cipher:
description: 'Include more ciphers for the proxy by using insecure ciphers.' description: "Include more ciphers for the proxy by using insecure ciphers."
script: script:
description: 'Commands to be executed.' description: "Commands to be executed."
script_stop: script_stop:
description: 'Stop the script after the first failure.' description: "Stop the script after the first failure."
envs: envs:
description: 'Environment variables to be passed to the shell script.' description: "Environment variables to be passed to the shell script."
envs_format: envs_format:
description: 'Flexible configuration for environment value transfer.' description: "Flexible configuration for environment value transfer."
debug: debug:
description: 'Enable debug mode.' description: "Enable debug mode."
allenvs: allenvs:
description: 'pass all environment variable to shell script.' description: "pass all environment variable to shell script."
request_pty:
description: "Request a pseudo-terminal from the server."
runs: runs:
using: 'docker' using: "docker"
image: 'Dockerfile' image: "Dockerfile"
branding: branding:
icon: 'terminal' icon: "terminal"
color: 'gray-dark' color: "gray-dark"