fix(deploy): reuse existing proxy subnet
CI and Deploy / test (pull_request) Successful in 5m17s
CI and Deploy / test (push) Successful in 5m16s
CI and Deploy / deploy (pull_request) Has been skipped
CI and Deploy / deploy (push) Failing after 6s

This commit is contained in:
cesnimda
2026-08-24 20:38:03 +02:00
parent 44dba5d08d
commit c4b81918c4
2 changed files with 21 additions and 1 deletions
+20
View File
@@ -91,6 +91,24 @@ require_var() {
return 0
}
resolve_existing_web_proxy_subnet() {
if [ -n "${WEB_PROXY_SUBNET:-}" ]; then
return 0
fi
local project_name="${COMPOSE_PROJECT_NAME:-$(basename "$PWD")}" network_name subnet
network_name="${project_name}_web_proxy"
if ! docker network inspect "$network_name" >/dev/null 2>&1; then
return 0
fi
subnet="$(docker network inspect -f '{{range .IPAM.Config}}{{println .Subnet}}{{end}}' "$network_name" 2>/dev/null | head -n 1 | tr -d '[:space:]')"
if [[ "$subnet" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[12][0-9]|3[0-2])$ ]]; then
export WEB_PROXY_SUBNET="$subnet"
echo "Reusing WEB_PROXY_SUBNET from the existing ${network_name} Docker network."
fi
}
validate_deploy_config() {
local failed=0 octet subnet_address microsoft_tenant
local -a subnet_octets=()
@@ -386,6 +404,8 @@ verify_volume_backup() {
report_backup "$target"
}
resolve_existing_web_proxy_subnet
if ! validate_deploy_config; then
exit 1
fi