Skip to content

Commit 12a5243

Browse files
committed
feat: support private key
1 parent b2e4f05 commit 12a5243

File tree

2 files changed

+83
-11
lines changed

2 files changed

+83
-11
lines changed

.github/main.workflow

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
workflow "Copy File Via SSH" {
1+
workflow "Remote ssh commands" {
22
on = "push"
33
resolves = [
44
"Executing remote ssh commands",
5+
"Support Private Key",
56
]
67
}
78

@@ -16,3 +17,15 @@ action "Executing remote ssh commands" {
1617
"--script", "whoami",
1718
]
1819
}
20+
21+
action "Support Private Key" {
22+
uses = "appleboy/ssh-action@master"
23+
secrets = [
24+
"HOST",
25+
"KEY",
26+
]
27+
args = [
28+
"--user", "actions",
29+
"--script", "ls -al",
30+
]
31+
}

README.md

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,16 @@
99
Executing remote ssh commands.
1010

1111
```
12-
action "Copy multiple file" {
13-
uses = "appleboy/scp-action@master"
14-
env = {
15-
HOST = "example.com"
16-
USERNAME = "foo"
17-
PASSWORD = "bar"
18-
PORT = "22"
19-
SOURCE = "tests/a.txt,tests/b.txt"
20-
TARGET = "/home/foo/test"
21-
}
12+
action "Executing remote ssh commands" {
13+
uses = "appleboy/ssh-action@master"
2214
secrets = [
15+
"HOST",
2316
"PASSWORD",
2417
]
18+
args = [
19+
"--user", "actions",
20+
"--script", "whoami",
21+
]
2522
}
2623
```
2724

@@ -33,3 +30,65 @@ action "Copy multiple file" {
3330
* PASSWORD - ssh server password
3431
* KEY - ssh server private key
3532
* SCRIPT - execute the scripts
33+
34+
### Example
35+
36+
Executing remote ssh commands.
37+
38+
```
39+
action "Executing remote ssh commands" {
40+
uses = "appleboy/ssh-action@master"
41+
secrets = [
42+
"PASSWORD",
43+
]
44+
args = [
45+
"--host", "foo.com"
46+
"--user", "bar",
47+
"--script", "whoami",
48+
]
49+
}
50+
```
51+
52+
Using private key
53+
54+
```
55+
action "Support Private Key" {
56+
uses = "appleboy/ssh-action@master"
57+
secrets = [
58+
"HOST",
59+
"KEY",
60+
]
61+
args = [
62+
"--user", "actions",
63+
"--script", "ls -al",
64+
]
65+
}
66+
```
67+
68+
see the detail of `drone-ssh` command
69+
70+
```
71+
--ssh-key value private ssh key [$PLUGIN_SSH_KEY, $PLUGIN_KEY, $SSH_KEY, $KEY]
72+
--key-path value, -i value ssh private key path [$PLUGIN_KEY_PATH, $SSH_KEY_PATH, $PATH]
73+
--username value, --user value, -u value connect as user (default: "root") [$PLUGIN_USERNAME, $PLUGIN_USER, $SSH_USERNAME, $USERNAME]
74+
--password value, -P value user password [$PLUGIN_PASSWORD, $SSH_PASSWORD, $PASSWORD]
75+
--host value, -H value connect to host [$PLUGIN_HOST, $SSH_HOST, $HOST]
76+
--port value, -p value connect to port (default: 22) [$PLUGIN_PORT, $SSH_PORT, $PORT]
77+
--sync sync mode [$PLUGIN_SYNC, $SYNC]
78+
--timeout value, -t value connection timeout (default: 0s) [$PLUGIN_TIMEOUT, $SSH_TIMEOUT, $TIMEOUT]
79+
--command.timeout value, -T value command timeout (default: 1m0s) [$PLUGIN_COMMAND_TIMEOUT, $SSH_COMMAND_TIMEOUT, $COMMAND_TIMEOUT]
80+
--script value, -s value execute commands [$PLUGIN_SCRIPT, $SSH_SCRIPT, $SCRIPT]
81+
--script.stop stop script after first failure [$PLUGIN_SCRIPT_STOP, $STOP]
82+
--proxy.ssh-key value private ssh key of proxy [$PLUGIN_PROXY_SSH_KEY, $PLUGIN_PROXY_KEY, $PROXY_SSH_KEY]
83+
--proxy.key-path value ssh private key path of proxy [$PLUGIN_PROXY_KEY_PATH, $PROXY_SSH_KEY_PATH]
84+
--proxy.username value connect as user of proxy (default: "root") [$PLUGIN_PROXY_USERNAME, $PLUGIN_PROXY_USER, $PROXY_SSH_USERNAME]
85+
--proxy.password value user password of proxy [$PLUGIN_PROXY_PASSWORD, $PROXY_SSH_PASSWORD]
86+
--proxy.host value connect to host of proxy [$PLUGIN_PROXY_HOST, $PROXY_SSH_HOST]
87+
--proxy.port value connect to port of proxy (default: "22") [$PLUGIN_PROXY_PORT, $PROXY_SSH_PORT]
88+
--proxy.timeout value proxy connection timeout (default: 0s) [$PLUGIN_PROXY_TIMEOUT, $PROXY_SSH_TIMEOUT]
89+
```
90+
91+
## Secrets
92+
93+
* `PASSWORD` - ssh server password
94+
* `KEY` - ssh server private key

0 commit comments

Comments
 (0)