circleci-queue icon indicating copy to clipboard operation
circleci-queue copied to clipboard

[semver:minor] Reduce payload from CircleCI recent-builds API to improve performance

Open kelvintaywl opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

Some users noted the Recent Builds for project API returning HTTP 400 at times (intermittent).

I noted the CircleCI V1 API is used: https://circleci.com/docs/api/v1/index.html#recent-builds-for-a-single-project

Additionally, the shallow=true query parameter is recommended to reduce the returned payload, and possibly improve performance and reliability of the API response.

I noted from the Orb command's script that we are really only checking the following attributes from this API's response:

Attribute Evidence
.build_num https://github.com/eddiewebb/circleci-queue/blob/988b09bac5b704500039dc08ce50e7645a5a5657/src/commands/until_front_of_line.yml#L131
.vcs_tag https://github.com/eddiewebb/circleci-queue/blob/988b09bac5b704500039dc08ce50e7645a5a5657/src/commands/until_front_of_line.yml#L131
.workflow.workflow_id https://github.com/eddiewebb/circleci-queue/blob/988b09bac5b704500039dc08ce50e7645a5a5657/src/commands/until_front_of_line.yml#L140

Additionally, I can confirm the .build_num, .vcs_tag and .workflow.workflow_id attributes are returned even when shallow=true. For example: https://circleci.com/api/v1.1/project/github/kelvintaywl/whale-of-a-time?shallow=true

As such, I think we can leverage the shallow=true query parameter for this Orb indeed. Hopefully, this can reduce or alleviate the randomly-intermittent HTTP 400 from CircleCI too? If anything, it should help to improve the performance of the script 🙏

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

kelvintaywl avatar Mar 31 '23 03:03 kelvintaywl

THanks for great detail @kelvintaywl , I am in support of the shallow clone.

eddiewebb avatar Mar 31 '23 16:03 eddiewebb