From a91165d3e6d077c28c9dcc2bef1371d70fac4fca Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Wed, 9 Mar 2016 16:35:48 -0500 Subject: [PATCH] set DOKKU_APP_TYPE to IMAGE_SOURCE_TYPE value use in test case --- plugins/00_dokku-standard/subcommands/receive | 2 ++ plugins/git/commands | 3 ++- tests/unit/20_build-env.bats | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/00_dokku-standard/subcommands/receive b/plugins/00_dokku-standard/subcommands/receive index 3ba53c7de..f5358646d 100755 --- a/plugins/00_dokku-standard/subcommands/receive +++ b/plugins/00_dokku-standard/subcommands/receive @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" dokku_receive_cmd() { declare desc="receives an app kicks off deploy process" @@ -13,6 +14,7 @@ dokku_receive_cmd() { dokku_log_info1 "DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup" fi dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..." + config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &> /dev/null dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR" release_and_deploy "$APP" } diff --git a/plugins/git/commands b/plugins/git/commands index 43b2028d0..ddd7499b6 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -2,6 +2,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/apps/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" git_build_app_repo() { declare desc="builds local git app repo for app" @@ -32,7 +33,7 @@ git_build_app_repo() { GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true find -name .git -prune -exec rm -rf {} \; > /dev/null - if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ "$(grep -q BUILDPACK_URL $DOKKU_ROOT/$APP/ENV)" ]]; then + if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then plugn trigger pre-receive-app "$APP" "dockerfile" "$TMP_WORK_DIR" "$REV" dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" else diff --git a/tests/unit/20_build-env.bats b/tests/unit/20_build-env.bats index 68e397a55..eeecb5d36 100644 --- a/tests/unit/20_build-env.bats +++ b/tests/unit/20_build-env.bats @@ -55,3 +55,16 @@ teardown() { echo "status: "$status assert_failure } + +@test "(build-env) buildpack deploy with Dockerfile" { + run dokku config:set --no-restart $TEST_APP BUILDPACK_URL='https://github.com/heroku/heroku-buildpack-nodejs' + echo "output: "$output + echo "status: "$status + assert_success + + deploy_app dockerfile + run dokku --quiet config:get $TEST_APP DOKKU_APP_TYPE + echo "output: "$output + echo "status: "$status + assert_output "herokuish" +}