Skip to content

Force LF line endings repo-wide via .gitattributes to fix Docker build - #5310

Merged
rajithacharith merged 1 commit into
thunder-id:mainfrom
samadhisakunika:fix/docker-build-windows-line-endings
Sep 7, 2026
Merged

rajithacharith merged 1 commit into
thunder-id:mainfrom
samadhisakunika:fix/docker-build-windows-line-endings

Conversation

@samadhisakunika

@samadhisakunika samadhisakunika commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Purpose

On Windows, git clone/checkout with the common core.autocrlf=true setting silently converts tracked text files to CRLF line endings. Two concrete build failures result when running docker build / podman build from such a checkout:

  1. build.sh gets a #!/bin/bash\r shebang, so the Linux container reports ./build.sh: not found (exit 127) even though the file exists.
  2. version.txt picks up a trailing \r, which leaks into $VERSION when read via cat, corrupting the generated distribution zip's internal file paths during packaging (zip warning: name not matched: ...).

This adds a .gitattributes file that forces LF line endings for all text files on checkout, regardless of the contributor's local core.autocrlf setting, 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=auto preserves 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 build fails at both points described above; after, .gitattributes forces 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

  • N/A

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
    • Ran Vale and fixed all errors and warnings
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • Chores
    • Standardized text files to use LF line endings, improving consistency across environments and preventing line-ending-related build issues.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: d3f47786-5ec6-481e-b6a2-256b73344869

📥 Commits

Reviewing files that changed from the base of the PR and between 26d6971 and 8baeaf9.

📒 Files selected for processing (1)
  • .gitattributes

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The pull request adds a .gitattributes file. Git detects text files automatically and checks them out with LF line endings.

Changes

Line Ending Configuration

Layer / File(s) Summary
Configure text file line endings
.gitattributes
Git now uses text=auto eol=lf for all files. Comments document the Linux-container build issue caused by CRLF line endings.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 8baea

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)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: enforcing LF line endings with .gitattributes to fix Docker builds.
Description check ✅ Passed The description includes all required sections, explains the problem and implementation, documents verification, and records checklist and security status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

…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>
@samadhisakunika
samadhisakunika force-pushed the fix/docker-build-windows-line-endings branch from 8baeaf9 to 39cc006 Compare September 7, 2026 10:02
@rajithacharith rajithacharith added skip-changelog Skip generating changelog for a particular PR trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes labels Sep 7, 2026
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@rajithacharith
rajithacharith added this pull request to the merge queue Sep 7, 2026
Merged via the queue into thunder-id:main with commit 87855f2 Sep 7, 2026
79 of 81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Skip generating changelog for a particular PR trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants