Jenkins monitors github submissions and automatically builds (stepping on the pit)

1. Jenkins pulls the github code, and the console reports an error

First try to use jenkins to manually build and pull the github code, but the pull fails. Check the jenkins console for an error:

insert image description here

View project configuration - source code management - branch in git - the default pull is the master branch

insert image description here
And the github code branch is main, I didn’t change it at first, the default is master, I can’t find the branch, so I can’t pull it, change the branch to **, which means any branch, or change it to the corresponding branch of the github project, the build is successful

insert image description here

insert image description here

insert image description here

2. There are new submissions on github, but the jenkins build is not triggered

01. Not mapping the jenkins port to the public URL

When setting up webhook, an error is reported

insert image description here

Because my jenkins is built locally, and github cannot use localhost to trigger webhooks, it is necessary to map the port used by the local jenkins to the public network. The ngrok tool is used here. Download address
After downloading, run ngrok.exe directly to map the local jenkins port: ngork http (端口号)
the validity period is 2 hours, if it expires, you need to update the webhook on github

insert image description here
Fill in the corresponding address in the github webhook

insert image description here

02. Network reasons

Because I don’t have a VPN locally, so github is good and bad, sometimes pycharm can push, sometimes not, so sometimes jenkins can’t build automatically

Guess you like

Origin blog.csdn.net/z12347891/article/details/129430670