From the course: Intermediate Jenkins: Automate, Integrate, and Secure CI/CD Workflows at Scale

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Solution: Connect Jenkins to GitHub

Solution: Connect Jenkins to GitHub

It's time for another fun opportunity to test our skills. This time we're working with two of my favorite platforms, GitHub and Jenkins. In this challenge we're using a Jenkins file stored in a GitHub repo. The goal is to trigger the Jenkins pipeline whenever the repo is updated. I started by adding the files to the repo. Then I configured a Jenkins job to interact with the repo. I enabled the GitHub hook trigger for git-scm-polling first. This sets up Jenkins to listen for changes in GitHub. In the pipeline configuration, I selected git as the source control system. And then I entered the repository URL. I also had to update the branch specifier to use main instead of master. With all this in place, I ran the job. The first run was successful. Jenkins connected to GitHub, pulled in the code, and ran the pipeline. Back over in GitHub, I updated the repo settings by creating a webhook. This sets up GitHub to send event details to Jenkins every time there's a change in the repo…

Contents