Add `exec` option (for composer)
continuous-integration/drone Build is passing Details

This commit is contained in:
3wc 2021-12-10 22:22:35 +02:00
parent 9f703e415c
commit 4df177e25c
2 changed files with 8 additions and 2 deletions

View File

@ -18,10 +18,11 @@
- **host** (default: `swarm.autonomic.zone`): Host to deploy to (don't include `ssh://`)
- **port** (default: `222`): SSH port to connect to
- **user** (default: `drone`): System user to connect via SSH with
- **exec** (default: none): Run a command in the container after copying
### Makes me sad they exist
- **chdir** (default: none): Add `-C` option to `tar`
- **chdir** (default: none): Add `-C` option to `tar`; i.e. change to a directory first
## Example

View File

@ -31,6 +31,7 @@ output_versions(){
run_docker_cp() {
echo "--- start deploy ---"
CONTAINER=$(docker -H "$REMOTE_DOCKER_HOST" container ls \
--format "table {{.ID}},{{.Names}}" \
| grep "${PLUGIN_SERVICE}" | cut -d',' -f1)
@ -48,9 +49,13 @@ run_docker_cp() {
echo "Copying $PLUGIN_SOURCE"
# shellcheck disable=SC2086
tar cf - $CD $PLUGIN_SOURCE | docker -H "$REMOTE_DOCKER_HOST" cp - $CONTAINER:$PLUGIN_DEST
if [ -n "$PLUGIN_EXEC" ]; then
docker -H "$REMOTE_DOCKER_HOST" exec "$CONTAINER" sh -c "$PLUGIN_EXEC"
fi
echo "--- end deploy ---"
}
run_plugin() {
echo "--- start docker-cp-deploy ---"
load_deploy_key