-
Notifications
You must be signed in to change notification settings - Fork 539
fix: pass git SHA to Docker build so /v returns actual commit hash #3744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devin-ai-integration
wants to merge
1
commit into
main
Choose a base branch
from
devin/1770557674-fix-ai-version-endpoint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 VERGEN_GIT_SHA in ENV before cargo chef cook invalidates dependency cache on every deploy
Setting
VERGEN_GIT_SHA=${GIT_SHA}in theENVinstruction at line 24 causes Docker layer cache invalidation for all subsequent layers, including thecargo chef cookstep (lines 27-30). SinceGIT_SHAchanges on every single deploy, the dependency compilation cache is busted every time, defeating the purpose of cargo-chef.Root Cause and Impact
Docker layer caching works by checking if each instruction and its inputs are identical to a previous build. The
ENVinstruction at lines 21-24 includesVERGEN_GIT_SHA=${GIT_SHA}, which changes with every commit. This means every layer after line 24 is rebuilt from scratch, including:cargo chef cook(dependency compilation — the most expensive step)cargo build(application compilation)The whole point of the cargo-chef pattern is to separate dependency compilation from application compilation so dependencies are cached. This change negates that benefit.
The
VERGEN_GIT_SHAenv var is only needed duringcargo build(line 38), not duringcargo chef cook. The fix is to move theVERGEN_GIT_SHAenv var to after thecargo chef cookstep, e.g., by splitting theENVinstruction or adding a separateENV VERGEN_GIT_SHA=${GIT_SHA}after line 30.Note:
APP_VERSIONhas the same pre-existing issue, but it changes less frequently (only on version bumps), whereasGIT_SHAchanges on every deploy.Impact: Every deploy will recompile all dependencies from scratch (layer cache miss), significantly increasing build times (potentially 10-30+ minutes of unnecessary compilation on each deploy).
Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.