Force LF line endings repo-wide via .gitattributes to fix Docker build - #5310
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe pull request adds a ChangesLine Ending Configuration
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to Text files will check out with LF line endings, preventing Windows CRLF checkout issues in Linux container builds. The change is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
…ds on Windows Windows checkouts with the default core.autocrlf=true corrupt build.sh and version.txt to CRLF, breaking the Docker build: build.sh fails to execute, and a stray carriage return leaking into the version string corrupts the packaged zip's file paths. Signed-off-by: samadhisakunika <samadhisakunika@gmail.com>
8baeaf9 to
39cc006
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Purpose
On Windows,
git clone/checkoutwith the commoncore.autocrlf=truesetting silently converts tracked text files to CRLF line endings. Two concrete build failures result when runningdocker build/podman buildfrom such a checkout:build.shgets a#!/bin/bash\rshebang, so the Linux container reports./build.sh: not found(exit 127) even though the file exists.version.txtpicks up a trailing\r, which leaks into$VERSIONwhen read viacat, corrupting the generated distribution zip's internal file paths during packaging (zip warning: name not matched: ...).This adds a
.gitattributesfile that forces LF line endings for all text files on checkout, regardless of the contributor's localcore.autocrlfsetting, so a fresh Windows clone builds successfully with no manual git configuration.Approach
Uses a single blanket rule,
* text=auto eol=lf, rather than listing individual filenames or extensions.text=autopreserves git's normal binary-detection heuristic (null-byte scan), so actual binary assets are left untouched; only files git already treats as text get their line endings normalized. This covers every script and data file the build reads (build.sh,version.txt,start.sh,setup.sh,backend/scripts/init_script.sh,backend/scripts/cleanup_runtime_transient_db.sh,Makefile,Dockerfile, etc.) without needing to enumerate them individually or maintain the list as new scripts are added.Verified against a clean Windows checkout with
core.autocrlf=true(the default): before this change,podman buildfails at both points described above; after,.gitattributesforces LF regardless of the local autocrlf setting and the image builds and tags successfully from a fully cold cache (no cached layers, no pulled base images).Related Issues
Related PRs
Checklist
breaking changelabel added.Security checks
Summary by CodeRabbit