-
Notifications
You must be signed in to change notification settings - Fork 168
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
Conversation
plugins/pipelines/listBuilds.js
Outdated
if (request.query.page || request.query.count) { | ||
config.paginate = { | ||
page: request.query.page, | ||
count: request.query.count | ||
}; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
plugins/pipelines/README.md
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
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 ongroupEventId
.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.