Skip to content

Commit

Permalink
refactor(circleci-plugin): use BuildQueryParamsWithPageToken func whe…
Browse files Browse the repository at this point in the history
…n collecting unfinished job details
  • Loading branch information
Nickcw6 committed Sep 18, 2024
1 parent f27c4ad commit 93f1170
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions backend/plugins/circleci/tasks/job_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package tasks

import (
"encoding/json"
"net/url"
"reflect"
"time"

Expand Down Expand Up @@ -89,14 +88,8 @@ func CollectJobs(taskCtx plugin.SubTaskContext) errors.Error {
},
CollectUnfinishedDetails: &api.FinalizableApiCollectorDetailArgs{
FinalizableApiCollectorCommonArgs: api.FinalizableApiCollectorCommonArgs{
UrlTemplate: "/v2/workflow/{{ .Input.Id }}/job", // The individual job endpoint has different fields so need to recollect all jobs for a workflow
Query: func(reqData *api.RequestData, _ *time.Time) (url.Values, errors.Error) {
query := url.Values{}
if pageToken, ok := reqData.CustomData.(string); ok && pageToken != "" {
query.Set("page-token", pageToken)
}
return query, nil
},
UrlTemplate: "/v2/workflow/{{ .Input.Id }}/job", // The individual job endpoint has different fields so need to recollect all jobs for a workflow
Query: BuildQueryParamsWithPageToken,
ResponseParser: ParseCircleciPageTokenResp,
AfterResponse: ignoreDeletedBuilds,
},
Expand Down

0 comments on commit 93f1170

Please sign in to comment.