What is Jenkins?

Jenkins is a free, open-source automation server that runs your CI/CD pipelines.

Jenkins is an open-source automation server written in Java. It is the most widely used tool for building CI/CD pipelines and has been around since 2011 (originally as Hudson).

Why people use Jenkins

  • Free and open source — no license cost.
  • Extensible — over 1,800 plugins connect it to Git, Docker, Kubernetes, cloud providers, and more.
  • Pipeline as code — you describe your whole pipeline in a text file called a Jenkinsfile that lives with your source code.
  • Platform independent — runs on Windows, Linux, macOS, or inside Docker.

What Jenkins actually does

Jenkins watches your source code repository. When something changes, it automatically checks out the code, runs the steps you defined (compile, test, package, deploy), and reports whether everything passed or failed.

Example

Example · bash
# Jenkins is a server you talk to through a web browser.
# Once running, open it at:
http://localhost:8080

# It listens for events and runs your automated jobs.
# You configure everything through the web UI or a Jenkinsfile.

When to use it

  • A Java shop runs Maven builds on Jenkins after every commit to detect compilation errors immediately.
  • An ops team uses Jenkins to schedule nightly database backups via a shell-script job.
  • A startup uses Jenkins as the central hub that chains Docker builds, test runs, and Kubernetes deploys together.

More examples

Start Jenkins with Docker

Launches a Jenkins server using the official LTS Docker image and maps port 8080 for the web UI.

Example · bash
docker run --name jenkins \
  -d -p 8080:8080 \
  jenkins/jenkins:lts
# Open http://localhost:8080 in your browser

Trigger a job via REST API

Uses the Jenkins built-in REST API to trigger a build remotely with an API token.

Example · bash
curl -X POST \
  http://localhost:8080/job/my-app/build \
  --user admin:$API_TOKEN

List all jobs with CLI jar

Uses the Jenkins CLI tool to list all configured jobs on the server from a terminal.

Example · bash
wget -q http://localhost:8080/jnlpJars/jenkins-cli.jar
java -jar jenkins-cli.jar \
  -s http://localhost:8080 \
  -auth admin:$TOKEN \
  list-jobs

Discussion

  • Be the first to comment on this lesson.