add support of CI_REPO_NAME
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
d9c19b42fd
commit
4c632b99f8
2 changed files with 21 additions and 15 deletions
14
README.md
14
README.md
|
@ -6,10 +6,10 @@ Simple bash plugin to login and stack deploy
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
| property | type | default | description |
|
| property | type | default | description |
|
||||||
| ----------------- | ------ | ------------------ | ----------------------------------------- |
|
| ----------------- | ------ | -------------------------------- | ----------------------------------------- |
|
||||||
| name | string | $DRONE_REPO_NAME | Stack name |
|
| name | string | $DRONE_REPO_NAME / $CI_REPO_NAME | Stack name |
|
||||||
| compose_file_path | string | docker-compose.yml | Path to your docker compose configuration |
|
| compose_file_path | string | docker-compose.yml | Path to your docker compose configuration |
|
||||||
| registry | string | $ORG_REGISTRY | Authenticates to this registry |
|
| registry | string | $ORG_REGISTRY | Authenticates to this registry |
|
||||||
| username | string | | Authenticates with this username |
|
| username | string | | Authenticates with this username |
|
||||||
| password | string | | Authenticates with this password |
|
| password | string | | Authenticates with this password |
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -ex
|
set -e
|
||||||
|
|
||||||
if [ -n "${PLUGIN_REGISTRY:-$ORG_REGISTRY}" ]; then
|
registry="${PLUGIN_REGISTRY:-$ORG_REGISTRY}"
|
||||||
AUTH_FLAGS=--with-registry-auth
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "$PLUGIN_PASSWORD" ]; then
|
if [ -n "$PLUGIN_PASSWORD" ]; then
|
||||||
|
@ -11,11 +17,11 @@ if [ -n "$PLUGIN_PASSWORD" ]; then
|
||||||
docker login \
|
docker login \
|
||||||
-u "$PLUGIN_USERNAME" \
|
-u "$PLUGIN_USERNAME" \
|
||||||
--password-stdin \
|
--password-stdin \
|
||||||
${PLUGIN_REGISTRY:-$ORG_REGISTRY}
|
${registry}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker stack deploy \
|
docker stack deploy
|
||||||
$AUTH_FLAGS \
|
$auth_flags \
|
||||||
-c "${PLUGIN_COMPOSE_FILE_PATH:-docker-compose.yml}" \
|
--compose-file "${compose_file}" \
|
||||||
"${PLUGIN_NAME:-$DRONE_REPO_NAME}"
|
"${stack_name}"
|
||||||
|
|
||||||
|
|
Reference in a new issue