I am trying to setup Jenkins to simply detect a push event on a branch in a git repo, and when detected run a custom script which deploys the change.
I have setup Jenkins, installed the Github plugin and configured the webhook on Github. This works the first time i push a change to that branch - I can see in Github the webhook being sent and in the Github log on Jenkins that a change is detected and the custom script is triggered by Jenkins so Jenkins access to Github is working.
Now if i make another change to the branch and push to Github, the webhook is fired but Jenkins does not detect a change. In the Jenkins github log i see "No changes". In my Jenkins job configuration i have added the Github project URL, selected GIT in the Source Code Management and put in the repo URL and added to the Branched to Build section as recommended by Jenkins:
refs/heads/mybranch
where mybranch is my branch name. In the Jenkins Github Hook Log i can see, where REPO below is my private repo on Github.
Using strategy: Default [poll] Last Built Revision: Revision 967ae07f677x581977h74t6c5362b31e8c45638 (refs/remotes/origin/mybranch) /usr/bin/git --version # timeout=10 /usr/bin/git -c core.askpass=true ls-remote -h [email protected]:REPO.git # timeout=10 Done. Took 1.5 sec No changes
Any ideas why subsequent push events are detected by Jenkins but no change is detected? Is there any other config setting i need in the Job?
I could just setup a simple endpoint to receive the Github webhook and deal with it myself but i'd like to use Jenkins for this task and in the future. Many thanks