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

GHA Onboarding Prompt breaks CI in Jenkins/CloudBees #664

Closed
lanz opened this issue Nov 7, 2022 · 8 comments
Closed

GHA Onboarding Prompt breaks CI in Jenkins/CloudBees #664

lanz opened this issue Nov 7, 2022 · 8 comments
Labels
GHA / CI Issues specific to GitHub Actions or other CI environments question Further information is requested

Comments

@lanz
Copy link

lanz commented Nov 7, 2022

We use rdme to sync our API specs with ReadMe. We have a build job set to run in Jenkins/CloudBees that runs the following command for several specs when content is merged in our repo:

rdme openapi "output/swagger/spec.json" --key="<redacted>" --id="<redacted>"

This has worked flawlessly for the past ~2 years; however, after upgrading to the most recent version of the rdme package, we're now being prompted if we would like to add a GitHub action after running the command. This breaks our automated scripts that we use for continuous integration via Jenkins/CloudBees because there is no user to input a response in a continuous integration environment.

I realize that the question is only asked once, and once a user responds with "no" then the question is never asked again. However, as I mentioned, there's no user in a continuous integration environment to input a response at the prompt.

Note that the above command is the recommended approach for continuous integration according to the documentation for the rdme package in npm.

The rdme tool should be changed to not require user input when updating specs using the above command since it breaks automated scripts. At the very least a flag should be added that suppresses user input prompts.

Note that we can't use GitHub Actions for several reasons. Unless the above is fixed we'll be unable to continue updating our specs in ReadMe automatically.

API

@kanadgupta kanadgupta added bug Something isn't working GHA / CI Issues specific to GitHub Actions or other CI environments labels Nov 7, 2022
@lanz lanz changed the title User interaction prompt breaks continuous integration in Jenkins/CloudBees when upldating an API spec User interaction prompt breaks continuous integration in Jenkins/CloudBees when updating an API spec Nov 7, 2022
@kanadgupta
Copy link
Member

kanadgupta commented Nov 7, 2022

Hi @lanz! Apologies for the trouble. We use ci-detect to determine whether or not a user is executing commands via a CI environment (in which case we don't — or at least shouldn't — execute that GitHub Actions prompt flow). Can you confirm that your CI environmental variables are showing up in the list in ci-detect? I see Jenkins but I'm not sure about your specific configuration.

Also can you confirm that you're running the latest of the latest (v8.0.4)? We've made a couple of small fixes on this front since v8 was released.

@kanadgupta kanadgupta added question Further information is requested and removed bug Something isn't working labels Nov 7, 2022
@lanz
Copy link
Author

lanz commented Nov 7, 2022

Hi @kanadgupta, thank you so much for responding! I verified that we're using the latest version, 8.0.4. In the ci-detect file you linked to, I do see Jenkins, but I don't see CloudBees which is an enterprise version variation of Jenkins.

To add some more context, here's the exact failure output from the rdme command in our CloudBees instance:

15:34:19  - Validating the API definition located at output/swagger/spec.json...
15:34:19  ✔ Validating the API definition located at output/swagger/spec.json... done! ✅
15:34:19  - Staging your API definition for upload...
15:34:19  ✔ Staging your API definition for upload... done! 🚀
15:34:19  - Updating your API docs in ReadMe...
15:34:21  ✔ Updating your API docs in ReadMe... done! 🦉
15:34:21  
15:34:21  Host key verification failed.
15:34:21  fatal: Could not read from remote repository.
15:34:21  
15:34:21  Please make sure you have the correct access rights
15:34:21  and the repository exists.

When I run the same scripts that our CloudBees instance uses on my local machine, they usually succeed; however, we do sometimes get the following error:

- Validating the API definition located at output/swagger/spec.json...
√ Validating the API definition located at output/swagger/spec.json... done! ✅
- Staging your API definition for upload...
× Staging your API definition for upload...

request to https://dash.readme.com/api/v1/api-registry failed, reason: connect ETIMEDOUT 2606:4700:3035::6815:5b6f:443

Let me know if you need more information, thanks!

@lanz
Copy link
Author

lanz commented Nov 7, 2022

@kanadgupta We did some testing, and rolling back the rdme version to 7.5.0 resolved our issue in CloudBees. Any idea what changed between 7.5.0 and 8.0.4 that could be causing the issue?

@kanadgupta
Copy link
Member

kanadgupta commented Nov 7, 2022

Hi @lanz — we recently shipped a GitHub Actions onboarding workflow in v8. It does some git repository inspection in order to determine whether or not to ask the user if they'd like to set up GitHub Actions. As you can tell, we're still tweaking some of the edge cases like this 😅

A few questions/notes for you:

  1. I dug through the CloudBees docs a bit and it looks you need to set the JENKINS_URL in order for it to show up:

    (NOTE: only available if Jenkins URL is set in "System Configuration".)

    Just to confirm: do you have a Jenkins URL set up? If not, then I'll open up an issue on ci-detect so we have better detection here.

  2. To clarify, what error are you seeing in CI? Is it this screenshot or this error below? Or both?

    15:34:21 Host key verification failed.
    15:34:21 fatal: Could not read from remote repository.

  3. Related to the above, would you be able to send across some debug logs (with sensitive information redacted) of the error you're seeing above? You can do so by prefixing your rdme command with DEBUG=rdme*. See our docs for more info.

  4. This request to https://dash.readme.com/api/v1/api-registry failed error you're seeing is an entirely separate issue unfortunately, unrelated to this v8 release or the rdme CLI itself. I'm assuming it's due to your file size. How often do you see that error? Do you mind sending across your output OpenAPI/Swagger file?

@kanadgupta
Copy link
Member

Also @lanz I see that you're chatting with Karla from our Support team (she's great!) — feel free to send your debug logs or OpenAPI file through that channel if you prefer. Thanks!

@kanadgupta
Copy link
Member

One more thing: I'd like to work with you to understand the underlying issue so we can make changes to this tool as necessary, but if you're looking for a quick and dirty fix, you should be able to add the environmental variable CI=true to your CI environmental variable settings and everything should work normally again. Let me know if you end up going that route, especially if that fix doesn't work!

@kanadgupta
Copy link
Member

Hi @lanz, we just published 8.1.0, which hopefully detects CI in CloudBees. Can you update to the latest version and confirm?

@kanadgupta kanadgupta changed the title User interaction prompt breaks continuous integration in Jenkins/CloudBees when updating an API spec GHA Onboarding Prompt breaks CI in Jenkins/CloudBees Nov 16, 2022
@kanadgupta
Copy link
Member

Hi @lanz, going to close this out. Let me know if you're still seeing this issue and I can re-open!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GHA / CI Issues specific to GitHub Actions or other CI environments question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants