jhipster/jhipster-online

JHipster Online: Continuous Integration feature fails

amchavan opened this issue ยท 11 comments

I'm trying JHipster Online for the first time, so maybe I'm doing something wrong, but anyway.
I created a project, all is well, see https://github.com/amchavan/jhipster-demo. Next I tried to add Continuous Integration features to it, went to that Web page, selected my project and GitHub Actions and clicked on the Yes, add Continuous Integration button. The popup window shows:

Configuring Continuous Integration/Continuous Deployment

Sending request to the server...
Continuous Integration with Github is going to be applied to amchavan/jhipster-demo
Cloning GitHub repository `amchavan/jhipster-demo`
Creating branch `jhipster-github-ci-110399324861994`
Generating Continuous Integration configuration
Running `jhipster ci-cd`
Error during generation: Stream closed
Generation failed

I tried several times over two days, choosing different options, but the outcome is always the same. The error message is not very informative, can somebody please tell me what to do?

@amchavan : Thanks much for reporting this problem. I have seen this error in our logs but couldn't figure out where it is coming from; now I know. We'll look into this and hopefully have a fix soon. ๐Ÿ˜„

Part of the problem is that there seems to be a problem with the output stream closing during generation of the ci-cd configuration files which seems to give the error. I've corrected this in #242. However it seems there's another problem specific to creating the GitHub Actions configuration. When trying to create the pull request for this configuration there seems to be a error coming from the github-api. I believe this might be a bug on the github-api side as this involves a special folder specific to GitHub. Anyways I've opened a issue at; hub4j/github-api#959 outlining this issue. ๐Ÿค”

Okay I found the final part of this puzzle. It seems the bot's oauth token is missing the workflow permission. We need to modify the bot such that it's oauth token includes the workflow permission. This will ensure the bot can create/modify the .github folder.

@jdubois @PierreBesson : I don't have access to the jhispter-bot. Could one of you please make sure the both has the workflow permission added to it's oauth token? ๐Ÿ˜„

I have created such a token but can you confirm that I need to put it inside the "JHIPSTER_BOT_OAUTH_TOKEN" secret variable? I'm having some doubts

Indeed, it seems that we authenticate using the user's oauth token, not the JHipster Bot OAuth token (which doesn't seem to be used anywhere!!)

As far as I remember, we don't use the bot for GitHub in our code. The configuration and docs are a bit misleading on that front.

Indeed, it seems that this is not used anymore, I'm also going to fix that. I need some time to check as it's a bit complex, but I should do 2 PRs fixing those

@jdubois : You are right; sorry for my mistake. I was seeing a very small log implying the missing workflow permission in the token and thought it comes from the bot token; but the bot token is no longer used and as you said we use the user token. I've opened a PR adding the workflow permission to the user token. This should take care of it. Feel free to review and merge. ๐Ÿ˜„

EDIT: Also in the above PR I've went ahead to clean up the old code relevant to the bot token.

@amchavan : We've fixed this issue. Please give it a try and let us know if you see any further issues. You should refresh your GitHub token as mentioned at https://start.jhipster.tech/ci-cd under the GitHub Actions section. ๐Ÿ˜„

It does work now, thank you!!

It does work now, thank you!!

Great. You are welcome. ๐Ÿ˜„