I want to use Jenkins pipelines to get Sonarqube to comment on pull requests.
I’ve set up a pipeline project (not multibranch) but am having difficulty getting it to build.
I’m using Jenkins to manage my Github hooks and have verified that the hook is being sent (by checking Github) and being received (by checking my Jenkins log file).
My Jenkins log file includes this line:
2019-05-29 10:54:59.786+0000 [id=11666] INFO o.j.p.g.PullRequestGHEventSubscriber#onEvent: Received PULL_REQUEST for https://github.com/user/repository from 220.127.116.11 ⇒ https://example.com/github-webhook/
So the webhook is definitely being picked up.
I have checked the “Github” project box and given the github project url. There is nowhere to add a SCM option in the pipeline configuration.
When I look at the Github log for the pipeline I can see it has never been called.
I do have a separate freestyle project that is configured to use SCM polling on this repository. That project is used to run the unit tests and do other analysis, and I want the pipeline to run Sonarqube analysis and comment on the PR.
I have seen other people commenting that you need to build the pipeline at least once before it is able to run off an SCM hook. I’ve done this and had that job complete successfully.
What am I doing wrong?