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

-json option on jobs status command #18925

Merged
merged 10 commits into from
Mar 8, 2024

Conversation

geovannyAvelar
Copy link
Contributor

#16566

This modification dumps the entire job struct in JSON format. I don't know if just dumps the entire struct is the better approach, if not, i can expose specific fields.

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @geovannyAvelar! I know this is still in draft but just a heads up that the approach you've got here is essentially what the existing nomad job inspect does. The goal described in #16566 is to have the whole command's output in some JSON-structured way, which includes a lot of ancillary information like the allocations, deployments, etc.

@geovannyAvelar
Copy link
Contributor Author

Hello @tgross! I made some changes. Now when -json option is included in nomad job status command, we output same data of nomad job status command (evals, allocations, latest deployment and summary). Please let me know if I need to change or include something. Do I need to include something different when handling periodic or parameterized jobs?

command/job_status.go Outdated Show resolved Hide resolved
command/job_status.go Show resolved Hide resolved
command/job_status.go Outdated Show resolved Hide resolved
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great @geovannyAvelar. To get this merged:

  • Run make cl to add a changelog entry
  • Add documentation for the new command flag in website/content/docs/commands/job/status.mdx
  • Mark the PR as ready-for-review

command/job_status.go Outdated Show resolved Hide resolved
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I've made a minor adjustment to the changelog entry. Once CI is green I'll get this merged for the next 1.7.x release. Thanks @geovannyAvelar!

@tgross
Copy link
Member

tgross commented Mar 8, 2024

Bah, sorry @geovannyAvelar, it looks like I led you astray with the structs package, as we have a linter than prevents that import (see #13938, which I approved 🤦 ). I've fixed that up for you.

@tgross tgross merged commit 26a27bb into hashicorp:main Mar 8, 2024
19 of 20 checks passed
tgross added a commit that referenced this pull request Sep 24, 2024
In #18925 we added a `-json` flag to the `job status` command, but the argument
handling had a bug where it would always set the `-json` flag if either the `-t`
or `-json` flags were set, resulting in a misleading error. Instead, pass the
`-json` flag value into the formatter.

Fixes: #24050
tgross added a commit that referenced this pull request Sep 25, 2024
In #18925 we added a `-json` flag to the `job status` command, but the argument
handling had a bug where it would always set the `-json` flag if either the `-t`
or `-json` flags were set, resulting in a misleading error. Instead, pass the
`-json` flag value into the formatter.

Fixes: #24050
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Development

Successfully merging this pull request may close these issues.

2 participants