Merge pull request #1980 from dokku/1903_cu12-fix-dockerfile-vs-buildpack-environment-variable
(rebased) Fix issue when Dockerfile present but BUILDPACK_URL is set
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
dokku_receive_cmd() {
|
dokku_receive_cmd() {
|
||||||
declare desc="receives an app kicks off deploy process"
|
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"
|
dokku_log_info1 "DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup"
|
||||||
fi
|
fi
|
||||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
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"
|
dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||||
release_and_deploy "$APP"
|
release_and_deploy "$APP"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
git_build_app_repo() {
|
git_build_app_repo() {
|
||||||
declare desc="builds local git app repo for app"
|
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
|
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
|
||||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||||
|
|
||||||
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; 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"
|
plugn trigger pre-receive-app "$APP" "dockerfile" "$TMP_WORK_DIR" "$REV"
|
||||||
dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -55,3 +55,16 @@ teardown() {
|
|||||||
echo "status: "$status
|
echo "status: "$status
|
||||||
assert_failure
|
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"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user