From 4d4a1cbe45c3689d23f00d2a628084cd3b7183dd Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Wed, 26 Jun 2024 13:50:49 -0400 Subject: [PATCH] Simplify job.IsPack declaration --- .changelog/23404.txt | 3 +++ nomad/job_endpoint_statuses.go | 14 ++------------ 2 files changed, 5 insertions(+), 12 deletions(-) create mode 100644 .changelog/23404.txt diff --git a/.changelog/23404.txt b/.changelog/23404.txt new file mode 100644 index 00000000000..38a15c77521 --- /dev/null +++ b/.changelog/23404.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: added a Pack badge to the jobs index page for jobs run via Nomad Pack +``` diff --git a/nomad/job_endpoint_statuses.go b/nomad/job_endpoint_statuses.go index e83f0e4d946..2c797a83851 100644 --- a/nomad/job_endpoint_statuses.go +++ b/nomad/job_endpoint_statuses.go @@ -6,7 +6,6 @@ package nomad import ( "errors" "net/http" - "strings" "time" "github.com/armon/go-metrics" @@ -201,16 +200,6 @@ func (j *Job) Statuses( func jobStatusesJobFromJob(ws memdb.WatchSet, store *state.StateStore, job *structs.Job) (structs.JobStatusesJob, uint64, error) { highestIdx := job.ModifyIndex - isPack := false - if job.Meta != nil { - for key, value := range job.Meta { - if strings.HasPrefix(key, "pack") && value != "" { - isPack = true - break - } - } - } - jsj := structs.JobStatusesJob{ NamespacedID: structs.NamespacedID{ ID: job.ID, @@ -232,9 +221,10 @@ func jobStatusesJobFromJob(ws memdb.WatchSet, store *state.StateStore, job *stru LatestDeployment: nil, Stop: job.Stop, Status: job.Status, - IsPack: isPack, } + _, jsj.IsPack = job.Meta["pack.name"] + // the GroupCountSum will map to how many allocations we expect to run // (for service jobs) for _, tg := range job.TaskGroups {