fix(deploy): nx update 在 set -u 下 local root 同行展开报错
拆分 nexus_publish_port/set_install_complete/sync_env_prod_to_volume 的 local 声明, 避免 env_file="$root/..." 在 root 赋值前展开导致 unbound variable。
This commit is contained in:
@@ -266,13 +266,17 @@ nexus_container_name() {
|
||||
}
|
||||
|
||||
nexus_publish_port() {
|
||||
local root="$1" env_file="$root/$ENV_PROD" port
|
||||
local root="$1"
|
||||
local env_file="$root/$ENV_PROD"
|
||||
local port
|
||||
port="$(grep -E '^NEXUS_PUBLISH_PORT=' "$env_file" 2>/dev/null | cut -d= -f2- | tr -d '"' || true)"
|
||||
echo "${port:-8600}"
|
||||
}
|
||||
|
||||
set_install_complete() {
|
||||
local root="$1" env_file="$root/$ENV_PROD" cname
|
||||
local root="$1"
|
||||
local env_file="$root/$ENV_PROD"
|
||||
local cname
|
||||
[[ -f "$env_file" ]] || return 0
|
||||
cname="$(nexus_container_name)"
|
||||
[[ -n "$cname" ]] || return 0
|
||||
@@ -283,7 +287,9 @@ set_install_complete() {
|
||||
}
|
||||
|
||||
sync_env_prod_to_volume() {
|
||||
local root="$1" env_file="$root/$ENV_PROD" state_vol cname
|
||||
local root="$1"
|
||||
local env_file="$root/$ENV_PROD"
|
||||
local state_vol cname
|
||||
state_vol="$(docker volume ls -q --filter name=nexus-state 2>/dev/null | head -1 || true)"
|
||||
[[ -n "$state_vol" && -f "$env_file" ]] || return 0
|
||||
cname="$(nexus_container_name)"
|
||||
|
||||
Reference in New Issue
Block a user