Skip to content

Commit e826338

Browse files
committed
fix: update job.Runs function to include environment parameter
1 parent 2a14d1f commit e826338

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

internal/graph/jobs.resolvers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (r *jobResolver) Runs(ctx context.Context, obj *job.Job, first *int, after
5050
return nil, err
5151
}
5252

53-
return job.Runs(ctx, obj.TeamSlug, obj.Name, page)
53+
return job.Runs(ctx, obj.TeamSlug, obj.EnvironmentName, obj.Name, page)
5454
}
5555

5656
func (r *jobResolver) Manifest(ctx context.Context, obj *job.Job) (*job.JobManifest, error) {

internal/status/check_job_runs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func (c checkJobRuns) Run(ctx context.Context, w workload.Workload) ([]WorkloadS
2222

2323
func (checkJobRuns) run(ctx context.Context, w workload.Workload) WorkloadStatusError {
2424
page, _ := pagination.ParsePage(ptr.To(5), nil, nil, nil)
25-
runs, err := job.Runs(ctx, w.GetTeamSlug(), w.GetName(), page)
25+
runs, err := job.Runs(ctx, w.GetTeamSlug(), w.GetEnvironmentName(), w.GetName(), page)
2626
if err != nil {
2727
// TODO(chredvar): Unable to create label selector above, log?
2828
return &WorkloadStatusSynchronizationFailing{

internal/workload/job/queries.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,16 @@ func getJobRunInstanceByIdent(ctx context.Context, id ident.Ident) (*JobRunInsta
103103
return toGraphJobRunInstance(pod, env), nil
104104
}
105105

106-
func Runs(ctx context.Context, teamSlug slug.Slug, jobName string, page *pagination.Pagination) (*JobRunConnection, error) {
106+
func Runs(ctx context.Context, teamSlug slug.Slug, environment, jobName string, page *pagination.Pagination) (*JobRunConnection, error) {
107107
nameReq, err := labels.NewRequirement("app", selection.Equals, []string{jobName})
108108
if err != nil {
109109
return nil, err
110110
}
111111

112112
selector := labels.NewSelector().Add(*nameReq)
113113

114-
allRuns := fromContext(ctx).runWatcher.GetByNamespace(teamSlug.String(), watcher.WithLabels(selector))
114+
allRuns := fromContext(ctx).runWatcher.GetByNamespace(teamSlug.String(), watcher.InCluster(environment), watcher.WithLabels(selector))
115+
115116
ret := make([]*JobRun, len(allRuns))
116117
for i, run := range allRuns {
117118
ret[i] = toGraphJobRun(run.Obj, run.Cluster)

0 commit comments

Comments
 (0)