CircleCI-Public / circleci-cli

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

Allow configuring http client timeout #1012

Closed or-shachar closed 7 months ago

or-shachar commented 8 months ago

What problem does this feature solve?:

Provide an example:

export HTTP_TIMEOUT=30s
circleci config validate config.yml

or

circleci --http_timeout 30s config validate config.yml
loderunner commented 8 months ago

Love the idea! This should be simple to merge. I think the feature has a few more requirements:

  1. I don't see where the global flag --http_timeout is setup? Did you do that part? Also, from the user's point of view, I don't think it matters that this is HTTP in the flag. Let's just call it --timeout and add the HTTP part to the inline help.
  2. HTTP_TIMEOUT seems like too generic a term. Can we add a prefix to "namespace" the environment variable? CIRCLECI_CLI_TIMEOUT=30s should do fine.
  3. There is another HTTP client in the CLI, used for exchanging with the GraphQL API (mostly for Orbs). Can we make sure the timeout is applied to both clients? (source)

Finally, I'd like to see at least one test in there. You can add an integration test to config/commands_test.go, creating a new mock server with httptest.NewServer that takes longer time to respond than the timeout.

Let me know if any of this is unclear, I'll be glad to help.

abdelDriowya commented 7 months ago

@or-shachar cli released you can define http timeout now