call tag-add and tag-remove pluginhooks

This commit is contained in:
Michael Hobbs committed 2015-09-02 11:19:20 -07:00
1 parent 04a4da7fc5
commit 5be7641f87
2 files changed
+38

No files matched your search

+36
View File
@@ -629,3 +629,39 @@ if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
fi fi
pluginhook receive-app $APP $newrev pluginhook receive-app $APP $newrev
``` ```
### `tag-add`
- Description: Allows you to run commands once a tag for an application image has been added
- Invoked by: `dokku tag:add`
- Arguments: `$APP $TAG`
- Example:
```shell
#!/usr/bin/env bash
# Upload an application image to docker hub
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; TAG="$2"; IMAGE="dokku/${APP}:${TAG}"
IMAGE_ID=$(docker inspect --format '{{ .Id }}' $IMAGE)
docker tag -f $IMAGE_ID $DOCKER_HUB_USER/$APP:$TAG
docker push $DOCKER_HUB_USER/$APP:$TAG
```
### `tag-remove`
- Description: Allows you to run commands once a tag for an application image has been removed
- Invoked by: `dokku tag:remove`
- Arguments: `$APP $TAG`
- Example:
```shell
#!/usr/bin/env bash
# Remove an image tag from docker hub
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; TAG="$2"
some code to remove a docker hub tag because it's not implemented in the CLI....
```
+2
View File
@@ -12,6 +12,7 @@ case "$1" in
tag_image "$IMAGE:latest" "$IMAGE:$TAG" tag_image "$IMAGE:latest" "$IMAGE:$TAG"
dokku_log_info2_quiet "Added $TAG tag to $IMAGE" dokku_log_info2_quiet "Added $TAG tag to $IMAGE"
pluginhook tag-add $APP $TAG
;; ;;
tag:deploy) tag:deploy)
@@ -45,6 +46,7 @@ case "$1" in
docker rmi "$IMAGE:$TAG" docker rmi "$IMAGE:$TAG"
;; ;;
esac esac
pluginhook tag-remove $APP $TAG
;; ;;
help | tag:help) help | tag:help)