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

nomad fmt -check flag doesn't return error code #15740

Closed
WebLeash opened this issue Jan 10, 2023 · 2 comments · Fixed by #15797
Closed

nomad fmt -check flag doesn't return error code #15740

WebLeash opened this issue Jan 10, 2023 · 2 comments · Fixed by #15797

Comments

@WebLeash
Copy link

WebLeash commented Jan 10, 2023

I'm using nomad verision v1.4.2
$ nomad --version
Nomad v1.4.2 (039d70e)

https://developer.hashicorp.com/nomad/docs/commands/fmt#check
The documentation says it will not change and return value 1.
Observing the behaviour this doesn't look to be working.

I want to fail our CI process if the nomad fmt command detects any issue with the source file (HCL).

Currently the output of the $ nomad fmt -check command lists the file in the output and returns 0 value to the shell if issues with formatting detected.

$ nomad fmt -check http.nomad
http.nomad
$ echo $?
0

@WebLeash WebLeash changed the title nomad fmt command behaviour not doing as the Documents presribe nomad fmt command behaviour not doing as the Documents prescribes Jan 10, 2023
@tgross
Copy link
Member

tgross commented Jan 10, 2023

Hi @WebLeash! Yup, I just checked the source and we're completely ignoring that argument. Embarrassing for me because I reviewed that PR #14779 😊

I'm going to reword the title a bit here and mark this as a bug to get fixed. We'd also be happy to review a patch if you want to have a go at one.

@tgross tgross added this to Needs Triage in Nomad - Community Issues Triage via automation Jan 10, 2023
@tgross tgross changed the title nomad fmt command behaviour not doing as the Documents prescribes nomad fmt -check flag doesn't return error code Jan 10, 2023
@tgross tgross moved this from Needs Triage to Needs Roadmapping in Nomad - Community Issues Triage Jan 10, 2023
@dttung2905
Copy link
Contributor

Hi @tgross I can help with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants