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

Compare versions by name and version number with the nomad history command #23889

Open
wants to merge 19 commits into
base: 23846-nomad-job-tag-cli-command-scaffolding
Choose a base branch
from

Conversation

philrenaud
Copy link
Contributor

@philrenaud philrenaud commented Aug 28, 2024

  • Adds diff_tag and diff_version flags for the nomad job versions API endpoint, and for the nomad job plan and nomad job history commands.

  • Adds Tag info to nomad job history output

Usage:

(Prerequisite tag a version of your job with nomad job tag apply, per #23863)

### Diff against a specific tag

nomad job plan -diff-tag=my-tag-name difftester.nomad.hcl

N.B.: Decided against this, as plan implies "looking to change things against currently-running. To implement later: nomad job diff CLI command.

### Diff against a specific version, whether tagged or not

nomad job plan -diff-version=2 difftester.nomad.hcl

N.B.: Decided against this, as plan implies "looking to change things against currently-running. To implement later: nomad job diff CLI command.

See history including tag info, with diffs

(each version will show a diff to its predecessor, except for version 0 / first non-GC'd version, which has no known predecessor)

nomad job history -p difftester

See history with diffs against a specific tag

nomad job history -p -diff-tag=my-tag-name difftester

See history with diffs against a specific version, whether tagged or not

nomad job history -p -diff-version=2 difftester

Resolves #23879

@philrenaud philrenaud self-assigned this Aug 28, 2024
api/jobs.go Outdated Show resolved Hide resolved
api/jobs.go Outdated Show resolved Hide resolved
command/job_history.go Outdated Show resolved Hide resolved
command/job_history.go Outdated Show resolved Hide resolved
command/job_history.go Outdated Show resolved Hide resolved
nomad/job_endpoint.go Outdated Show resolved Hide resolved
nomad/job_endpoint.go Outdated Show resolved Hide resolved
nomad/structs/structs.go Outdated Show resolved Hide resolved
nomad/job_endpoint.go Outdated Show resolved Hide resolved
nomad/job_endpoint.go Outdated Show resolved Hide resolved
nomad/job_endpoint.go Outdated Show resolved Hide resolved
api/jobs.go Outdated Show resolved Hide resolved
command/job_history.go Outdated Show resolved Hide resolved
command/job_history.go Outdated Show resolved Hide resolved
nomad/job_endpoint.go Outdated Show resolved Hide resolved
nomad/job_endpoint.go Outdated Show resolved Hide resolved
… eye toward making them a new top-level CLI command soon
nomad/job_endpoint.go Outdated Show resolved Hide resolved
@philrenaud philrenaud changed the title Compare versions by name with nomad plan and nomad history Compare versions by name and version number with the nomad history command Sep 9, 2024
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 left some suggestions to improve the tests but nothing blocking once you've got those resolved.

command/job_history_test.go Outdated Show resolved Hide resolved
command/job_history_test.go Outdated Show resolved Hide resolved
command/job_history_test.go Outdated Show resolved Hide resolved
command/job_history_test.go Outdated Show resolved Hide resolved
command/job_history_test.go Outdated Show resolved Hide resolved
command/job_history_test.go Outdated Show resolved Hide resolved
command/job_history_test.go Show resolved Hide resolved
@aimeeu
Copy link
Contributor

aimeeu commented Sep 19, 2024

@philrenaud I added the theme/golden-versions tag so I don't lose track of this when creating the new feature docs.

@philrenaud philrenaud force-pushed the 23846-nomad-job-tag-cli-command-scaffolding branch from 21ec042 to 7568f47 Compare September 20, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/golden-versions Tagging and preserving job versions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants