Course contentsShow
← Cloud and Infrastructure
Lesson 1773 of 2,98937. JenkinsFree lesson

Jenkins Jobs and Build Triggers

Create Jenkins jobs, configure source code management integration, and set up triggers like SCM polling and webhooks.

Jenkins Jobs and Build Triggers

What you'll learn: How to create Jenkins jobs, connect them to your source code repositories, and automatically start builds when code changes.

What Is a Jenkins Job?

A Jenkins job (also called a "project") is a runnable task that Jenkins executes. Think of it as a recipe: you define what steps Jenkins should perform, like fetching code, running tests, or building artifacts. Jobs are the fundamental units of work in Jenkins.

Creating Your First Job

In Jenkins, you'll typically create a Freestyle project (the simplest type) through the web UI:

  1. Click "New Item"
  2. Enter a name and select "Freestyle project"
  3. Configure the job's settings

Source Code Management Integration

Jenkins connects to your repositories (Git, GitHub, GitLab, etc.) through the Source Code Management (SCM) section. You provide:

  • Repository URL (e.g., https://github.com/yourname/repo.git)
  • Credentials (if private)
  • Branch to build (e.g., main or */develop)

Jenkins will clone this repository into the workspace before running your build steps.

Build Triggers: When Should Builds Run?

Build triggers determine when a job executes:

  • Manual: You click "Build Now" (no automation)
  • SCM Polling: Jenkins regularly checks the repository for changes (e.g., every 5 minutes). If new commits exist, a build starts. Configure with cron-like syntax: H/5 * * * *
  • Webhooks: The repository notifies Jenkins immediately when code is pushed (faster and more efficient than polling). Requires configuring a webhook in GitHub/GitLab pointing to your Jenkins instance.

Analogy: Polling is like checking your mailbox every hour; webhooks are like getting a doorbell notification the moment mail arrives.

Key Takeaway: Jenkins jobs define what to build, SCM integration defines where to get code, and triggers define when to build—with webhooks being the preferred real-time approach over periodic polling.