From a8b892ebd0a2ebc9790a4ce3bdfba1727dc5fbf7 Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Thu, 12 Jan 2023 14:38:56 +0100 Subject: [PATCH] add docker login repo --- .drone.yml | 8 ++++---- README.md | 3 +-- plugin.sh | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index cfb9889..67352cd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,11 +11,11 @@ steps: - name: docker push image: plugins/docker settings: - username: - from_secret: docker_reg_username_coopcloud + registry: git.local-it.org + repo: git.local-it.org/philipp/stack-ssh-deply + username: philipp password: - from_secret: docker_reg_passwd_coopcloud - repo: thecoopcloud/stack-ssh-deploy + from_secret: docker_registry tags: latest trigger: branch: diff --git a/README.md b/README.md index 8973c9d..3539af4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # stack-ssh-deploy -[![Build Status](https://drone.autonomic.zone/api/badges/coop-cloud/stack-ssh-deploy/status.svg?ref=refs/heads/main)](https://drone.autonomic.zone/coop-cloud/stack-ssh-deploy) - Deploy swarm stacks against a SSH based remote docker daemon context. This is meant to be used as a [Drone plugin](http://plugins.drone.io/). @@ -27,6 +25,7 @@ This is meant to be used as a [Drone plugin](http://plugins.drone.io/). - **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 +- **reg_url**: Registry URL ### Dangerous options, unwise outside CI diff --git a/plugin.sh b/plugin.sh index b0bc5a3..4385f6d 100755 --- a/plugin.sh +++ b/plugin.sh @@ -8,6 +8,7 @@ PLUGIN_PORT=${PLUGIN_PORT:-222} PLUGIN_PURGE=${PLUGIN_PURGE:-"false"} PLUGIN_USER=${PLUGIN_USER:-drone} PLUGIN_RM=${PLUGIN_RM:-"false"} +PLUGIN_REG_URL=${PLUGIN_REG_URL:-""} REMOTE_DOCKER_HOST="ssh://$PLUGIN_USER@$PLUGIN_HOST:$PLUGIN_PORT" @@ -66,7 +67,7 @@ run_stack_deploy() { if [[ ! -z "${PLUGIN_REG_USER}" ]] && [[ ! -z "${PLUGIN_REG_PASS}" ]]; then echo "--- discovered secrets, assuming private registry, logging in ---" - docker -H "$REMOTE_DOCKER_HOST" login -u "${PLUGIN_REG_USER}" -p "${PLUGIN_REG_PASS}" + docker -H "$REMOTE_DOCKER_HOST" login "${PLUGIN_REG_URL}" -u "${PLUGIN_REG_USER}" -p "${PLUGIN_REG_PASS}" docker -H "$REMOTE_DOCKER_HOST" pull "${PLUGIN_IMAGE}" echo "${PLUGIN_IMAGE}" docker -H "$REMOTE_DOCKER_HOST" stack deploy -c "$PLUGIN_COMPOSE" "$PLUGIN_STACK"