fix: run and await after-build pipelines before deploying - #235
Merged
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.
Issue
Services can declare an
afterBuildPipelineId: a pipeline that must run after the image buildfor the deployed image to actually work (for example, publishing build artifacts the running
service depends on). That pipeline was only ever triggered by the run that built the image, and
the image-exists check (
tagsExist) assumed a present tag meant all build work was done:completing, the image was left permanently unprocessed. Every later pass — including manual
redeploys — found the tag, skipped the pipeline, and deployed anyway. There was no recovery
path short of deleting the image tag to force a rebuild.
observed and deploys could race it.
Fix
An image is only deployable when its after-build pipeline is proven to have run.
(
afterBuildCompletionKey=pipelineId@imageTag, migration 033). A Codefresh-engine buildalso records it on success when its embedded post-build step is non-detached, since that
step's failure fails the parent pipeline. The record is cleared, fail-closed, before any
rebuild of the same tag.
triggered and awaited before BUILT (any builder engine); failure records BUILD_FAILED and
blocks rollout. Matching → skipped, so redeploys of already-verified services don't re-run it.
doesn't.
is rechecked after every pipeline wait so a stale run can't publish state.
branchplusSOURCE_REVISION/SOURCE_BRANCH).The record is only ever an optimization: a missing or stale record causes a re-run, never a
skip. This relies on two contracts already implicit in tag-level build dedupe — an image tag
(sha + env hash) identifies equivalent build outputs, and after-build pipelines are idempotent
per image tag.
After deploying this change, the first pass over each environment re-runs its after-build
services' pipelines once (no recorded completions exist yet), then goes quiet.