diff --git a/.changelog/14424.txt b/.changelog/14424.txt new file mode 100644 index 000000000..2b93a0390 --- /dev/null +++ b/.changelog/14424.txt @@ -0,0 +1,3 @@ +```release-note:bug +cli: Ignore Vault token when generating job diff. +``` diff --git a/nomad/structs/diff.go b/nomad/structs/diff.go index 77f511f71..fab52060f 100644 --- a/nomad/structs/diff.go +++ b/nomad/structs/diff.go @@ -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 diff --git a/nomad/structs/diff_test.go b/nomad/structs/diff_test.go index 6eca9ab99..467d1f6f1 100644 --- a/nomad/structs/diff_test.go +++ b/nomad/structs/diff_test.go @@ -1176,7 +1176,6 @@ func TestJobDiff(t *testing.T) { }, }, }, - { // Multiregion: region added Old: &Job{ @@ -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 {