add support of CI_REPO_NAME
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Dmitriy Pleshevskiy 2023-03-15 12:32:36 +03:00
parent d9c19b42fd
commit 4c632b99f8
Signed by: pleshevskiy
GPG Key ID: 79C4487B44403985
2 changed files with 21 additions and 15 deletions

View File

@ -6,10 +6,10 @@ Simple bash plugin to login and stack deploy
## Options
| property | type | default | description |
| ----------------- | ------ | ------------------ | ----------------------------------------- |
| name | string | $DRONE_REPO_NAME | Stack name |
| compose_file_path | string | docker-compose.yml | Path to your docker compose configuration |
| registry | string | $ORG_REGISTRY | Authenticates to this registry |
| username | string | | Authenticates with this username |
| password | string | | Authenticates with this password |
| property | type | default | description |
| ----------------- | ------ | -------------------------------- | ----------------------------------------- |
| name | string | $DRONE_REPO_NAME / $CI_REPO_NAME | Stack name |
| compose_file_path | string | docker-compose.yml | Path to your docker compose configuration |
| registry | string | $ORG_REGISTRY | Authenticates to this registry |
| username | string | | Authenticates with this username |
| password | string | | Authenticates with this password |

View File

@ -1,9 +1,15 @@
#!/bin/sh
set -ex
set -e
if [ -n "${PLUGIN_REGISTRY:-$ORG_REGISTRY}" ]; then
AUTH_FLAGS=--with-registry-auth
registry="${PLUGIN_REGISTRY:-$ORG_REGISTRY}"
stack_name="${PLUGIN_NAME:-${DRONE_REPO_NAME:-${CI_REPO_NAME}}}"
compose_file="${PLUGIN_COMPOSE_FILE_PATH:-docker-compose.yml}"
set -x
if [ -n "${registry}" ]; then
auth_flags=--with-registry-auth
fi
if [ -n "$PLUGIN_PASSWORD" ]; then
@ -11,11 +17,11 @@ if [ -n "$PLUGIN_PASSWORD" ]; then
docker login \
-u "$PLUGIN_USERNAME" \
--password-stdin \
${PLUGIN_REGISTRY:-$ORG_REGISTRY}
${registry}
fi
docker stack deploy \
$AUTH_FLAGS \
-c "${PLUGIN_COMPOSE_FILE_PATH:-docker-compose.yml}" \
"${PLUGIN_NAME:-$DRONE_REPO_NAME}"
docker stack deploy
$auth_flags \
--compose-file "${compose_file}" \
"${stack_name}"