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

cli: ignore VaultToken when generating job diff #14424

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/14424.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cli: Ignore Vault token when generating job diff.
```
2 changes: 1 addition & 1 deletion nomad/structs/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (j *Job) Diff(other *Job, contextual bool) (*JobDiff, error) {
diff := &JobDiff{Type: DiffTypeNone}
var oldPrimitiveFlat, newPrimitiveFlat map[string]string
filter := []string{"ID", "Status", "StatusDescription", "Version", "Stable", "CreateIndex",
"ModifyIndex", "JobModifyIndex", "Update", "SubmitTime", "NomadTokenID"}
"ModifyIndex", "JobModifyIndex", "Update", "SubmitTime", "NomadTokenID", "VaultToken"}

if j == nil && other == nil {
return diff, nil
Expand Down
16 changes: 15 additions & 1 deletion nomad/structs/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,6 @@ func TestJobDiff(t *testing.T) {
},
},
},

{
// Multiregion: region added
Old: &Job{
Expand Down Expand Up @@ -1321,6 +1320,21 @@ func TestJobDiff(t *testing.T) {
},
},
},
{
// VaultToken is filtered
Old: &Job{
ID: "vault-job",
VaultToken: "secret",
},
New: &Job{
ID: "vault-job",
VaultToken: "new-secret",
},
Expected: &JobDiff{
Type: DiffTypeNone,
ID: "vault-job",
},
},
}

for i, c := range cases {
Expand Down