CircleCI-Public / circleci-cli

Use CircleCI from the command line
https://circleci-public.github.io/circleci-cli/
MIT License
407 stars 232 forks source link

refactor: Abstracted the different config validation routes #977

Closed JulesFaucherre closed 1 year ago

JulesFaucherre commented 1 year ago

Checklist

Changes

Abstracted the API that compiles config so that it's transparent whether you use the new API route or the GraphQL endpoint

Rationale

The config compilation has recently been moved from the GraphQL to a new API route. At first it was implemented such as if the compilation request failed with a 404, we tried falling back to the legacy GraphQL endpoint because it mostly meant that we were on old Server version that did not have the new API route Now you have to pass an APIClient to the config compiler upon creation. This client should be obtained with config.NewWithConfig(*settings.Config). This API client is an interface which implementation either request the new API route or the GraphQL To detect which implementation must be given, a call is made to the new route, on 404 the GraphQL implementation is returned, else the new API route implementation is returned

Screenshots

Nothing to show as it only changes how the code operates internally but do not add any product change