Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add pipelines/id/builds endpoint [2] #3070

Merged
merged 9 commits into from
Apr 3, 2024
Merged

feat: Add pipelines/id/builds endpoint [2] #3070

merged 9 commits into from
Apr 3, 2024

Conversation

tkyi
Copy link
Member

@tkyi tkyi commented Mar 26, 2024

Context

Currently a lot of calls are being made on the PR tab page in the UI to:

  • GET /pipelines/:id/events?count=1&page=1&prNum=prNum
  • GET /jobs/:id/builds?count=10&page=1
  • GET /events/:id/builds

It would be nice if we could simplify these calls to get only latest builds in a PR and make fewer calls to the API.

Objective

This PR adds an endpoint GET /pipelines/:id/builds?groupEventId=id&latest=true to get latest builds for a pipeline based on groupEventId.

References

Blocked by: screwdriver-cd/models#619

License

I confirm that this contribution is made under a BSD license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@coveralls
Copy link

coveralls commented Mar 26, 2024

Coverage Status

coverage: 95.262% (+0.03%) from 95.23%
when pulling 8dfefa9 on groupEventBuilds
into 58053d3 on master.

Comment on lines 34 to 39
if (request.query.page || request.query.count) {
config.paginate = {
page: request.query.page,
count: request.query.count
};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a default config.paginate in the case that client never specifically mention about pagination? This is related to my comment on the models PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put the default paginate in models

@@ -107,10 +107,10 @@ Only PR events of specified PR number will be searched when `prNum` is set
`GET /pipelines/{id}/events?page={pageNumber}&count={countNumber}&sort={sort}&prNum={prNumber}`

#### Get all pipeline builds
`page`, `count`, `sort`, `latest`, and `groupEventId` are optional
`page`, `count`, `sort`, `latest`, `sortBy`, `fetchSteps`, `readOnly`, and `groupEventId` are optional
When `latest=true` and `groupEventId` is set, only latest builds in a pipeline based on groupEventId will be returned. `latest` and `groupEventId` must be set together
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When `latest=true` and `groupEventId` is set, only latest builds in a pipeline based on groupEventId will be returned. `latest` and `groupEventId` must be set together
When `latest=true` and `groupEventId` is set, only latest builds in a pipeline based on groupEventId will be returned. The `latest` parameter must be used in conjunction with the `groupEventId`.

When `latest=true` and `groupEventId` is set, only latest builds in a pipeline based on groupEventId will be returned. `latest` and `groupEventId` must be set together

`GET /pipelines/{id}/builds?page={pageNumber}&count={countNumber}&sort={sort}&latest=true&groupEventId={groupEventId}`
`GET /pipelines/{id}/builds?page={pageNumber}&count={countNumber}&sort={sort}&latest=true&groupEventId={groupEventId}&sortBy={sortBy}&fetchSteps=false&readOnly=false`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetchSteps=false will omit steps in the build response? This might be param that we can use to filter out the steps field in the build response.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

VonnyJap
VonnyJap previously approved these changes Mar 29, 2024
@tkyi tkyi merged commit b9ed3f4 into master Apr 3, 2024
2 checks passed
@tkyi tkyi deleted the groupEventBuilds branch April 3, 2024 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants