简体   繁体   中英

Jenkins GitHub Webhook not triggering builds

I have a Jenkins server (2.249) setup and I have connected my GitHub account and tested the connection and it works fine, but for a normal pipeline job where you enter the GitHub repo url, Jenkins seems to add an extra slash at the end? So I can't get my normal pipeline job to build on a push event, I've checked the logs and it says:

skipped [repo-name] because it doesn't have a matching repository.

So I've starting to think its because Jenkins is adding an extra slash at the end of my repo url? The webhook on the GitHub side works as it gives back a green tick and it works on another multibranch job for push events, just not the normal pipeline jobs.

Don't know if the problem is still on after more than one year but because I've just faced the same issue, here is an answer that help me to understand: https://serverfault.com/a/884717

Just to resume the answer : you have to complete the git part (scm) of your Project Configuration: 配置文件

For my part: as the project is a private one, in an organisation that I can't update to add a personal token (as I'm not the owner of the resource - organisation), I choose to use the git+ssh url with a ssh key access to this repo. The next trick for github is to add the github's IPs to the jenkins user know_hosts file !

The reason behind the need to add twice the repository url is obscure. But I could only see that in https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/com/cloudbees/jenkins/GitHubRepositoryNameContributor.java#L113 the method parseAssociatedNames will try to get the Jenkins'job associated names from:

  • com.cloudbees.jenkins.GitHubRepositoryNameContributor$FromSCM
  • com.cloudbees.jenkins.GitHubTrigger$GitHubRepositoryNameContributorImpl
  • org.jenkinsci.plugins.github_branch_source.GitHubSCMSourceRepositoryNameContributor

I think the third one is for multibranch pipelines. I don't really know for the second but indeed the first one is fromSCM configuration !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM