Jenkins Curriculum
Source Control Integrations
Build Tool Integrations
Deployment Integrations
Monitoring Integrations
On this page
Subtopic•Source Control Integrations

Github Integration

1. Introduction: The Author and the Editor

Imagine you are a Famous Author. You are writing your next "Great American Novel." Every day, you sit in your office and write new chapters, you delete old ones, and you make thousands of small changes. But you aren't the only one involved. You have a Professional Editor (the Jenkins Server).

The editor's job is not to write the book. Instead, the editor's job is to "Watch" your work. Every time you finish a new chapter, the editor immediately reads it. They check for spelling errors. They check for plot holes. They ensure that the story follows the "Company Guidelines." If the chapter is perfect, the editor sends it to the publisher. If the chapter has a mistake, the editor sends it back to you with a big red mark and says: "Fix this before we move forward."

In the world of DevOps, GitHub Integration is that author-editor relationship. GitHub is the author's office (the Source Control). Jenkins is the editor (the CI/CD engine). The integration ensures that every single "Commit" of code is automatically reviewed, tested, and verified the second it is written.

2. The Mechanics: Webhooks and APIs

How does the editor know when you have finished a chapter? They use a Webhook.

What is a Webhook?

It is an "Automated Notification." When you push code to GitHub, GitHub sends a small message to Jenkins that says: "Hey! Something changed in the 'Payments' branch. You should go and check it." This is much better than the editor constantly "Calling" you every 5 minutes to ask if you are done (which is called Polling). Webhooks ensure that the "Build" starts in milliseconds, giving you the fast feedback that defines a high-performance team.

3. The GitHub App vs. The Personal Token

A senior architect chooses the GitHub App method for enterprise integration.

  • The Personal Token: Is tied to one specific human. If that human leaves the company, the Jenkins integration breaks.
  • The GitHub App: Is a "Machine Identity." It is owned by the organization. It has specialized permissions (like the power to "Comment on Pull Requests") that a normal token doesn't have. This provides a more stable, secure, and professional connection between your code and your automation.

Summary

  • GitHub integration establishes a real-time collaborative link between source code and CI/CD
  • Webhooks act as instant notifications that trigger builds the moment code is pushed
  • Integrating Jenkins with GitHub replaces manual polling with event-driven automation
  • GitHub Apps provide a secure, organization-level "machine identity" for the integration
  • Pull Request integration allows Jenkins to report test results directly back to the developer
  • Automated reviews ensure that "dirty" code never reaches the main branch or production
  • The Git plugin (from Module 8) serves as the underlying engine for this collaborative flow

In the next file, 02-gitlab-integration.md, you will learn how to achieve this same flow within the GitLab ecosystem.

←Previous ModuleSecurity