refactor to explicitly set IMAGE via get_app_image_name()

This commit is contained in:
Michael Hobbs committed 2015-09-03 16:12:36 -07:00
1 parent 2f16b06a76
commit 495b1d2ba0
14 files changed
+122 -107

No files matched your search

+15 -15
View File
@@ -5,7 +5,7 @@ source "$PLUGIN_PATH/config/functions"
case "$1" in
build)
APP="$2"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
APP="$2"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"; IMAGE=$(get_app_image_name $APP)
verify_app_name "$APP"
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
@@ -60,16 +60,16 @@ case "$1" in
;;
release)
APP="$2"; IMAGE_SOURCE_TYPE="$3"; TAG="$4"
verify_app_name "$APP" "$TAG"
APP="$2"; IMAGE_SOURCE_TYPE="$3"; IMAGE_TAG="$4"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
case "$IMAGE_SOURCE_TYPE" in
herokuish)
# *DEPRECATED* in v0.3.15: `pluginhook pre-release` will be removed in future releases
pluginhook pre-release "$APP" "$TAG"
pluginhook pre-release $APP $IMAGE_TAG
# *DEPRECATED* in v0.3.22: `pluginhook pre-release-buildstep` will be removed in future releases
pluginhook pre-release-buildstep "$APP" "$TAG"
pluginhook pre-release-buildpack "$APP" "$TAG"
pluginhook pre-release-buildstep $APP $IMAGE_TAG
pluginhook pre-release-buildpack $APP $IMAGE_TAG
if [[ -n $(config_export global) ]]; then
id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait $id)" -eq 0
@@ -81,15 +81,15 @@ case "$1" in
docker commit $id $IMAGE > /dev/null
fi
# *DEPRECATED* in v0.3.15: `pluginhook post-release` will be removed in future releases
pluginhook post-release "$APP" "$TAG"
pluginhook post-release $APP $IMAGE_TAG
# *DEPRECATED* in v0.3.22: `pluginhook post-release-buildstep` will be removed in future releases
pluginhook post-release-buildstep "$APP" "$TAG"
pluginhook post-release-buildpack "$APP" "$TAG"
pluginhook post-release-buildstep $APP $IMAGE_TAG
pluginhook post-release-buildpack $APP $IMAGE_TAG
;;
dockerfile)
pluginhook pre-release-dockerfile "$APP" "$TAG"
pluginhook post-release-dockerfile "$APP" "$TAG"
pluginhook pre-release-dockerfile $APP $IMAGE_TAG
pluginhook post-release-dockerfile $APP $IMAGE_TAG
;;
*)
@@ -170,13 +170,13 @@ case "$1" in
run)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
APP="$2"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP); IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
shift 2
DOCKER_ARGS=$(: | pluginhook docker-args $APP run $TAG)
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP $TAG)
DOCKER_ARGS=$(: | pluginhook docker-args $APP run $IMAGE_TAG)
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP $IMAGE_TAG)
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
has_tty && DOKKU_RUN_OPTS+=" -i -t"
is_image_herokuish_based "$IMAGE" && EXEC_CMD="/exec"