Skip to content

Commit

Permalink
Simplify job.IsPack declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Jul 19, 2024
1 parent 4dfdf2f commit ed028f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/23404.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: added a Pack badge to the jobs index page for jobs run via Nomad Pack
```
14 changes: 2 additions & 12 deletions nomad/job_endpoint_statuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package nomad
import (
"errors"
"net/http"
"strings"
"time"

"github.com/armon/go-metrics"
Expand Down Expand Up @@ -199,16 +198,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,
Expand All @@ -230,9 +219,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 {
Expand Down
1 change: 0 additions & 1 deletion ui/app/routes/jobs/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default class JobRoute extends Route.extend(WithWatchers) {
const relatedModelsQueries = [
job.get('allocations'),
job.get('evaluations'),
// this.store.query('job', { namespace, meta: true }), // TODO: I think I am probably nuking the ability to get meta:pack info here. See https://github.com/hashicorp/nomad/pull/14833
this.store.findAll('namespace'),
];

Expand Down

0 comments on commit ed028f0

Please sign in to comment.