Jenkins GitHub Integration | How to Do It | Blazemeter by Perforce
Technology

Jenkins GitHub Integration | How to Do It | Blazemeter by Perforce

jenkins and github are two powerful tools on their own, but what about using them together? In this blog, learn about the benefits of a Jenkins GitHub integration and how to set up the integration on your own.

index:

Reading: How to connect jenkins to github

  • can you use jenkins with github?
  • why integrate github + jenkins?
  • how to configure jenkins + github integration

can you use jenkins with github?

You can and should use jenkins with github to save time and keep your project up to date.

one of the basic steps to implement ci/cd is to integrate your scm (source control management) tool with your ci tool. this saves you time and keeps your project up to date all the time. one of the most popular and valuable scm tools is github.

what is github?

github is a git-based repository host, commonly used for open source projects. github allows for code collaboration, hosting, and version control.

what is jenkins?

jenkins is an open source continuous integration and continuous deployment (ci/cd) tool for automating the software development lifecycle (sdlc). With Jenkins Testing, teams can automate code building, testing, and deployment.

why integrate github + jenkins?

You should integrate jenkins and github to improve the efficiency of building, testing, and deploying your code.

The integration presented in this blog post will teach you how to schedule your build, pull your code and data files from your github repository to your jenkins machine, and automatically trigger each build on the jenkins server after each commit on your jenkins machine. git repository.

See Also:  How to connect a Roomba to Wi-Fi | Digital Trends

But first, let’s set up the jenkins and github integration. let’s start with the github side!

how to configure jenkins + github integration

configuring github

step 1: go to your github repository and click ‘settings’.

GitHub repo settings

Step 2: Click webhooks and then click ‘add webhook’.

add github webhook

Step 3: In the ‘payload url’ field, paste the url of your jenkins environment. at the end of this url add /github-webhook/. in the ‘content type’ select: ‘application/json’ and leave the ‘secret’ field empty.

See also: How to Connect a Computer to a Router – NetWork From Home

paste jenkins environment url to payload url in github

Step 4: On the ‘which events would you like to trigger this webhook?’ page choose ‘let me select individual events’ and then check ‘pull requests’ ‘ and ‘push’. at the end of this option, make sure the ‘active’ option is checked and click ‘add webhook’.

activate "add webhook" option

checked pull requests and push options

We are done with the configuration on the github side! now let’s move on to jenkins.

configuring jenkins

step 5: in jenkins, click ‘new item’ to create a new project.

jenkins new item

step 6: give your project a name, then choose ‘freestyle project’, and finally click ‘ok’.

jenkins freestyle project

Step 7: Click on the ‘source code management’ tab.

jenkins ‘Source Code Management’ tab

Step 8: Click on git and paste the url of your github repository into the ‘repository url’ field.

pasting github url into jenkins repository url field

Step 9: Click on the ‘build triggers’ tab and then on the ‘gitscm polling github link trigger’. or choose the trigger of your choice.

triggering builds in jenkins

See also: How to Record Guitar in Ableton: Step-by-Step Tutorial – Guitar Gear Finder

that’s it! your github repository is integrated with your jenkins project. With this jenkins github integration, you can now use any file found in the github repository and trigger the jenkins job to run on every code commit.

See Also:  RV34x: Install Cisco AnyConnect Secure Mobility Client on a Windows Computer - Cisco

For example, I’ll show you how to run a taurus script that I uploaded to my github repository from my jenkins project. taurus is an open source load testing solution that allows developers to run load test scripts from sophisticated platforms like jmeter and selenium, but with simple yaml code.

trigger jenkins github integration with every code commit

step 10: click the ‘build’ tab, then click ‘add build step’ and choose ‘run shell’.

execute shell

Step 11: To run a taurus test, simply use the command ‘bzt’, followed by the name of your yml file, and click ‘save ‘.

run taurus in jenkins with github

step 12: go back to your github repository, edit the taurus script and commit the changes. now we will see how jenkins executed the script after commit.

run jenkins script after commit

step 13: go back to your jenkins project and you will see that a new job was automatically activated from the commit we made in the previous step. click the little arrow next to the job and choose ‘console output’.

console output

step 14: you can see that jenkins was able to extract the taurus script and run it.

jenkins github integration for running taurus script

end result

congratulations! you have now set up a fully working jenkins github integration. every time you push your changes to github, github will trigger your new jenkins job.

once the github plugin is fully installed and integrated into your jenkins project, you will have completed a crucial step towards the full ci process. now, you can move on to the testing phase. To complete the full CI process, integrate your load test into your CI tool. using blazemeter’s integration with jenkins, incorporating load testing into your ci/cd pipeline has never been simpler.

See Also:  Connecting Multiple Wires - Guide to multiple connections | 12Volt Planet

start testing now

See also: Why is AOC USB monitor not working on Windows 10? — Auslogics Blog

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button