Add chdir option
continuous-integration/drone/push Build is passing Details

This commit is contained in:
3wc 2020-11-15 00:52:31 +02:00
parent 4520054599
commit 4fb6bf7b20
2 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -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 ---"
}