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:
Jose Diaz-Gonzalez
2026-04-25 16:33:34 -04:00
parent 1308e21947
commit 24f460f5d3
9 changed files with 30 additions and 26 deletions

View File

@@ -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
BUILD = commands subcommands triggers
PLUGIN_NAME = apps

View File

@@ -28,6 +28,7 @@ Additional commands:`
apps:locked <app>, Checks if an app is locked for deployment
apps:rename <old-app> <new-app>, Rename 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`
)

View File

@@ -72,6 +72,13 @@ func main() {
appName := args.Arg(0)
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":
args := flag.NewFlagSet("apps:unlock", flag.ExitOnError)
args.Parse(os.Args[2:])

View File

@@ -226,6 +226,12 @@ func CommandReport(appName string, format string, infoFlag string) error {
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
func CommandUnlock(appName string) error {
if err := common.VerifyAppName(appName); err != nil {

View File

@@ -227,8 +227,8 @@ nginx_build_config() {
# setup nginx listen ports
plugn trigger ports-configure "$APP"
local PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
local PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
local PROXY_PORT=$(plugn trigger ports-get-property "$APP" "proxy-port")
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
local PORT_MAP PROXY_PORT_MAP proxy_port_map
while read -r PORT_MAP; do

View File

@@ -2,7 +2,7 @@
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
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() {
declare desc="unset port prior to vhosts being disabled"
@@ -14,19 +14,14 @@ trigger-nginx-vhosts-pre-disable-vhost() {
fi
# only clear ports if they are port 80 or 443
local PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
local PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
local PROXY_PORT=$(plugn trigger ports-get-property "$APP" "proxy-port")
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
ports_to_clear=()
if [[ "$PROXY_PORT" == "80" ]]; then
ports_to_clear+=("DOKKU_PROXY_PORT")
fn-plugin-property-delete "ports" "$APP" "proxy-port"
fi
if [[ "$PROXY_SSL_PORT" == "443" ]]; then
ports_to_clear+=("DOKKU_PROXY_SSL_PORT")
fi
if [[ "${#ports_to_clear[@]}" -gt 0 ]]; then
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" "${ports_to_clear[@]}"
fn-plugin-property-delete "ports" "$APP" "proxy-ssl-port"
fi
# clear ports if there is a mapping starting with http:80 or https:443

View File

@@ -2,7 +2,7 @@
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
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() {
declare desc="unset port prior to vhosts being enabled"
@@ -14,19 +14,14 @@ trigger-nginx-vhosts-pre-enable-vhost() {
fi
# only clear ports if they are port 80 or 443
local PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
local PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
local PROXY_PORT=$(plugn trigger ports-get-property "$APP" "proxy-port")
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
ports_to_clear=()
if [[ "$PROXY_PORT" == "80" ]]; then
ports_to_clear+=("DOKKU_PROXY_PORT")
fn-plugin-property-delete "ports" "$APP" "proxy-port"
fi
if [[ "$PROXY_SSL_PORT" == "443" ]]; then
ports_to_clear+=("DOKKU_PROXY_SSL_PORT")
fi
if [[ "${#ports_to_clear[@]}" -gt 0 ]]; then
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" "${ports_to_clear[@]}"
fn-plugin-property-delete "ports" "$APP" "proxy-ssl-port"
fi
# clear ports if there is a mapping starting with http:80 or https:443

View File

@@ -116,7 +116,7 @@ teardown() {
echo "output: $output"
echo "status: $status"
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 "status: $status"
assert_success

View File

@@ -62,7 +62,7 @@ teardown() {
@test "(nginx-vhosts) proxy:build-config (global proxy-port)" {
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 "status: $status"
assert_success
@@ -74,7 +74,7 @@ teardown() {
check_urls "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 "status: $status"
assert_success