jenkins-x/jx

Lighthouse hook fails to merge the PR

spaily opened this issue · 3 comments

Hi,
My On-Premises cluster is deployed in the local network which is not accessible from outside, so I've enabled the webhook by following https://jenkins-x.io/v3/admin/platforms/on-premises/webhooks/. The webhook is accessible from outside now. I'm using public github repository.

I'm using jx project quickstart to create a demo golang-http project, PR is getting created successfully but did not merge automatically. When I looked at the lighthouse URL is pointing to http://lighthouse-jx.192.168.1.80.nip.io/merge/status which is local and continue to be on pending state Lighthouse Merge Status Pending — Not mergeable. Needs approved label..
I think that this is the reason why is not merging. Any idea, why is the lighthouse URL on the github pointing to the local/internal URL even though the webhook is exposed via ngrok?

Any logs in the lighthouse webhook and lighthouse keeper pods (in the jx namespace)? Also do you have some branch protection rules in github?

@ankitm123 First of all, thanks for helping. 🤝

kubectl logs -f lighthouse-webhooks-fde479649-95krv

{"fields.level":"info","level":"info","msg":"setting the log level","time":"2022-09-21T18:08:12Z"}
{"level":"info","msg":"updating the Lighthouse core configuration","time":"2022-09-21T18:08:12Z"}
{"level":"warning","msg":"unknown plugin","plugin":"blunderbuss","time":"2022-09-21T18:08:12Z"}
{"level":"warning","msg":"unknown plugin","plugin":"heart","time":"2022-09-21T18:08:12Z"}
{"level":"info","msg":"updating the Lighthouse plugins configuration","time":"2022-09-21T18:08:12Z"}
{"level":"warning","msg":"not pushing metrics as there is no push_gateway defined in the config.yaml","time":"2022-09-21T18:08:12Z"}
{"level":"info","msg":"Lighthouse is now listening on path /hook and port 8080 for WebHooks","time":"2022-09-21T18:08:12Z"}
{"level":"info","msg":"Lighthouse is serving prometheus metrics on port 2112","time":"2022-09-21T18:08:12Z"}

kubectl logs -f lighthouse-keeper-655c9949c-7defnp

{"component":"keeper","controller":"status-update","duration":"377.134976ms","file":"/workspace/source/pkg/keeper/status.go:450","func":"github.com/jenkins-x/lighthouse/pkg/keeper.(*statusController).sync.func1","level":"info","msg":"Statuses synced.","time":"2022-09-21T18:27:23Z"}
{"component":"keeper","controller":"sync","duration":"443.648821ms","file":"/workspace/source/pkg/keeper/keeper.go:310","func":"github.com/jenkins-x/lighthouse/pkg/keeper.(*DefaultController).Sync.func1","level":"info","msg":"Synced","time":"2022-09-21T18:28:21Z"}
{"component":"keeper","controller":"status-update","duration":"326.007461ms","file":"/workspace/source/pkg/keeper/status.go:450","func":"github.com/jenkins-x/lighthouse/pkg/keeper.(*statusController).sync.func1","level":"info","msg":"Statuses synced.","time":"2022-09-21T18:28:23Z"}

Also No branch protection rules defined yet.

@ankitm123 Your https://ankit-mohapatra.netlify.app/JenkinsX/jx3-with-k3s/ helped me nailing the root cause.
As per your blog, i should get the /hook request back but I did NOT, when checked my github webhook, it had http protocol instead of https, fixing that let me proceed further.

The same issue is happening for the pull requests as well, so i had to manually change the protocol to make it work!