Add port and drop ssh:// from user side
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
13b37ce16d
commit
7c11311f02
|
@ -10,7 +10,8 @@ This is meant to be used as a [Drone plugin](http://plugins.drone.io/).
|
|||
|
||||
- **stack**: Name of the stack to be deployed
|
||||
- **compose** (default: `compose.yml`): compose file to use for deploying
|
||||
- **host**: SSH-based docker daemon context to deploy against
|
||||
- **host**: SSH-based docker daemon context to deploy against (don't include `ssh://`)
|
||||
- **port** (default: `22`): SSH port to connect to
|
||||
- **deploy_key**: SSH private key part for ssh public key authentication
|
||||
|
||||
## Example
|
||||
|
@ -24,7 +25,8 @@ steps:
|
|||
image: decentral1se/stack-ssh-deploy:0.0.1
|
||||
settings:
|
||||
stack: mystack
|
||||
host: "ssh://drone@swarm.autonomic.zone:222"
|
||||
host: "drone@swarm.autonomic.zone"
|
||||
port: 222
|
||||
deploy_key:
|
||||
from_secret: drone_deploy_key
|
||||
```
|
||||
|
|
10
plugin.sh
10
plugin.sh
|
@ -1,22 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
PLUGIN_PORT=${PLUGIN_PORT:-22}
|
||||
PLUGIN_COMPOSE=${PLUGIN_COMPOSE:-compose.yml}
|
||||
|
||||
load_deploy_key() {
|
||||
mkdir -p "$HOME/.ssh/"
|
||||
ssh-keyscan "$PLUGIN_HOST" > "$HOME/.ssh/known_hosts"
|
||||
ssh-keyscan -p "$PLUGIN_PORT" "$PLUGIN_HOST" > "$HOME/.ssh/known_hosts"
|
||||
|
||||
eval `ssh-agent`
|
||||
echo "$PLUGIN_DEPLOY_KEY" | ssh-add -
|
||||
}
|
||||
|
||||
run_stack_deploy() {
|
||||
PLUGIN_COMPOSE=${PLUGIN_COMPOSE:-compose.yml}
|
||||
|
||||
echo "--- start docker info ---"
|
||||
docker version
|
||||
echo "--- end docker info ---"
|
||||
|
||||
docker -H "$PLUGIN_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
|
||||
docker \
|
||||
-H "ssh://$PLUGIN_HOST:$PLUGIN_PORT" \
|
||||
stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
|
||||
}
|
||||
|
||||
run_plugin() {
|
||||
|
|
Reference in New Issue