api-services-portal icon indicating copy to clipboard operation
api-services-portal copied to clipboard

Ensure proper end of line parsing on Windows

Open rustyjux opened this issue 1 year ago • 0 comments

API Services Portal Issue

User Story

As a dev/collaborator using Windows I want to be able to locally deploy the Portal (reliably) so that I can test and contribute code.

Notes

This issue also applies to gwa-api.

While trying to deploy the Portal locally, I was blocked by some odd errors on docker-compose up no one could quickly resolve. After some digging, I discovered this has to do with end of line sequence encoding (CRLF, the default on Windows, when it needed to be LF for shell script).

Each of the following options worked (independently) to fix/avoid this issue:

  • first changing EOL setting in VSCode, resaving shell files (not great route, finicky, didn't fix gwa-api)
  • adding instructions to use --config core.autocrlf=input, when cloning ie git clone https://github.com/bcgov/gwa-api.git --config core.autocrlf=input. I don't totally understand how this works and what the implications are for being able to edit and commit changes.
  • run git clone (without extra options) from within WSL

We could do a little more testing and add notes re: autocrlf to the deployment docs, but apparently the best approach is to add a .gitattributes file such as this template file.

Sounds like I might not be the first person to have hit this problem.

rustyjux avatar Feb 02 '24 01:02 rustyjux