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

init command produces various error messages, cannot complete #495

Closed
mattwelke opened this issue Oct 18, 2020 · 10 comments
Closed

init command produces various error messages, cannot complete #495

mattwelke opened this issue Oct 18, 2020 · 10 comments
Assignees
Labels
bug Something isn't working orb-dev-kit

Comments

@mattwelke
Copy link

This is probably the worst GitHub issue title I've ever written. :P The reason is because there were multiple issues I encountered. I'll do my best to describe them below. Someone with more context on CircleCI is free to rename this issue if they would like to.

Meta:

CircleCI CLI Version:
0.1.10993+cb3ba09 (release)

Operating System:
Ubuntu 19.10

CircleCI CLI Diagnostic:

CircleCI CLI Diagnostics

Debugger mode: false
Config found: /home/matt/.circleci/cli.yml
API host: https://circleci.com
API endpoint: graphql-unstable
OK, got a token.
Trying an introspection query on API...
Ok.
Hello, Matt Welke.


Current behavior:

Interactive prompts cease after I enter my GitHub repo URL and hit enter, at which point an error is also displayed:

> circleci orb init code/github.com/mattwelke/circleci-orb-test
Note: This command is in preview. Please report any bugs! https://github.com/CircleCI-Public/circleci-cli/issues/new/choose
✔ Yes, walk me through the process.
Downloading Orb Project Template into code/github.com/mattwelke/circleci-orb-test
A few questions to get you up and running.
✔ GitHub
✔ Enter your github username or organization: mattwelke
✔ Enter the namespace to use for this orb: mattwelke
Saving namespace mattwelke as default
✔ Orb name: circleci-orb-test
✔ Yes, set up a publishing context with my API key.
✔ Yes, set up the git project.
✔ Enter the remote git repository: [email protected]:mattwelke/circleci-orb-test.gi✔ Enter the remote git repository: [email protected]:mattwelke/circleci-orb-test.gi✔ Enter the remote git repository: [email protected]:mattwelke/circleci-orb-test.git
Thank you! Setting up your orb...
Error: author field is required

And, when I delete the directory that was created and then try the init command again, it stops at the same spot, and a different error is displayed:

~ > rm -r code/github.com/mattwelke/circleci-orb-test
~ > circleci orb init code/github.com/mattwelke/circleci-orb-test
Note: This command is in preview. Please report any bugs! https://github.com/CircleCI-Public/circleci-cli/issues/new/choose
✔ Yes, walk me through the process.
Downloading Orb Project Template into code/github.com/mattwelke/circleci-orb-test
A few questions to get you up and running.
✔ GitHub
✔ Enter your github username or organization: mattwelke
✔ Enter the namespace to use for this orb: mattwelke
Saving namespace mattwelke as default
✔ Orb name: circleci-orb-test
✔ Yes, set up a publishing context with my API key.
✔ Yes, set up the git project.
✔ Enter the remote git repository: [email protected]:mattwelke/circleci-orb-test.git
Thank you! Setting up your orb...
Error: Non-nullable field was null.
A context named orb-publishing already exists.

And when I try to finish it manually, reading the docs, by running git init, git remote add origin <url>, git add, git commit, and then git push origin master, following the project manually on the CircleCI UI (clicking "start building"), the CircleCI UI shows an error saying it can't build it:

image

Expected behavior:

No errors are output during the interactive steps. If an error occurs, the interactive process is able to be run from the beginning again cleanly.

When did this begin / Was this previously working?:

This have never been working for me. This is my first experience with authoring CircleCI orbs.

@mattwelke mattwelke added the bug Something isn't working label Oct 18, 2020
@gmemstr
Copy link
Contributor

gmemstr commented Oct 19, 2020

Interesting error Error: author field is required - taking a deeper look into this, I suspect it's related to the git library we're using for the CLI and its inability to pull in a git identity. As for the

Error: Non-nullable field was null.
A context named orb-publishing already exists.

error, that's pretty standard, although maybe something we should handle/communicate better. The TL;DR is that the first time an orb is initialised and the Yes, set up a publishing context with my API key. option is selected, we create the context, and any orbs initialised in the future should opt to not create this context.

@gmemstr gmemstr self-assigned this Oct 19, 2020
@gmemstr
Copy link
Contributor

gmemstr commented Oct 20, 2020

@mattwelke Curious if you installed the CLI via snap. Trying to narrow down possibilities.

@mattwelke
Copy link
Author

I tried first with the snap, and it didn't even get this far. With the snap, I encountered #491. Switching to the binary let me get past that error, so that I could progress this far and encounter this error.

@mattwelke
Copy link
Author

I'm happy to test again because I'll be working mostly on CircleCI and orbs this week. Just let me know.

@gmemstr
Copy link
Contributor

gmemstr commented Oct 23, 2020

Second error is being taken care of in #503 - just need better messaging/handling when the context already exists. Ideally one would pick "no" if it already existed, but it's possible it's not known whether it already exists.

@gmemstr gmemstr closed this as completed Oct 23, 2020
@Jean-Baptiste-Lasselle
Copy link

Hi @mattwelke Did you not experience this new issue : #491 (comment) ?

@mattwelke
Copy link
Author

@Jean-Baptiste-Lasselle

I actually finished up with my CircleCI work early and so I haven't revisited this since originally opening this issue. I haven't run any commands to see if there are any new errors produced. It looks like you already reported it in that issue, so I'd say that's all you can do for now.

@b01
Copy link

b01 commented Oct 9, 2021

I also had the error:

? Enter the remote git repository [email protected]:kohirens/<repo-name-here>-orb.git
Thank you! Setting up your orb...
Error: author field is required

In my case I did not have git config user.email set globally. Setting it fixed the error.

It would help to get back the error that git is giving when the circleci CLI tries to run git commands and they fail.

I had my git config user.name set globally, just not the email as it changes from project to project that I have setup. A use case for a coder that works on many enterprise and open source projects. This forces me to set the email correctly per project.

Regardless of the case, it would be nice for the error to indicate that the user.email was not set for the repository that the orb makes.

@shay-ul
Copy link

shay-ul commented Dec 19, 2021

Hey @gmemstr , looks like I'm experiencing this issue as well.
I have double checked and it looks like my git config user.email is set globally.
Is there a way to troubleshoot this behavior?
Do we have a workaround to complete the initialisation of the orb even when encountering such error?

@Peter-Darton-i2
Copy link

I've just encountered this.
Firstly by when I assumed the tool would cope with me setting up the folder it was working in (failed because the local git repo already existed - see #803)
Secondly when I tried following the instructions slavishly and got the "author field is required" error (i.e. as reported here)
Thirdly when I told it not to mess with the git repo and it failed because the orb had already been registered.

There seems to be a general pattern of the "orb init" code unsafely assuming that all resources it wants to exist don't already exist. That means that it can only ever be run in a totally clean environment, that it can never be re-run etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working orb-dev-kit
Projects
None yet
Development

No branches or pull requests

6 participants