Q: Half of your engineering team works on Windows laptops and half on macOS. Your shell scripts in CI keep failing on Windows runners because of line ending issues (`\r\n` vs `\n`) and path separator differences. How do you make your CI pipelines platform-agnostic?
Root cause: Windows uses CRLF (\r\n) line endings; Linux/macOS use LF (\n). Shell scripts with \r characters fail silently or with crypti...
#CI/CD #๐ Supply Chain Security & Advanced CI/CD #L2 #DevOps #Automation #Pipelines
๐๏ธ Candidate Opening & Architectural Context
""When developers encounter this build or release bottleneck, my first goal is unblocking velocity safely. The interviewer is testing: Cross-platform CI, `.gitattributes`, containerised CI builds.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
๐ ๏ธ Production Runbook & Step-by-Step Resolution
1๏ธโฃ
Initial Diagnostics & Root Cause Analysis
Root cause: Windows uses CRLF (\r\n) line endings; Linux/macOS use LF (\n). Shell scripts with \r characters fail silently or with cryptic errors on Linux runners.
.gitattributesnormalisation: Add*.sh text eol=lfand*.bat text eol=crlfto force correct line endings in the repo regardless of developer OS.- Containerise the CI build: Run all CI jobs inside a Linux Docker container (
runs-on: ubuntu-latestwith a Docker executor). Windows developers run the same container locally via Docker Desktop. The environment is identical everywhere. - Replace shell scripts with Python or a task runner (Makefile / Taskfile): Python handles path separators with
pathlib.Pathnatively. Taskfile (go-task) has explicit cross-platform task definitions.
2๏ธโฃ
Remediation & Permanent Safeguards
Solutions (layered):
- Use
#!/usr/bin/env bashconsistently and validate scripts withshellcheckin CI to catch portability issues.
๐ก The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: .gitattributes normalisation: Add *.sh text eol=lf and *.bat text eol=crlf to force correct line endings in the repo regardless of."
โก 60-Second Elevator Pitch Talking Points
- .gitattributes normalisation: Add *.sh text eol=lf and *.bat text eol=crlf to force correct line ...
- Containerise the CI build: Run all CI jobs inside a Linux Docker container (runs-on: ubuntu-lates...
- Replace shell scripts with Python or a task runner (Makefile / Taskfile): Python handles path sep...
Advertisement