Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

How to trigger a jenkins job when code is pushed to github using “GitHub hook trigger for GITScm polling”

 
The GitHub plugin for Jenkins is the most basic plugin for integrating Jenkins with GitHub projects. If you are a GitHub user, this plugin enables you to:
 
  • Schedule your build
  • Pull your code and data files from your GitHub repository to your Jenkins machine
  • Automatically trigger each build on the Jenkins server, after each Commit on your Git repository
This saves you time and lets you incorporate your project into the Continuous Integration (CI) process.
 

Step 1 – Install the Github Jenkins plugin

Go to “Manage Jenkins” –> “Manage Plugins” –> “Available” Tab –> Search for “GitHub plugin” and install it.

Step 2 – Configure the “GitHub plugin” with github accounts and taken

Go to “Manage Jenkins” –> “Configure System” –> Locate “Github” section and “Add Github Server” and do following modification.

  • API URL – If you server is github.com, your “API URL” would be “https://api.github.com”. Otherwise if you use GitHub Enterprise, specify its API endpoint here (e.g., https://ghe.acme.com/api/v3/).
  • Credentials – You can create your own personal access token in your account GitHub settings. Token should be registered with scopes. Refer https://github.com/settings/tokens/new . Add credentials (your Github token) and Apply.
  • “Test Connection”.

Step 3 – Configure Jenkins Job on which you want push trigger should be effective.

  • Check the GitHub project checkbox and set the Project URL to point to your GitHub Repository
  • Under Source Code Management, check Git and set the Repository URL to point to your GitHub Repository
  • Under Build Triggers, check the “GitHub hook trigger for GITScm polling” checkbox

Step 4 – Configure “webhook” on github for the specific repository.

Go to repostory settings and then “Webhooks” and Click on “Add Webhook” and then fill a “Payload URL” and leave secret empty. “Payload URL” must be your jenkins server url postfix with “/github-webhook/”. Such as http://35.154.114.196:8080/github-webhook/

Step 5 – Commit and push in Git repo using workstation and verify the job triggered new build or not?


git clone git-url
cd helloworld-java-maven/
vi readme.txt
git add --all
git commit -m"adding"
git push origin masterCode language: PHP (php)

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

What is Jenkins and use cases of Jenkins?

What is Jenkins? Jenkins is an open-source automation server widely used for building, testing, and deploying software projects. It provides a platform for continuous integration and continuous…

Read More

Jenkins Tutorials: Installing Jenkins on Tomcat

We are going to discuss Installing Jenkins today. We will be focusing on installing it on Tomcat server as a servlet, and tomcat will act as a…

Read More

Jenkins Tutorials: Install Jenkins as Docker Container

In the Previous Post we Learned How to install Jenkins as Servlet on Tomcat server. In this post we will try even simple and easy way to…

Read More

Top Jenkins interview questions and answers

1. What is Jenkins? Jenkins is an open-source automation server that helps automate various aspects of software development, such as building, testing, and deploying code. It allows…

Read More

How to Implement GitOps Using Jenkins?

Hello there, fellow tech enthusiasts! In this blog post, we are going to delve into the world of GitOps and learn how to implement it using Jenkins….

Read More

Jenkins Tutorial: Install Jenkins on Ubuntu

In this tutorial we are going to install Jenkins on Ubuntu operating system. Ubuntu is another debian based operating system – open sourced and highly loved by…

Read More
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
rajesh
rajesh
2 years ago

do to do this for pipeline job ?

robert
robert
3 years ago

hi Rajesh, what if the ip address where jenkins is located is private?
I cannot not access (from bitbucket- in my case)

Thank you!

2
0
Would love your thoughts, please comment.x
()
x