CircleCI-Public / circleci-cli

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

orb create precludes use of orb init #804

Open Peter-Darton-i2 opened 2 years ago

Peter-Darton-i2 commented 2 years ago

The recommended/documented orb registration command (orb create) locks the user out from ever using the recommended/documented orb development process (orb init). This isn't a good user experience.

Meta:

CircleCI CLI Version: 0.1.22322+5ff92b4 (release)

Operating System: Ubuntu running under WSL2 on Win10

CircleCI CLI Diagnostic:

---
CircleCI CLI Diagnostics
---
Debugger mode: false
Config found: /home/pjd/.circleci/cli.yml
API host: https://circleci.com
API endpoint: graphql-unstable
OK, got a token.
Trying an introspection query on API...
Ok.
Hello, Peter Darton.

Current behavior:

  1. circleci orb create myorg/myorbname --private
  2. circleci orb init myorbname --private ... Error: Unable to create orb: Cannot create an Orb named 'myorbname': an Orb with that name already exists.

Expected behavior:

orb init command should detect that the orb has already been registered and continue on (it does this when registering contexts; it needs to do this everywhere else too).

When did this begin / Was this previously working?:

I've only tried to use this command today; it's failed every time (see also #495 and #803)

Additional Information:

As with #495 and #803, the same bad coding pattern is used and the fix is much the same for all - whenever orb init needs something to exist, it should first check to see if it already exists before trying to create it (just as it does for the publishing context).

Alternatively, the circleci orb create command (and all related documentation) needs to make it 100% clear that its use will irrevocably prevent the use of circleci orb init for that orb, forever. i.e. It should never come as a surprise to the user that they've screwed up their only chance of using orb init.

zbenhadi commented 1 year ago

Hello @Peter-Darton-i2, thank you for this very detailed issue. Just letting you know that we are considering this issue (along with #803 ) and trying to come up with a coherent solution between create & init behaviors.