fix: address CI failures from env var migration
- Add apps:set subcommand for managing apps properties (mirrors ps:set, scheduler:set, builder:set pattern) - Update nginx-vhosts functions/pre-disable-vhost/pre-enable-vhost to read proxy port from properties instead of config vars - Fix test commands to use correct property-setting approaches: prop binary for ports properties, apps:set for apps properties
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
SUBCOMMANDS = subcommands/clone subcommands/create subcommands/destroy subcommands/exists subcommands/list subcommands/lock subcommands/locked subcommands/rename subcommands/report subcommands/unlock
|
SUBCOMMANDS = subcommands/clone subcommands/create subcommands/destroy subcommands/exists subcommands/list subcommands/lock subcommands/locked subcommands/rename subcommands/report subcommands/set subcommands/unlock
|
||||||
TRIGGERS = triggers/app-create triggers/app-destroy triggers/app-exists triggers/app-maybe-create triggers/deploy-source-set triggers/install triggers/post-app-clone-setup triggers/post-app-rename triggers/post-app-rename-setup triggers/post-create triggers/post-delete triggers/report
|
TRIGGERS = triggers/app-create triggers/app-destroy triggers/app-exists triggers/app-maybe-create triggers/deploy-source-set triggers/install triggers/post-app-clone-setup triggers/post-app-rename triggers/post-app-rename-setup triggers/post-create triggers/post-delete triggers/report
|
||||||
BUILD = commands subcommands triggers
|
BUILD = commands subcommands triggers
|
||||||
PLUGIN_NAME = apps
|
PLUGIN_NAME = apps
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ Additional commands:`
|
|||||||
apps:locked <app>, Checks if an app is locked for deployment
|
apps:locked <app>, Checks if an app is locked for deployment
|
||||||
apps:rename <old-app> <new-app>, Rename an app
|
apps:rename <old-app> <new-app>, Rename an app
|
||||||
apps:report [<app>] [<flag>], Display report about an app
|
apps:report [<app>] [<flag>], Display report about an app
|
||||||
|
apps:set <app>|--global <key> <value>, Set or clear an apps property
|
||||||
apps:unlock <app>, Unlocks an app for deployment`
|
apps:unlock <app>, Unlocks an app for deployment`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,13 @@ func main() {
|
|||||||
appName := args.Arg(0)
|
appName := args.Arg(0)
|
||||||
err = apps.CommandReport(appName, *format, infoFlag)
|
err = apps.CommandReport(appName, *format, infoFlag)
|
||||||
}
|
}
|
||||||
|
case "set":
|
||||||
|
args := flag.NewFlagSet("apps:set", flag.ExitOnError)
|
||||||
|
args.Parse(os.Args[2:])
|
||||||
|
appName := args.Arg(0)
|
||||||
|
property := args.Arg(1)
|
||||||
|
value := args.Arg(2)
|
||||||
|
err = apps.CommandSet(appName, property, value)
|
||||||
case "unlock":
|
case "unlock":
|
||||||
args := flag.NewFlagSet("apps:unlock", flag.ExitOnError)
|
args := flag.NewFlagSet("apps:unlock", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
args.Parse(os.Args[2:])
|
||||||
|
|||||||
@@ -226,6 +226,12 @@ func CommandReport(appName string, format string, infoFlag string) error {
|
|||||||
return ReportSingleApp(appName, format, infoFlag)
|
return ReportSingleApp(appName, format, infoFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandSet set or clear an apps property for an app
|
||||||
|
func CommandSet(appName string, property string, value string) error {
|
||||||
|
common.CommandPropertySet("apps", appName, property, value, DefaultProperties, GlobalProperties)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// CommandUnlock unlocks an app for deployment
|
// CommandUnlock unlocks an app for deployment
|
||||||
func CommandUnlock(appName string) error {
|
func CommandUnlock(appName string) error {
|
||||||
if err := common.VerifyAppName(appName); err != nil {
|
if err := common.VerifyAppName(appName); err != nil {
|
||||||
|
|||||||
@@ -227,8 +227,8 @@ nginx_build_config() {
|
|||||||
|
|
||||||
# setup nginx listen ports
|
# setup nginx listen ports
|
||||||
plugn trigger ports-configure "$APP"
|
plugn trigger ports-configure "$APP"
|
||||||
local PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
|
local PROXY_PORT=$(plugn trigger ports-get-property "$APP" "proxy-port")
|
||||||
local PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
|
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
|
||||||
|
|
||||||
local PORT_MAP PROXY_PORT_MAP proxy_port_map
|
local PORT_MAP PROXY_PORT_MAP proxy_port_map
|
||||||
while read -r PORT_MAP; do
|
while read -r PORT_MAP; do
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
||||||
|
|
||||||
trigger-nginx-vhosts-pre-disable-vhost() {
|
trigger-nginx-vhosts-pre-disable-vhost() {
|
||||||
declare desc="unset port prior to vhosts being disabled"
|
declare desc="unset port prior to vhosts being disabled"
|
||||||
@@ -14,19 +14,14 @@ trigger-nginx-vhosts-pre-disable-vhost() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# only clear ports if they are port 80 or 443
|
# only clear ports if they are port 80 or 443
|
||||||
local PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
|
local PROXY_PORT=$(plugn trigger ports-get-property "$APP" "proxy-port")
|
||||||
local PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
|
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
|
||||||
|
|
||||||
ports_to_clear=()
|
|
||||||
if [[ "$PROXY_PORT" == "80" ]]; then
|
if [[ "$PROXY_PORT" == "80" ]]; then
|
||||||
ports_to_clear+=("DOKKU_PROXY_PORT")
|
fn-plugin-property-delete "ports" "$APP" "proxy-port"
|
||||||
fi
|
fi
|
||||||
if [[ "$PROXY_SSL_PORT" == "443" ]]; then
|
if [[ "$PROXY_SSL_PORT" == "443" ]]; then
|
||||||
ports_to_clear+=("DOKKU_PROXY_SSL_PORT")
|
fn-plugin-property-delete "ports" "$APP" "proxy-ssl-port"
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${#ports_to_clear[@]}" -gt 0 ]]; then
|
|
||||||
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" "${ports_to_clear[@]}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clear ports if there is a mapping starting with http:80 or https:443
|
# clear ports if there is a mapping starting with http:80 or https:443
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
||||||
|
|
||||||
trigger-nginx-vhosts-pre-enable-vhost() {
|
trigger-nginx-vhosts-pre-enable-vhost() {
|
||||||
declare desc="unset port prior to vhosts being enabled"
|
declare desc="unset port prior to vhosts being enabled"
|
||||||
@@ -14,19 +14,14 @@ trigger-nginx-vhosts-pre-enable-vhost() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# only clear ports if they are port 80 or 443
|
# only clear ports if they are port 80 or 443
|
||||||
local PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
|
local PROXY_PORT=$(plugn trigger ports-get-property "$APP" "proxy-port")
|
||||||
local PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
|
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
|
||||||
|
|
||||||
ports_to_clear=()
|
|
||||||
if [[ "$PROXY_PORT" == "80" ]]; then
|
if [[ "$PROXY_PORT" == "80" ]]; then
|
||||||
ports_to_clear+=("DOKKU_PROXY_PORT")
|
fn-plugin-property-delete "ports" "$APP" "proxy-port"
|
||||||
fi
|
fi
|
||||||
if [[ "$PROXY_SSL_PORT" == "443" ]]; then
|
if [[ "$PROXY_SSL_PORT" == "443" ]]; then
|
||||||
ports_to_clear+=("DOKKU_PROXY_SSL_PORT")
|
fn-plugin-property-delete "ports" "$APP" "proxy-ssl-port"
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${#ports_to_clear[@]}" -gt 0 ]]; then
|
|
||||||
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" "${ports_to_clear[@]}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clear ports if there is a mapping starting with http:80 or https:443
|
# clear ports if there is a mapping starting with http:80 or https:443
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ teardown() {
|
|||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
assert_success
|
||||||
run /bin/bash -c "dokku ports:set $TEST_APP proxy-ssl-port 443"
|
run /bin/bash -c "$PLUGIN_CORE_AVAILABLE_PATH/common/prop set ports $TEST_APP proxy-ssl-port 443"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
assert_success
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ teardown() {
|
|||||||
|
|
||||||
@test "(nginx-vhosts) proxy:build-config (global proxy-port)" {
|
@test "(nginx-vhosts) proxy:build-config (global proxy-port)" {
|
||||||
local GLOBAL_PORT=30999
|
local GLOBAL_PORT=30999
|
||||||
run /bin/bash -c "dokku ports:set --global proxy-port ${GLOBAL_PORT}"
|
run /bin/bash -c "$PLUGIN_CORE_AVAILABLE_PATH/common/prop set ports --global proxy-port ${GLOBAL_PORT}"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
assert_success
|
||||||
@@ -74,7 +74,7 @@ teardown() {
|
|||||||
check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
|
check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
|
||||||
assert_http_success "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
|
assert_http_success "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
|
||||||
|
|
||||||
run /bin/bash -c "dokku ports:set --global proxy-port"
|
run /bin/bash -c "$PLUGIN_CORE_AVAILABLE_PATH/common/prop del ports --global proxy-port"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
assert_success
|
||||||
|
|||||||
Reference in New Issue
Block a user