attempt to support private registries

This commit is contained in:
decentral1se 2022-01-04 14:49:01 +01:00
parent 3fb617a797
commit 3fde5ef21a
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 10 additions and 1 deletions

View File

@ -21,6 +21,8 @@ This is meant to be used as a [Drone plugin](http://plugins.drone.io/).
- **user** (default: `drone`): System user to connect via SSH with
- **networks** (default:): Try and auto-create these networks first
- **rm**: (default: `false`): Remove the stack before deploying it
- **reg_user**: Registry user if publishing from a private repository
- **reg_pass**: Registry password if publishing from a private repository
### Dangerous options, unwise outside CI

View File

@ -63,7 +63,14 @@ output_versions(){
run_stack_deploy() {
echo "--- start deploy ---"
docker -H "$REMOTE_DOCKER_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
if [[ -z "${PLUGIN_REG_USER}" ]] && [[ -z "${PLUGIN_REG_PASS}" ]]; then
echo "--- discovered secrets, assuming private registry, logging in ---"
docker login -u "${PLUGIN_REG_USER}" -p "${PLUGIN_REG_PASS}"
docker -H "$REMOTE_DOCKER_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
else
docker -H "$REMOTE_DOCKER_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"
fi
echo "--- end deploy ---"
}