fix: preserve server schedule failures through tee pipeline#4122
Open
Gabrielgvl wants to merge 1 commit intoDokploy:canaryfrom
Open
fix: preserve server schedule failures through tee pipeline#4122Gabrielgvl wants to merge 1 commit intoDokploy:canaryfrom
Gabrielgvl wants to merge 1 commit intoDokploy:canaryfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Server schedules currently wrap the remote script with
tee -a <log>but only useset -e.That means the pipeline exit status comes from
tee, not from the scheduled script. If the remote script exits non-zero butteesucceeds, Dokploy can still mark the deployment asdone.This change enables
pipefailfor thescheduleType === "server"execution path so non-zero script exits propagate correctly.Reproduction
With the current code, a server schedule like this can still finish as
done:The current wrapper is:
Because the pipeline does not use
pipefail,teecan return0and hide the script failure.Fix
Change the wrapper to:
set -euo pipefailso the pipeline fails when the scheduled script fails.
Validation
pnpm exec biome check packages/server/src/utils/schedules/utils.tsGreptile Summary
This PR fixes a real bug in the
serverschedule type where shell pipeline exit codes were silently dropped. The wrapper command usedset -ebut notpipefail, meaning the pipelinebash -c script.sh 2>&1 | tee -a logwould returntee's exit code (typically 0) rather than the script's exit code. If the scheduled script exited non-zero, the|| { echo "❌ Command failed"; exit 1; }guard would never fire and the deployment would be incorrectly marked asdone.The one-line fix — changing
set -etoset -euo pipefail— correctly addresses this. Withpipefail, a non-zero exit from any command in a pipeline propagates as the pipeline's exit status, causing the||handler to trigger and the deployment to be correctly marked aserror.Key observations:
set -euo pipefailis a standard bash idiom;-u(nounset) is a safe addition since all variables (${deployment.logPath},${fullPath}) are interpolated by TypeScript before the shell sees them.application/composeremote anddokploy-server) don't useteein a pipeline, so they don't have the same issue and don't require the same fix.Confidence Score: 5/5
set -etoset -euo pipefail, which is the canonical fix for the describedtee-pipeline exit-code problem. No regressions are introduced: all variable substitutions are TypeScript-side,-uis safe here, and the||guard still works correctly withpipefailactive. No other files are affected.Reviews (1): Last reviewed commit: "fix: preserve server schedule failures t..." | Re-trigger Greptile
(2/5) Greptile learns from your feedback when you react with thumbs up/down!