Add chdir option
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
4520054599
commit
4fb6bf7b20
|
@ -19,6 +19,10 @@
|
|||
- **port** (default: `222`): SSH port to connect to
|
||||
- **user** (default: `drone`): System user to connect via SSH with
|
||||
|
||||
### Makes me sad they exist
|
||||
|
||||
- **chdir** (default: none): Add `-C` option to `tar`
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
|
|
11
plugin.sh
11
plugin.sh
|
@ -34,15 +34,20 @@ run_docker_cp() {
|
|||
CONTAINER=$(docker -H "$REMOTE_DOCKER_HOST" container ls \
|
||||
--format "table {{.ID}},{{.Names}}" \
|
||||
| grep "${PLUGIN_SERVICE}" | cut -d',' -f1)
|
||||
|
||||
if [ -z "$CONTAINER" ]; then
|
||||
echo "ERROR: can't find container for $PLUGIN_SERVICE"
|
||||
return 1
|
||||
fi
|
||||
|
||||
CD=""
|
||||
if [ -n "$PLUGIN_CHDIR" ]; then
|
||||
CD="-C $PLUGIN_CHDIR"
|
||||
fi
|
||||
|
||||
echo "Copying $PLUGIN_SOURCE"
|
||||
# shellcheck disable=SC2086
|
||||
tar cf - $PLUGIN_SOURCE | tar t
|
||||
# shellcheck disable=SC2086
|
||||
tar cf - $PLUGIN_SOURCE | docker -H "$REMOTE_DOCKER_HOST" cp - $CONTAINER:$PLUGIN_DEST
|
||||
tar cf - $CD $PLUGIN_SOURCE | docker -H "$REMOTE_DOCKER_HOST" cp - $CONTAINER:$PLUGIN_DEST
|
||||
echo "--- end deploy ---"
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue