Skip PostDeploy convention when the main script fails#425
Merged
Conversation
A non-zero main-script exit did not throw, so the pipeline carried on and ran the PostDeploy convention against a failed deploy. PostDeploy is where smoke tests, cache warm-up, and service-mesh registration live — running them on a deploy that already failed is worse than not running them at all. Gate PostDeploy on a single-source DeployHasFailed predicate (an upstream step threw OR the main script exited non-zero) via an opt-in skipWhenDeployFailed flag on ConventionScriptStep. PreDeploy keeps the default (false): it runs before the main script, so the failure state is never set when it is evaluated. DeployFailedConventionStep now consults the same predicate, so the skip-PostDeploy gate and the run-DeployFailed gate can never disagree about whether the deploy failed. The flag is an optional constructor parameter, so every existing call site is unchanged; only PostDeploy's behaviour on a failed main script changes.
ppXD
force-pushed
the
fix/skip-postdeploy-on-main-script-failure
branch
from
June 10, 2026 08:00
c69a46b to
5a435a3
Compare
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
RunScriptCommandContext.DeployHasFailedpredicate (an upstream step threw or the main script exited non-zero) and gate PostDeploy on it via an opt-inskipWhenDeployFailedflag onConventionScriptStep. PostDeploy passestrue; PreDeploy keeps the defaultfalse(it runs before the main script, so the failure state is never set when it is evaluated).DeployFailedConventionStepnow consults the sameDeployHasFailedpredicate, so the skip-PostDeploy gate and the run-DeployFailed gate can never disagree about whether the deploy failed (previously the predicate was duplicated inline).skipWhenDeployFailedis an optional constructor parameter, so every existing call site / test is unchanged. Only PostDeploy's behaviour on a failed main script changes. The separate IISDeployToIISWebSite.ps1convention system already skips PostDeploy on failure and is untouched.Test plan
RunScriptCommandTests): mainexit 3+PostDeploy.sh+DeployFailed.shpresent → PostDeploy sentinel absent (skipped), DeployFailed sentinel present (ran),ExitCode == 3exit 0→ PostDeploy runs, DeployFailed skipped (happy-path regression guard)ConventionScriptStepTests):IsEnabledgating — flag+non-zero-exit → skip; flag+ExecutionFailed→ skip; flag+exit-0 → run; default-flag ignores failure state (PreDeploy unaffected)DeployHasFailedpredicate[Theory]over (executionFailed × exitCode) branchesSquid.Calamari.Testssuite 556/556 green;dotnet build Squid.sln0 errors