Skip to content

Commit d134a26

Browse files
authored
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 <[email protected]>
1 parent 2451745 commit d134a26

File tree

3 files changed

+61
-38
lines changed

3 files changed

+61
-38
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,24 @@ jobs:
261261
script_stop: true
262262
script: |
263263
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
264+
265+
testing05:
266+
name: switch user
267+
runs-on: ubuntu-latest
268+
steps:
269+
- name: checkout
270+
uses: actions/checkout@v1
271+
272+
- name: switch to root user
273+
uses: ./
274+
with:
275+
host: ${{ secrets.HOST }}
276+
username: ${{ secrets.USERNAME }}
277+
key: ${{ secrets.KEY }}
278+
port: ${{ secrets.PORT }}
279+
script_stop: true
280+
request_pty: true
281+
command_timeout: 30s
282+
script: |
283+
whoami && echo 'hello world' && touch todo.txt
284+
sudo whoami

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/appleboy/drone-ssh:1.7.2
1+
FROM ghcr.io/appleboy/drone-ssh:1.7.3
22

33
COPY entrypoint.sh /bin/entrypoint.sh
44

action.yml

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
1-
name: 'SSH Remote Commands'
2-
description: 'Executing remote ssh commands'
3-
author: 'Bo-Yi Wu'
1+
name: "SSH Remote Commands"
2+
description: "Executing remote ssh commands"
3+
author: "Bo-Yi Wu"
44
inputs:
55
host:
6-
description: 'SSH host address.'
6+
description: "SSH host address."
77
port:
8-
description: 'SSH port number.'
8+
description: "SSH port number."
99
default: "22"
1010
passphrase:
11-
description: 'Passphrase for the SSH key.'
11+
description: "Passphrase for the SSH key."
1212
username:
13-
description: 'SSH username.'
13+
description: "SSH username."
1414
password:
15-
description: 'SSH password.'
15+
description: "SSH password."
1616
sync:
17-
description: 'Enable synchronous execution if multiple hosts are involved.'
17+
description: "Enable synchronous execution if multiple hosts are involved."
1818
use_insecure_cipher:
19-
description: 'Include more ciphers by using insecure ciphers.'
19+
description: "Include more ciphers by using insecure ciphers."
2020
cipher:
21-
description: 'Allowed cipher algorithms. If unspecified, a sensible default is used.'
21+
description: "Allowed cipher algorithms. If unspecified, a sensible default is used."
2222
timeout:
23-
description: 'Timeout duration for establishing SSH connection to the host.'
23+
description: "Timeout duration for establishing SSH connection to the host."
2424
default: "30s"
2525
command_timeout:
26-
description: 'Timeout duration for SSH commands execution.'
26+
description: "Timeout duration for SSH commands execution."
2727
default: "10m"
2828
key:
29-
description: 'Content of the SSH private key. For example, the raw content of ~/.ssh/id_rsa.'
29+
description: "Content of the SSH private key. For example, the raw content of ~/.ssh/id_rsa."
3030
key_path:
31-
description: 'Path to the SSH private key file.'
31+
description: "Path to the SSH private key file."
3232
fingerprint:
33-
description: 'SHA256 fingerprint of the host public key.'
33+
description: "SHA256 fingerprint of the host public key."
3434
proxy_host:
35-
description: 'SSH proxy host address.'
35+
description: "SSH proxy host address."
3636
proxy_port:
37-
description: 'SSH proxy port number.'
37+
description: "SSH proxy port number."
3838
default: "22"
3939
proxy_username:
40-
description: 'SSH proxy username.'
40+
description: "SSH proxy username."
4141
proxy_password:
42-
description: 'SSH proxy password.'
42+
description: "SSH proxy password."
4343
proxy_passphrase:
44-
description: 'SSH proxy key passphrase.'
44+
description: "SSH proxy key passphrase."
4545
proxy_timeout:
46-
description: 'Timeout duration for establishing SSH connection to the proxy host.'
46+
description: "Timeout duration for establishing SSH connection to the proxy host."
4747
default: "30s"
4848
proxy_key:
49-
description: 'Content of the SSH proxy private key. For example, the raw content of ~/.ssh/id_rsa.'
49+
description: "Content of the SSH proxy private key. For example, the raw content of ~/.ssh/id_rsa."
5050
proxy_key_path:
51-
description: 'Path to the SSH proxy private key file.'
51+
description: "Path to the SSH proxy private key file."
5252
proxy_fingerprint:
53-
description: 'SHA256 fingerprint of the proxy host public key.'
53+
description: "SHA256 fingerprint of the proxy host public key."
5454
proxy_cipher:
55-
description: 'Allowed cipher algorithms for the proxy. If unspecified, a sensible default is used.'
55+
description: "Allowed cipher algorithms for the proxy. If unspecified, a sensible default is used."
5656
proxy_use_insecure_cipher:
57-
description: 'Include more ciphers for the proxy by using insecure ciphers.'
57+
description: "Include more ciphers for the proxy by using insecure ciphers."
5858
script:
59-
description: 'Commands to be executed.'
59+
description: "Commands to be executed."
6060
script_stop:
61-
description: 'Stop the script after the first failure.'
61+
description: "Stop the script after the first failure."
6262
envs:
63-
description: 'Environment variables to be passed to the shell script.'
63+
description: "Environment variables to be passed to the shell script."
6464
envs_format:
65-
description: 'Flexible configuration for environment value transfer.'
65+
description: "Flexible configuration for environment value transfer."
6666
debug:
67-
description: 'Enable debug mode.'
67+
description: "Enable debug mode."
6868
allenvs:
69-
description: 'pass all environment variable to shell script.'
69+
description: "pass all environment variable to shell script."
70+
request_pty:
71+
description: "Request a pseudo-terminal from the server."
7072
runs:
71-
using: 'docker'
72-
image: 'Dockerfile'
73+
using: "docker"
74+
image: "Dockerfile"
7375

7476
branding:
75-
icon: 'terminal'
76-
color: 'gray-dark'
77+
icon: "terminal"
78+
color: "gray-dark"

0 commit comments

Comments
 (0)