mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-06-15 18:42:44 +00:00
implemented exiting with the number of failed deployments
This commit is contained in:
parent
1dc597b538
commit
3551e4a787
@ -72,17 +72,14 @@ multideploy_deploy() {
|
|||||||
_debug3 "File" "$file"
|
_debug3 "File" "$file"
|
||||||
|
|
||||||
# Deploy to services
|
# Deploy to services
|
||||||
if _deploy_services "$file"; then
|
_deploy_services "$file"
|
||||||
_deploymentOk=0
|
_exitCode="$?"
|
||||||
else
|
|
||||||
_deploymentOk=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Save deployhook for renewals
|
# Save deployhook for renewals
|
||||||
_debug2 "Setting Le_DeployHook"
|
_debug2 "Setting Le_DeployHook"
|
||||||
_savedomainconf "Le_DeployHook" "multideploy"
|
_savedomainconf "Le_DeployHook" "multideploy"
|
||||||
|
|
||||||
return "$_deploymentOk"
|
return "$_exitCode"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Description:
|
# Description:
|
||||||
@ -239,7 +236,8 @@ _deploy_services() {
|
|||||||
|
|
||||||
_service_list=$(printf '%s\n' "$_services")
|
_service_list=$(printf '%s\n' "$_services")
|
||||||
|
|
||||||
_errors=""
|
_failedServices=""
|
||||||
|
_failedCount=0
|
||||||
for _service in $(printf '%s\n' "$_service_list"); do
|
for _service in $(printf '%s\n' "$_service_list"); do
|
||||||
_debug2 "Service" "$_service"
|
_debug2 "Service" "$_service"
|
||||||
_hook=$(yq e ".services[] | select(.name == \"$_service\").hook" "$_deploy_file")
|
_hook=$(yq e ".services[] | select(.name == \"$_service\").hook" "$_deploy_file")
|
||||||
@ -247,18 +245,21 @@ _deploy_services() {
|
|||||||
|
|
||||||
_export_envs "$_envs"
|
_export_envs "$_envs"
|
||||||
if ! _deploy_service "$_service" "$_hook"; then
|
if ! _deploy_service "$_service" "$_hook"; then
|
||||||
_errors="$_service, $_errors"
|
_failedServices="$_service, $_failedServices"
|
||||||
|
_failedCount=$((_failedCount + 1))
|
||||||
fi
|
fi
|
||||||
_clear_envs "$_envs"
|
_clear_envs "$_envs"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$_errors" ]; then
|
_debug3 "Failed services" "$_failedServices"
|
||||||
_err "Deployment failed for services: $_errors"
|
_debug2 "Failed count" "$_failedCount"
|
||||||
return 1
|
if [ -n "$_failedServices" ]; then
|
||||||
|
_info "$(__red "Deployment failed") for services: $_failedServices"
|
||||||
else
|
else
|
||||||
_debug "All services deployed successfully."
|
_debug "All services deployed successfully."
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
return "$_failedCount"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Description: Deploys a service using the specified hook.
|
# Description: Deploys a service using the specified hook.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user