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

Provide default organization for --org-id in the config file #832

Open canatella opened 1 year ago

canatella commented 1 year ago

What problem does this feature solve?:

With private orbs, the --org-id argument is mandatory for multiple circleci cli commands, most annoyingly the validate one. Being able to configure a default value in the ~/.circleci/cli.yml config file would be nice.

Provide an example:

~/.circleci/cli.yml

host: https://circleci.com
...
default_org_id: "12345678-1234-1234-1234-123412345678"
jasonarewhy commented 1 year ago

Agreed, we should be able to configure this in the cli.yml and/or with a CIRCLECI_CLI_ORG_IDenvironment variable.

jasonarewhy commented 1 year ago

From the code, it appears --org-id is actually optional, so long as you are using --org-slug.

We used to be able to use the org slug only but found that recently we had to begin using org-id instead. However, it seems that CircleCI (silently?) renamed org slugs from github/<org name> to gh/<org name>. So our docs on using --org-slug were no longer valid.

When I hit the API me/collaborations endpoint to get a list of orgs, I was able to see the correct org slug with the gh/ prefix.

Hope this helps others frustrated by having to use the non-human-friendly org-id.

JulesFaucherre commented 1 year ago

Hello! @canatella Definitely, thanks for the suggestion, we will consider this and let you know @jasonarewhy The suggestion for env variable could be interesting, we'll look into this. Regarding your --org-slug problem , you're completely right, we introduced this problem by migrating the config validation to a new route. This should be fixed by this pr so you should not have the problem anymore. Tell us if you still have it