-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: Add nomad fmt #14779
feat: Add nomad fmt #14779
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Trojan295! This is great!
I've left some comments that can tighten this up and make it more consistent with both terraform fmt
and the rest of the Nomad code base. Two more things:
- You can add a changelog file. You'll make that at
.changelog/14779.txt
and it'll look like https://github.com/hashicorp/nomad/blob/main/.changelog/14742.txt. - There's documentation at ./website/content/docs/commands. You can take a crack at mimicking the files in the top of that directory, but if that's too overwhelming just let me know and I can knock that out pretty quickly once this is ready to merge.
Thanks again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great @Trojan295! Just a few last items to fix up and we'll be able to land this one.
command/testdata/fmt/job.out.hcl
Outdated
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix the newlines at the end of these files.
Thanks @tgross for the review! I will update this PR tomorrow. :) |
I pushed the changes. Instead of putting the testdata files as |
a89fcbd
to
b4eada2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @Trojan295! Thanks for sticking with it, I know PRs for new commands can feel like a whole lot of nitpicking 😀
CircleCI seems to have gotten confused about the PR and can't run the build. So I just rebased this branch on main
to get that moving again. Once that finishes, we can get this merged. (I'll probably have to do that tomorrow morning, as I'm close to end-of-day here.) Done
@Trojan295 this has been merged and a backport bot will merge it to the 1.4.x release branch for the next patch release of Nomad . If that bot can't figure things out and requests a review from you, don't worry about it and I'll fix it in the morning; it's one of those fiddly process things we try not to expose to contributors but the bot is working thru a bit of a queue at the moment and I won't be there to immediately catch it. 😀 |
Wasn't so bad :). I just had a though, that it would be nice, if some of those docs/CLI help could be generated. E.g. we have the help in |
Yes! I know a few folks have been tinkering around with better CLI generation internally for that reason. |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR adds the
nomad fmt
command, which can be used to format and check Nomad configuration and jobspec files.It formats the files according to the HCL syntax using hashicorp/hcl. It does not validate, if the files are correct Nomad or Jobspec files.
Closes #11757