Drone plugin to execute commands on a remote host through SSH.
- name: ssh commands
image: ryjer/drone-ssh
settings:
host:
- example.com
- 10.0.0.1
port: 22
username: root
password: 12345678
timeout: 3m
script:
- echo "hello world"
- ls
**注意:**建议使用 from_secret: 保护机密信息,具体用法参考 drone 文档
保护 username 和 password 的from_secret示例如下
- name: ssh commands
image: ryjer/drone-ssh
settings:
host: example.com
port: 22
username:
from_secret: ssh_username
password:
from_secret: ssh_password
timeout: 3m
script:
- echo "hello world"
- ls
远程主机名,支持 域名和ip两种格式。支持多主机,但这些主机的端口、用户名和密码必须相同
ssh 登录端口,通常为 22
ssh 的登陆用户名
ssh 登录用户名
超时限制,限制最长执行时间。示例如下
| 时间格式 | Time format | timeout argument timeout命令参数 |
|---|---|---|
| 3秒 | 3 seconds | 3 |
| 3秒 | 3 seconds | 3s |
| 5分钟 | 5 minutes | 5m |
| 4小时 | 4 hours | 4h |
| 6天 | 6 days | 6d |
在远程主机执行的命令列表
docker run -it --rm \
-v $PWD:/root \
-e PLUGIN_HOST=example.com,10.0.0.1 \
-e PLUGIN_PORT=22 \
-e PLUGIN_USERNAME=root \
-e PLUGIN_PASSWORD=12345678 \
-e PLUGIN_TIMEOUT=3m \
-e PLUGIN_SCRIPT=echo hello world,ls \
ryjer/drone-ssh
Content type
Image
Digest
Size
4.5 MB
Last updated
over 5 years ago
docker pull ryjer/drone-ssh