fix: Publish stage skipped due to broken stageDependencies output variable in 1ES template#4094
Merged
Saadnajmi merged 1 commit intomicrosoft:mainfrom Apr 24, 2026
Conversation
dd60380 to
0ae2bfd
Compare
Two issues in the Publish stage condition:
1. not(${{ parameters.skipNpmPublish }}) mixes compile-time template
expansion with runtime expression evaluation. The YAML boolean expands
to 'False'/'True' (capital), which are non-empty strings (always truthy
in runtime), so not() always returns false. Fix: use ne() string
comparison instead.
2. stageDependencies.Build.BuildAndPack.outputs['check.hasTarballs'] does
not resolve correctly under 1ES Pipeline Templates, because
templateContext.outputs restructures the job and breaks the output
variable reference path. Fix: remove the cross-stage variable dependency
and verify tarballs exist inside the Publish job after downloading the
artifact.
dannyvv
approved these changes
Apr 24, 2026
0ae2bfd to
7df9c90
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.
Follow-up to #4093
PR #4093 fixed the
not(${{ parameters.skipNpmPublish }})compile-time/runtime boolean mismatch, but the Publish stage is still being skipped.Root Cause
The remaining issue is the
stageDependenciesoutput variable reference:eq(stageDependencies.Build.BuildAndPack.outputs['check.hasTarballs'], 'true')Under 1ES Pipeline Templates,
templateContext.outputsrestructures the job internally. This breaks thestageDependenciesreference path — the output variable resolves to empty, soeq('', 'true')→false, and the stage is always skipped.Fix
Remove the cross-stage output variable dependency from the stage condition. The simplified condition is now:
Move the tarball check into the Publish job — after downloading the artifact, verify tarballs exist and fail early with a clear error if they don't:
This is more robust than relying on cross-stage output variables through the 1ES template layer.