Merge pull request #8600 from dokku/8596-report-subcommand-errors-with-not-deployed-when-probing-config-properties-before-deploy

Report info-flag should not error when app undeployed
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-10 23:49:56 -04:00
committed by GitHub
27 changed files with 288 additions and 43 deletions

View File

@@ -74,21 +74,19 @@ cmd-builder-dockerfile-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -74,21 +74,19 @@ cmd-builder-herokuish-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -74,21 +74,19 @@ cmd-builder-lambda-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -74,21 +74,19 @@ cmd-builder-nixpacks-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -74,21 +74,19 @@ cmd-builder-pack-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -74,21 +74,19 @@ cmd-builder-railpack-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -107,14 +107,13 @@ cmd-caddy-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi

View File

@@ -75,21 +75,19 @@ cmd-certs-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -77,21 +77,19 @@ cmd-checks-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -77,14 +77,13 @@ cmd-domains-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi

View File

@@ -407,21 +407,19 @@ cmd-git-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -97,14 +97,13 @@ cmd-haproxy-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi

View File

@@ -164,21 +164,19 @@ cmd-nginx-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -134,14 +134,13 @@ cmd-openresty-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi

View File

@@ -69,21 +69,19 @@ cmd-scheduler-docker-local-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}

View File

@@ -124,14 +124,13 @@ cmd-traefik-report-single() {
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
echo "$value" && match=true
else
match=true
fi

View File

@@ -12,6 +12,30 @@ teardown() {
destroy_app
}
@test "(builder-dockerfile:report) info-flag works before deploy" {
run /bin/bash -c "dokku builder-dockerfile:report $TEST_APP --builder-dockerfile-dockerfile-path"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-dockerfile:set $TEST_APP dockerfile-path second.Dockerfile"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-dockerfile:report $TEST_APP --builder-dockerfile-dockerfile-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "second.Dockerfile"
run /bin/bash -c "dokku builder-dockerfile:report $TEST_APP --builder-dockerfile-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(builder-dockerfile:report) --global --format json" {
run /bin/bash -c "dokku builder-dockerfile:report --global --format json | jq -e ."
echo "output: $output"

View File

@@ -10,6 +10,30 @@ teardown() {
destroy_app
}
@test "(builder-herokuish:report) info-flag works before deploy" {
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-allowed"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP allowed false"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-allowed"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "false"
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(builder-herokuish:report) --global --builder-herokuish-global-allowed" {
run /bin/bash -c "dokku builder-herokuish:set --global allowed false"
echo "output: $output"

View File

@@ -10,6 +10,30 @@ teardown() {
destroy_app
}
@test "(builder-lambda:report) info-flag works before deploy" {
run /bin/bash -c "dokku builder-lambda:report $TEST_APP --builder-lambda-lambdayml-path"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-lambda:set $TEST_APP lambdayml-path lambda.alt.yml"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-lambda:report $TEST_APP --builder-lambda-lambdayml-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "lambda.alt.yml"
run /bin/bash -c "dokku builder-lambda:report $TEST_APP --builder-lambda-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(builder-lambda:report) --global --builder-lambda-global-lambdayml-path" {
run /bin/bash -c "dokku builder-lambda:set --global lambdayml-path lambda.alt.yml"
echo "output: $output"

View File

@@ -14,6 +14,30 @@ teardown() {
destroy_app
}
@test "(builder-nixpacks:report) info-flag works before deploy" {
run /bin/bash -c "dokku builder-nixpacks:report $TEST_APP --builder-nixpacks-nixpackstoml-path"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-nixpacks:set $TEST_APP nixpackstoml-path nixpacks.alt.toml"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-nixpacks:report $TEST_APP --builder-nixpacks-nixpackstoml-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "nixpacks.alt.toml"
run /bin/bash -c "dokku builder-nixpacks:report $TEST_APP --builder-nixpacks-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(builder-nixpacks:report) --global --builder-nixpacks-global-nixpackstoml-path" {
run /bin/bash -c "dokku builder-nixpacks:set --global nixpackstoml-path nixpacks.alt.toml"
echo "output: $output"

View File

@@ -16,6 +16,30 @@ teardown() {
global_teardown
}
@test "(builder-pack:report) info-flag works before deploy" {
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-projecttoml-path"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-pack:set $TEST_APP projecttoml-path project.alt.toml"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-projecttoml-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "project.alt.toml"
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(builder-pack:report) --global --builder-pack-global-projecttoml-path" {
run /bin/bash -c "dokku builder-pack:set --global projecttoml-path project.alt.toml"
echo "output: $output"

View File

@@ -25,6 +25,30 @@ teardown() {
global_teardown
}
@test "(builder-railpack:report) info-flag works before deploy" {
run /bin/bash -c "dokku builder-railpack:report $TEST_APP --builder-railpack-railpackjson-path"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-railpack:set $TEST_APP railpackjson-path railpack.alt.json"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-railpack:report $TEST_APP --builder-railpack-railpackjson-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "railpack.alt.json"
run /bin/bash -c "dokku builder-railpack:report $TEST_APP --builder-railpack-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(builder-railpack:report) --global --builder-railpack-global-railpackjson-path" {
run /bin/bash -c "dokku builder-railpack:set --global railpackjson-path railpack.alt.json"
echo "output: $output"

View File

@@ -41,6 +41,25 @@ teardown() {
assert_output "$help_output"
}
@test "(certs:report) info-flag works before deploy" {
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-hostnames"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-dir"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "/$TEST_APP/tls"
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(certs:report) --global --format json" {
run /bin/bash -c "dokku certs:report --global --format json | jq -e ."
echo "output: $output"

View File

@@ -16,6 +16,30 @@ teardown() {
global_teardown
}
@test "(checks:report) info-flag works before deploy" {
run /bin/bash -c "dokku checks:report $TEST_APP --checks-wait-to-retire"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku checks:set $TEST_APP wait-to-retire 30"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku checks:report $TEST_APP --checks-wait-to-retire"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "30"
run /bin/bash -c "dokku checks:report $TEST_APP --checks-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(checks:report) --global --format json" {
run /bin/bash -c "dokku checks:set --global wait-to-retire 90"
echo "output: $output"

View File

@@ -12,6 +12,36 @@ teardown() {
global_teardown
}
@test "(git:report) info-flag works before deploy" {
run /bin/bash -c "dokku git:report $TEST_APP --git-deploy-branch"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "master"
run /bin/bash -c "dokku git:set $TEST_APP deploy-branch main"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku git:report $TEST_APP --git-deploy-branch"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "main"
run /bin/bash -c "dokku git:report $TEST_APP --git-sha"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku git:report $TEST_APP --git-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(git) git:help" {
run /bin/bash -c "dokku git"
echo "output: $output"

View File

@@ -28,6 +28,35 @@ teardown() {
assert_output "$help_output"
}
@test "(nginx:report) info-flag works before deploy" {
run create_app
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku nginx:report $TEST_APP --nginx-bind-address-ipv4"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku nginx:set $TEST_APP bind-address-ipv4 127.0.0.1"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku nginx:report $TEST_APP --nginx-bind-address-ipv4"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "127.0.0.1"
run /bin/bash -c "dokku nginx:report $TEST_APP --nginx-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
}
@test "(nginx:report) --format json" {
run create_app
echo "output: $output"

View File

@@ -18,6 +18,32 @@ teardown() {
assert_output "true"
}
@test "(scheduler-docker-local:report) info-flag works before deploy" {
run create_app
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --scheduler-docker-local-parallel-schedule-count"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --scheduler-docker-local-init-process"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "true"
run /bin/bash -c "dokku scheduler-docker-local:report $TEST_APP --scheduler-docker-local-invalid-flag"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
destroy_app
}
@test "(scheduler-docker-local) scheduler-docker-local:help" {
run /bin/bash -c "dokku scheduler-docker-local"
echo "output: $output"