rename tag to tags. make verbs more consistent

This commit is contained in:
Michael Hobbs committed 2015-09-03 18:26:02 -07:00
1 parent ccb9e4a571
commit 5f7c4426b7
5 files changed
+47 -47

No files matched your search

+4 -4
View File
@@ -629,10 +629,10 @@ fi
pluginhook receive-app $APP $newrev pluginhook receive-app $APP $newrev
``` ```
### `tag-add` ### `tags-create`
- Description: Allows you to run commands once a tag for an application image has been added - Description: Allows you to run commands once a tag for an application image has been added
- Invoked by: `dokku tag:add` - Invoked by: `dokku tags:create`
- Arguments: `$APP $IMAGE_TAG` - Arguments: `$APP $IMAGE_TAG`
- Example: - Example:
@@ -648,10 +648,10 @@ docker tag -f $IMAGE_ID $DOCKER_HUB_USER/$APP:$IMAGE_TAG
docker push $DOCKER_HUB_USER/$APP:$IMAGE_TAG docker push $DOCKER_HUB_USER/$APP:$IMAGE_TAG
``` ```
### `tag-remove` ### `tags-destroy`
- Description: Allows you to run commands once a tag for an application image has been removed - Description: Allows you to run commands once a tag for an application image has been removed
- Invoked by: `dokku tag:remove` - Invoked by: `dokku tags:destroy`
- Arguments: `$APP $IMAGE_TAG` - Arguments: `$APP $IMAGE_TAG`
- Example: - Example:
+10 -9
View File
@@ -45,31 +45,32 @@ Like Heroku, we handle the `web` proctype differently from others. The `web` pro
## Image tagging ## Image tagging
The dokku tag plugin allows you to add docker image tags to the currently deployed app image for versioning and subsequent deployment. The dokku tags plugin allows you to add docker image tags to the currently deployed app image for versioning and subsequent deployment.
``` ```
tag:add <app> <tag> Add tag to latest running app image tags <app> List all app image tags
tag:deploy <app> <tag> Deploy tagged app image tags:create <app> <tag> Add tag to latest running app image
tag:list <app> List all app image tags tags:deploy <app> <tag> Deploy tagged app image
tag:rm <app> <tag> Remove app image tag tags:destroy <app> <tag> Remove app image tag
``` ```
Example: Example:
``` ```
root@dokku:~# dokku tag:list node-js-app root@dokku:~# dokku tags node-js-app
=====> Image tags for dokku/node-js-app =====> Image tags for dokku/node-js-app
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
root@dokku:~# dokku tag:add node-js-app v0.9.0 root@dokku:~# dokku tags:create node-js-app v0.9.0
=====> Added v0.9.0 tag to dokku/node-js-app =====> Added v0.9.0 tag to dokku/node-js-app
root@dokku:~# dokku tag:list node-js-app
root@dokku:~# dokku tags node-js-app
=====> Image tags for dokku/node-js-app =====> Image tags for dokku/node-js-app
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
dokku/node-js-app v0.9.0 936a42f25901 About a minute ago 1.025 GB dokku/node-js-app v0.9.0 936a42f25901 About a minute ago 1.025 GB
root@dokku:~# dokku tag:deploy node-js-app v0.9.0 root@dokku:~# dokku tags:deploy node-js-app v0.9.0
-----> Releasing node-js-app (dokku/node-js-app:v0.9.0)... -----> Releasing node-js-app (dokku/node-js-app:v0.9.0)...
-----> Deploying node-js-app (dokku/node-js-app:v0.9.0)... -----> Deploying node-js-app (dokku/node-js-app:v0.9.0)...
-----> Running pre-flight checks -----> Running pre-flight checks
+25 -25
View File
@@ -4,17 +4,26 @@ source "$PLUGIN_PATH/common/functions"
source "$(dirname $0)/functions" source "$(dirname $0)/functions"
case "$1" in case "$1" in
tag:add) tags)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
APP="$2"; IMAGE_REPO=$(get_app_image_repo $APP)
verify_app_name "$APP"
dokku_log_info2_quiet "Image tags for $IMAGE_REPO"
docker images "$IMAGE_REPO"
;;
tags:create)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
APP="$2"; IMAGE_TAG="$3"; IMAGE_REPO=$(get_app_image_repo $APP) APP="$2"; IMAGE_TAG="$3"; IMAGE_REPO=$(get_app_image_repo $APP)
verify_app_name "$APP" verify_app_name "$APP"
tag_image "$IMAGE_REPO:latest" "$IMAGE_REPO:$IMAGE_TAG" tag_image "$IMAGE_REPO:latest" "$IMAGE_REPO:$IMAGE_TAG"
dokku_log_info2_quiet "Added $IMAGE_TAG tag to $IMAGE_REPO" dokku_log_info2_quiet "Added $IMAGE_TAG tag to $IMAGE_REPO"
pluginhook tag-add $APP $IMAGE_TAG pluginhook tags-create $APP $IMAGE_TAG
;; ;;
tag:deploy) tags:deploy)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
APP="$2"; IMAGE_TAG="$3" APP="$2"; IMAGE_TAG="$3"
verify_app_name "$APP" verify_app_name "$APP"
@@ -22,38 +31,29 @@ case "$1" in
release_and_deploy $APP $IMAGE_TAG release_and_deploy $APP $IMAGE_TAG
;; ;;
tag:list) tags:destroy)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
APP="$2"; IMAGE_REPO=$(get_app_image_repo $APP)
verify_app_name "$APP"
dokku_log_info2_quiet "Image tags for IMAGE_REPO"
docker images "IMAGE_REPO"
;;
tag:rm)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
APP="$2"; IMAGE_TAG="$3"; IMAGE_REPO=$(get_app_image_repo $APP) APP="$2"; IMAGE_TAG="$3"; IMAGE_REPO=$(get_app_image_repo $APP)
verify_app_name "$2" verify_app_name "$2"
case "$IMAGE_TAG" in case "$IMAGE_TAG" in
latest) latest)
dokku_log_fail "You can't remove internal dokku tag ($IMAGE_TAG) for $IMAGE_REPO" dokku_log_fail "You can't remove internal dokku tag ($IMAGE_TAG) for $IMAGE_REPO"
;; ;;
*) *)
docker rmi "$IMAGE_REPO:$IMAGE_TAG" docker rmi "$IMAGE_REPO:$IMAGE_TAG"
;; ;;
esac esac
pluginhook tag-remove $APP $IMAGE_TAG pluginhook tags-destroy $APP $IMAGE_TAG
;; ;;
help | tag:help) help | tags:help)
cat && cat<<EOF cat && cat<<EOF
tag:add <app> <tag>, Add tag to latest running app image tags <app>, List all app image tags
tag:deploy <app> <tag>, Deploy tagged app image tags:create <app> <tag>, Add tag to latest running app image
tag:list <app>, List all app image tags tags:deploy <app> <tag>, Deploy tagged app image
tag:rm <app> <tag>, Remove app image tag tags:destroy <app> <tag>, Remove app image tag
EOF EOF
;; ;;
File renamed without changes.
+8 -9
View File
@@ -10,33 +10,32 @@ teardown() {
destroy_app destroy_app
} }
@test "(tag) tag:add, tag:list, tag:rm" { @test "(tags) tags:create, tags, tags:destroy" {
run /bin/bash -c "dokku tag:add $TEST_APP v0.9.0" run /bin/bash -c "dokku tags:create $TEST_APP v0.9.0"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
run /bin/bash -c "dokku tag:list $TEST_APP | egrep -q 'v0.9.0'" run /bin/bash -c "dokku tags $TEST_APP | egrep -q 'v0.9.0'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
run /bin/bash -c "dokku tag:rm $TEST_APP v0.9.0" run /bin/bash -c "dokku tags:destroy $TEST_APP v0.9.0"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
run /bin/bash -c "dokku tag:list $TEST_APP | egrep -q 'v0.9.0'" run /bin/bash -c "dokku tags $TEST_APP | egrep -q 'v0.9.0'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure assert_failure
} }
@test "(tag) tag:deploy" { @test "(tags) tags:deploy" {
run /bin/bash -c "dokku tag:add $TEST_APP v0.9.0" run /bin/bash -c "dokku tags:create $TEST_APP v0.9.0"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
run /bin/bash -c "dokku tag:deploy $TEST_APP v0.9.0" run /bin/bash -c "dokku tags:deploy $TEST_APP v0.9.0"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success