jenkinsci / github-autostatus-plugin

Jenkins plugin to provide automatic status for multibranch jobs
https://plugins.jenkins.io/github-autostatus/
MIT License
52 stars 34 forks source link

Support single pipeline #86

Open biolauri opened 4 years ago

biolauri commented 4 years ago

I would like to request support for GitHub Enterprise Server. This shouldn't be that difficult as the API endpoints remain the same (with only changing the FQDN).


Or did I miss something? I just tried it and it didn't work. If yes, sorry for disturbing! 😀

jeffpearce commented 4 years ago

Hi @biolauri. I've used it successfully with GHE. I'm wondering whether there's any interesting errors in the log? The most likely problem is that the Jenkins user that accesses GitHub doesn't have permissions to update statuses. Can you check that?

jeffpearce commented 4 years ago

@biolauri - did you get this working yet?

biolauri commented 4 years ago

Oh, I'm so sorry! No, unfortunately not. And many thanks for your fast reply!

I didn't see anything in the Pipeline log. Is there any other log where I can dig into?

The token has the full repo scope and its user has admin rights on the repo itself. So permission-wise that should be fine, I think.

jeffpearce commented 4 years ago

Hi @biolauri. There might be something in the logs. To capture those:

  1. Click Manage Jenkins
  2. Click System Log
  3. Click Add new log recorder
  4. Enter a name
  5. Click Next
  6. Click the Add button next to Loggers
  7. Enter org.jenkinsci.plugins.githubautostatus for the logger
  8. Click save

After running some jobs you can go back and look at what the plugin has written to the log, and paste it here.

biolauri commented 4 years ago

Thanks! In the logs, I found Could not find commit sha - status will not be provided for this build, so it seems to be that

https://github.com/jenkinsci/github-autostatus-plugin/blob/4032867985037f0974774042f2e4905124f0583e/src/main/java/org/jenkinsci/plugins/githubautostatus/config/GithubNotificationConfig.java#L164

returns null.

I looked into it a bit: With only a single pipeline, it fails, but it works nice if setting up a GitHub org pipeline. So that's my workaround for now, but I think this should also be possible w/o the organization as it's sometimes inconvenient to have the whole org in Jenkins.
This might be a duplicate of #26 & #50 and it's not related to using GitHub Enterprise Server (AFAIK: I didn't test it with GitHub.com, but reading through these issues).