Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orb init should cope with things already existing #803

Open
Peter-Darton-i2 opened this issue Nov 1, 2022 · 0 comments
Open

orb init should cope with things already existing #803

Peter-Darton-i2 opened this issue Nov 1, 2022 · 0 comments
Assignees

Comments

@Peter-Darton-i2
Copy link

Peter-Darton-i2 commented Nov 1, 2022

TL;DR: The orb init tool needs to be more tolerant when finding that the things it needs to exist do already exist.

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. (Get a org admin to create a) new empty repo on github
  2. git clone git@github.com:myorg/circleci-orb-myorbname.git
  3. cd circleci-orb-myorbname
  4. circleci orb init . --private
Yes
GitHub
myorg
myorg
myorbname
(no categories)
Yes
Yes
main
git@github.com:myorg/circleci-orb-myorbname.git
Thank you! Setting up your orb...
Error: repository already exists

Expected behavior:

I expected this to be a valid way of invoking the tool.

  1. If the folder is a git repo, even an empty one, the tool shouldn't need to ask for the git repo URL as that's already recorded in the .git folder; the tool should check for this and handle it.
  2. It shouldn't report Error: if the folder has already been configured to point to a github repository - the tool should check for this and handle it.

The error message needs some clarification too.

  1. It's not obvious that the error is a fatal error that caused the process to be abandoned; git status reported that the tool had made lots of changes to the local filesystem, implying that it'd actually done its job.
    It was only from watching the video that I realised that the tool should've continued on from that point.
  2. The error message should specify that it's the local repository that's being complained about.
    I originally thought that it was upset that the repository had been created in github.
    I know that, technically, the local .git folder is also a repository in its own right, but error messages need to be clear which repository they're referring to.

When did this begin / Was this previously working?:

It's never worked for me.

Additional Information:

There's many ways to create a repository and to get it linked to a local folder; different users will be used to different workflows that all result in the same end result ... but this tool should not assume that a repo doesn't exist and should cope when the folder it's working in is already pointing at a repository.

  • The tool should pick up the existing remote github repository details from the .git folder and not need to ask.
  • The tool should cope if there's existing files in the existing repository, possibly warning about it overwriting files.

Even if I use the tool exactly as suggested in the video (i.e. letting the tool set up the local git repo), that didn't work either - instead of complaining Error: repository already exists it complained Error: author field is required and bombed out ... even though CDing to the folder and doing git config shows that user.name and user.email are both set.
i.e. it looks like #495 has come back.

...and when I tried re-running and when it asked "Would you like to set up your git project?" I answered "No", it then bombed out with the error "Error: Unable to create orb: Cannot create an Orb named 'myorbname': an Orb with that name already exists."
It's correct that it's been registered - my github admin has registered it - but the tool's inability to cope with that then means that, if anyone has ever run circleci orb create ... then that then prevents anyone from ever setting up development for the orb using the orb init tool.
i.e. it's a nasty (and permanent) either/or situation and there's no warning from circleci orb create that this is the case.

Note: If we ask it to "set up a publishing context for your orb" then it does successfully detect if it's done that already and it copes with that; that's how it should work everywhere.
i.e. what's needed is to extend this "create it only if it doesn't already exist" logic to all the other resource-creation code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants