Skip to content

CI: bump-deployments - refresh index before checking for changes - #691

Merged
ramonskie merged 1 commit into
mainfrom
fix-bump-deployments-stat-cache
Jul 31, 2026
Merged

CI: bump-deployments - refresh index before checking for changes#691
ramonskie merged 1 commit into
mainfrom
fix-bump-deployments-stat-cache

Conversation

@neddp

@neddp neddp commented Jul 31, 2026

Copy link
Copy Markdown
Member

Problem

The bump-deployments task fails with exit 1 even when the submodules are already pinned to the desired commits:

+ git diff-index --quiet HEAD
+ git commit -am 'Update deployments'
On branch bump-deployments-ci
nothing to commit, working tree clean

Root cause

The task rewrites deployment-versions.txt with echo > on every run. After Concourse's shallow clone (which resets file mtimes), the file content is byte-identical but its stat metadata differs from git's cached stat. git diff-index --quiet HEAD trusts the stale stat cache and reports the file as modified (blob SHA 0000000…), so the || git commit branch runs — but git commit refreshes the index internally, finds no real change, and exits 1, failing the task.
Isolate in: https://bosh.ci.cloudfoundry.org/builds/373771172

Fix

Run git update-index -q --refresh before the check. This re-hashes stat-dirty files and, when the content is unchanged, clears the dirty flag — so git diff-index --quiet gets an accurate answer and the commit is correctly skipped. A genuine submodule bump still commits normally.

Verified in: https://bosh.ci.cloudfoundry.org/builds/373773086

git diff-index reports stale stat cache entries as dirty after
Concourse's shallow clone resets file mtimes. Running
git update-index -q --refresh first syncs the stat cache so
diff-index gets an accurate read.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The deployment bump task now refreshes the Git index quietly before git diff-index checks for changes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: refreshing the Git index before checking for deployment changes.
Description check ✅ Passed The description explains the failure, root cause, fix, and verification, all of which directly relate to the changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-bump-deployments-stat-cache

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ramonskie

Copy link
Copy Markdown
Contributor

related to #691

@ramonskie
ramonskie merged commit c431775 into main Jul 31, 2026
7 of 8 checks passed
@neddp
neddp deleted the fix-bump-deployments-stat-cache branch July 31, 2026 13:22
@neddp neddp changed the title bump-deployments: refresh index before checking for changes CI: bump-deployments - refresh index before checking for changes Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants