Repository navigation
feat(atc): natively inject BUILD_STATUS into resource metadata - #9523
Merged
Merged
Conversation
When using a resource within a hook step (e.g., on_success, on_failure, on_error, on_abort), the execution step is now context-aware of the build state sequence that triggered it. This modifies the builder tree to propagate the hook's execution state down to the resource environment variable natively, reducing configuration redundancy. Resolves concourse#8541
Contributor
Author
|
@taylorsilva can't seem to check what's wrong with validate-labels |
Member
|
Need to add you to the contributor team so you can read the build logs. That check looks for an appropriate label, which I've added now. |
didn't like how buildState was tacked on as another argument into every function. This cleans up function signatures while still allowing us to modify the build status in the `on_*` hook steps Signed-off-by: Taylor Silva <[email protected]>
keeps the naming internally consistent. The "state" wording came from the community user that submitted the suggestion Signed-off-by: Taylor Silva <[email protected]>
Member
taylorsilva
force-pushed
the
feat/build-state
branch
from
April 14, 2026 14:05
f662a00 to
df5850a
Compare
the status only changes when the hook steps are used, so I'd prefer to set the precedent that only the on_* hook steps get the BUILD_STATUS env var set. This avoids the situation where someone tries to use the `ensure` hook step, which would only ever have `BUILD_STATUS=started`. Signed-off-by: Taylor Silva <[email protected]>
taylorsilva
force-pushed
the
feat/build-state
branch
from
April 14, 2026 14:06
df5850a to
0f0dce6
Compare
Contributor
Author
|
Very nice your solution @taylorsilva. |
Member
|
I'm expecting all PR checks to pass. Once they pass I'll merge. |
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.




When using a resource within a hook step (e.g.,
on_success,on_failure,on_error,on_abort), the execution step is now context-aware of the build state sequence that triggered it. This modifies the builder tree to propagate the hook's execution state down to the resource environment variable natively, reducing configuration redundancy.Resolves #8541
Changes proposed by this PR
closes #8541
BuildStatestring that natively generates theBUILD_STATEenvironment variable.BuildState.on_success,on_failure,on_error, andon_abortbuilder wrappers to appropriately pass"succeeded","failed","errored", and"aborted"identifiers downstream when parsing nested plans.$BUILD_STATEparses correctly within nested pipeline hooks.Notes to reviewer
The engine passes the state by mapping hook-specific constants directly (e.g.,
db.BuildStatusSucceeded) dynamically when establishing the hierarchical step tree layout inside.Nextfields. This elegantly isolates the behavior down recursively regardless of how deep thein_parallel/do/try blocks scale.All unit checks passed successfully validating this nested environment allocation.
Release Note
$BUILD_STATEmetadata generation globally natively exposed when instantiating arbitrary hooks (simplifying parameter configurations for notification resources out-of-the-box).