Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate/generate command fails when spec file is created with CRLF on windows #406

Open
ishantanu opened this issue Oct 17, 2022 · 1 comment · May be fixed by #533
Open

validate/generate command fails when spec file is created with CRLF on windows #406

ishantanu opened this issue Oct 17, 2022 · 1 comment · May be fixed by #533
Labels
bug Something isn't working Rules

Comments

@ishantanu
Copy link

Hello,

I was testing adding new plugins to sloth and I saw that sloth validate command fails when the Sloth spec is created with CRLF.

The error message doesn't mention any of this. However, when I copied an existing spec and edited the plugin id, it worked. Similarly, when I created a test.yml file with LF, the validate as well as generate command worked.

Example:

File created using default CRLF:

$ sloth validate -p plugins/ -i test/integration/ --debug
DEBU[0000] Debug level is enabled                        version=v0.10.0
DEBU[0000] SLI plugin loaded                             plugin-id=sloth-common/kubernetes/kooper/availability plugin-path="plugins\\kubernetes\\kooper\\availability\\plugin.go" svc=storage.FileSLIPlugin version=v0.10.0 window=30d
DEBU[0000] SLI plugin loaded                             plugin-id=sloth-common/kubernetes/kooper/latency plugin-path="plugins\\kubernetes\\kooper\\latency\\plugin.go" svc=storage.FileSLIPlugin version=v0.10.0 window=30d
DEBU[0000] SLI plugin loaded                             plugin-id=sloth-common/test1 plugin-path="plugins\\test1\\plugin.go" svc=storage.FileSLIPlugin version=v0.10.0 window=30d
...
INFO[0000] SLI plugins loaded                            plugins=20 svc=storage.FileSLIPlugin version=v0.10.0 window=30d
INFO[0000] SLO period windows loaded                     svc=alert.WindowsRepo version=v0.10.0 window=30d windows=2
DEBU[0000] File validated                                file="test\\integration\\coredns-availability.yml" version=v0.10.0 window=30d
...
DEBU[0000] File validated                                file="test\\integration\\slok-go-http-metrics-availability.yml" version=v0.10.0 window=30d
DEBU[0000] File validated                                file="test\\integration\\slok-go-http-metrics-latency.yml" version=v0.10.0 window=30d
DEBU[0000] File validated                                file="test\\integration\\test.yml" version=v0.10.0 window=30d
ERRO[0000] Unknown spec type                             file="test\\integration\\test.yml" version=v0.10.0 window=30d
...
DEBU[0000] File validated                                file="test\\integration\\traefik-v2-availability.yml" version=v0.10.0 window=30d
DEBU[0000] File validated                                file="test\\integration\\traefik-v2-latency.yml" version=v0.10.0 window=30d

File created using LF:

$ sloth validate -p plugins/ -i test/integration/ --debug
DEBU[0000] Debug level is enabled                        version=v0.10.0
DEBU[0000] SLI plugin loaded                             plugin-id=sloth-common/slok-go-http-metrics/latency plugin-path="plugins\\slok-go-http-metrics\\latency\\plugin.go" svc=storage.FileSLIPlugin version=v0.10.0 window=30d
...
DEBU[0000] SLI plugin loaded                             plugin-id=sloth-common/test1 plugin-path="plugins\\test1\\plugin.go" svc=storage.FileSLIPlugin version=v0.10.0 window=30d
...
DEBU[0000] SLI plugin loaded                             plugin-id=sloth-common/prometheus/rules/eval-availability plugin-path="plugins\\prometheus\\rules\\evalavailability\\plugin.go" svc=storage.FileSLIPlugin version=v0.10.0 window=30d
INFO[0000] SLI plugins loaded                            plugins=20 svc=storage.FileSLIPlugin version=v0.10.0 window=30d
INFO[0000] SLO period windows loaded                     svc=alert.WindowsRepo version=v0.10.0 window=30d windows=2
DEBU[0000] File validated                                file="test\\integration\\coredns-availability.yml" version=v0.10.0 window=30d
...
DEBU[0000] File validated                                file="test\\integration\\slok-go-http-metrics-latency.yml" version=v0.10.0 window=30d
DEBU[0000] File validated                                file="test\\integration\\test.yml" version=v0.10.0 window=30d
DEBU[0000] File validated                                file="test\\integration\\test1.yml" version=v0.10.0 window=30d
...
DEBU[0000] File validated                                file="test\\integration\\traefik-v2-latency.yml" version=v0.10.0 window=30d
INFO[0000] Validation succeeded                          slo-specs=21 version=v0.10.0 window=30d

@corentinaltepe
Copy link

I confirm having the same issue when building on Windows with a Docker container running Sloth. Converting the .yml file to LF instead of the default CRLF fixed the error but it was definitely not obvious to find the right fix.

@slok slok added bug Something isn't working Rules labels Oct 23, 2022
@TheYkk TheYkk linked a pull request Feb 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants