1
votes

If I execute curl http://localhost:8081/Jenkins/job/test/build?delay=0sec My Jenkins job get triggered but

I have created a post-commit file(.git/hook/post-commit) and added curl command as below

curl http://localhost:8081/Jenkins/job/test/build?delay=0sec

But when I push a commit my Jenkins job isn't get triggered. What I'm missing here?

1

1 Answers

2
votes

But when I push a commit

A post-commit is client side hook.
It is triggered on commit, not on push. So make a new commit, and check if the job is triggered then.
(I assume the Jenkins job fetches the sources from your local git repo)

If the Jenkins job fetches from the server repo, then the post-commit hook has nothing to do with the job being triggered.

As the OP Swapnil comments:

My Poll SCM was H/35 * * * * so it may delayed for some time and I didn't noticed it.