Page MenuHomePhabricator

[builds-api] refactor build start response type
Closed, ResolvedPublic

Description

with this we can notify a user when they are about to use up their quota.

Another alternative is to make a second request to the quota endpoint.

Details

TitleReferenceAuthorSource BranchDest Branch
d/changelog: bump to 0.0.13repos/cloud/toolforge/builds-cli!56raymond-ndibebump_versionmain
builds-api: bump to 0.0.126-20240212140328-9308d684repos/cloud/toolforge/toolforge-deploy!195project_1317_bot_df3177307bed93c3f34e421e26c86e38bump_builds-apimain
[builds-cli] refactor build start response typerepos/cloud/toolforge/builds-cli!55raymond-ndiberefactor_build_start_response_typemain
[builds-api] refactor build_start response typerepos/cloud/toolforge/builds-api!75raymond-ndiberefactor_start_responsemain
[builds-api] merge BuildStartParams and NewBuild_parametersrepos/cloud/toolforge/builds-api!74raymond-ndibemerge_newbuild_parameters_and_buildstartparamsmain
Customize query in GitLab

Event Timeline

@dcaro what's your opinion? anyone is fine by me

Can you elaborate?

What is the workflow that you imagine to alert users?

I'm guessing something like show a warning message when starting a new build?

If so, then probably the return value of Start is a good place yes, I think that could be useful for API users too, maybe we can add also the criteria for the warning to the API, instead of having it on the cli, as in return generic warnings or similar, so instead of adding stuff to NewBuild, we can add an object StartResponse, that inside has NewBuild and something else with the info, like:

StartResponse:
  type: object
  properties:
    messages:
      $ref: "#/components/schemas/ResponseMessages"
    new_build:
      $ref: "#/components/schemas/NewBuild"
ResponseMessages:
  type: object
  properties:
    warnings:
      type: array
      items:
        type: string
    errors:
      type: array
      items:
        type: string
    infos:
      type: array
      items:
        type: string

We could skip infos and errors for now until needed, but the idea would be that the client would not need to decide if something is a warning anymore, and just show the warnings (that would help for any/all the API calls btw.)

Can you elaborate?

What is the workflow that you imagine to alert users?

I'm guessing something like show a warning message when starting a new build?

If so, then probably the return value of Start is a good place yes, I think that could be useful for API users too, maybe we can add also the criteria for the warning to the API, instead of having it on the cli, as in return generic warnings or similar, so instead of adding stuff to NewBuild, we can add an object StartResponse, that inside has NewBuild and something else with the info, like:

StartResponse:
  type: object
  properties:
    messages:
      $ref: "#/components/schemas/ResponseMessages"
    new_build:
      $ref: "#/components/schemas/NewBuild"
ResponseMessages:
  type: object
  properties:
    warnings:
      type: array
      items:
        type: string
    errors:
      type: array
      items:
        type: string
    infos:
      type: array
      items:
        type: string

We could skip infos and errors for now until needed, but the idea would be that the client would not need to decide if something is a warning anymore, and just show the warnings (that would help for any/all the API calls btw.)

thanks @dcaro this is better since it can be reused if there is ever a need to use it elsewhere

Raymond_Ndibe renamed this task from [builds-api] add quota information to NewBuild struct to [builds-api] refactor build start response type.Feb 7 2024, 5:11 AM
dcaro changed the task status from Open to In Progress.Feb 7 2024, 10:10 AM
dcaro triaged this task as High priority.
dcaro moved this task from Next Up to In Progress on the Toolforge (Toolforge iteration 05) board.

project_1317_bot_df3177307bed93c3f34e421e26c86e38 opened https://gitlab.wikimedia.org/repos/cloud/toolforge/toolforge-deploy/-/merge_requests/195

builds-api: bump to 0.0.126-20240212140328-9308d684