How can I make Jenkins CI with Git trigger on pushes to master?

0 votes
I want Jenkins to run build scripts only whenever someone on the project pushes to master.
Aug 13, 2018 in Jenkins by Hannah
• 14,080 points

2 answers to this question.

0 votes
  • Set the Jenkins job's build trigger to Poll SCM, but do not specify a schedule.
  • Create a GitHub post-receive trigger to notify the URL
  • http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>?token=<get token from git to build remotely>
  • This will trigger all builds that poll the specified Git repository.
  • However, polling actually checks whether anything has been pushed to the used branch.
answered Aug 13, 2018 by Kalgi
• 37,420 points
0 votes

Generic webhook trigger can be useful

When configured with

  • A variable named ref and expression $.ref.
  • A filter with text $ref and filter expression like ^(refs/heads/feature/.+)$.

Then that job will trigger for every push to master. No polling.

answered Aug 13, 2018 by lina
• 8,100 points

Related Questions In Jenkins

0 votes
1 answer

How can I point Jenkins to another .jenkins home directory?

I think this can help you out. Set ...READ MORE

answered Jul 19, 2018 in Jenkins by Kalgi
• 2,620 points
0 votes
1 answer

I’m facing a login error when I try to run Jenkins on Docker. How do I solve this?

You have to open the /var/log/jenkins/jenkins.log file to ...READ MORE

answered Jul 24, 2018 in Jenkins by Sophie may
• 9,430 points
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How to serve Jenkins with Caddy?

Using the transparent preset fixes this: { ...READ MORE

answered Aug 8, 2018 in Jenkins by Kalgi
• 37,420 points
+5 votes
4 answers

How can I run a Jenkinsfile from a particular folder?

Consider the below points: The Freestyle project ...READ MORE

answered Mar 26, 2018 in Jenkins by anonymous