Merge branch 'master' into add-ppa-before-apt

This commit is contained in:
Jody McIntyre
2017-07-24 11:46:53 -04:00
committed by GitHub
3 changed files with 26 additions and 1 deletions

View File

@@ -8,6 +8,10 @@ apps_pre_delete() {
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG"); local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
verify_app_name "$APP"
if ! is_image_herokuish_based "$IMAGE"; then
return
fi
if [[ -d $CACHE_DIR ]]; then
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
fi

View File

@@ -985,6 +985,7 @@ get_container_ports() {
get_app_urls() {
declare desc="print an app's available urls"
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
@@ -1015,7 +1016,11 @@ get_app_urls() {
local URLS="$(merge_dedupe_list "$port_urls $app_urls" " ")"
case "$1" in
url)
echo "$URLS" | tr ' ' '\n' | head -n1
if is_ssl_enabled "$APP"; then
echo "$URLS" | tr ' ' '\n' | grep https | head -n1
else
echo "$URLS" | tr ' ' '\n' | head -n1
fi
;;
urls)
echo "$URLS" | tr ' ' '\n' | sort

View File

@@ -22,6 +22,15 @@ assert_urls() {
assert_output < <(tr ' ' '\n' <<< "${urls}" | sort)
}
assert_url() {
url=$1
run dokku url $TEST_APP
echo "output: "$output
echo "status: "$status
echo "url: ${url}"
assert_output "${url}"
}
build_nginx_config() {
# simulate nginx post-deploy
dokku domains:setup $TEST_APP
@@ -64,6 +73,13 @@ build_nginx_config() {
assert_urls "http://test.dokku.me" "http://${TEST_APP}.dokku.me" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
}
@test "(core) url (app ssl)" {
setup_test_tls
assert_url "https://dokku.me"
build_nginx_config
assert_url "https://${TEST_APP}.dokku.me"
}
@test "(core) urls (wildcard ssl)" {
setup_test_tls wildcard
assert_urls "https://dokku.me"