# Jenkins

> The long-standing self-hosted automation server, with pipelines as code in Jenkinsfiles and a huge plugin ecosystem. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/jenkins
Last updated: 2026-11-28

The long-standing self-hosted automation server, with pipelines as code in Jenkinsfiles and a huge plugin ecosystem.

Intermediate · about 7 hours · difficulty 3/5

Learn first: [Continuous Integration and Delivery](https://www.internhack.in/roadmaps/tracks/devops/ci-cd-concepts)

**Jenkins** is open source, self-hosted and extremely flexible. It predates cloud CI services, so it runs in countless enterprises, and maintaining it is a common DevOps task.

### Architecture

- A **controller** schedules work and hosts the UI; **agents** (static VMs, Docker containers or Kubernetes pods) run the builds.
- Features come from **plugins**: Git, credentials, Kubernetes agents, Blue Ocean, and hundreds more. Plugins are both the strength and the main maintenance burden.

### Pipelines as code

A `Jenkinsfile` in the repository defines the pipeline:

- **Declarative** syntax: `pipeline { agent ..., stages { stage('Test') { steps { ... } } } }`, with `post` blocks for cleanup and notifications.
- **Scripted** syntax is full Groovy, more powerful but harder to review.
- **Multibranch pipelines** discover branches and pull requests automatically.
- **Shared libraries** keep common steps in one versioned repository.

### Running Jenkins well

- Never run builds on the controller; use ephemeral agents.
- Configure the instance as code with **Configuration as Code (JCasC)** and pin plugin versions.
- Store secrets in the credentials store or an external vault, and bind them only to the steps that need them.
- Back up `JENKINS_HOME`, keep plugins patched and restrict script approval.

**Good enough to move on:** you can run Jenkins in a container with Kubernetes or Docker agents, write a declarative multibranch Jenkinsfile, and explain how you would keep the instance patched and reproducible.

## Key concepts

- **Controller and agents**
- **Declarative Jenkinsfile**
- **Multibranch pipelines**
- **Credentials and secret binding**
- **Shared libraries**
- **Configuration as Code (JCasC)**
- **Plugin management**

## Other options for this step

- [GitHub Actions](https://www.internhack.in/roadmaps/tracks/devops/github-actions): Build pipelines as YAML workflows triggered by repository events, using jobs, reusable actions, secrets and OIDC to the cloud.
- [GitLab CI/CD](https://www.internhack.in/roadmaps/tracks/devops/gitlab-ci): Pipelines defined in .gitlab-ci.yml with stages, jobs, runners and environments, tightly integrated with GitLab's registry and security tools.

## Mini project

Run Jenkins with JCasC in Docker, add an ephemeral Docker or Kubernetes agent, and create a multibranch pipeline that tests, builds an image and archives test reports.

## Check yourself

Why should builds never run on the Jenkins controller itself?

## Free resources

- [Jenkins user documentation](https://www.jenkins.io/doc/) (Jenkins)
- [Pipeline syntax](https://www.jenkins.io/doc/book/pipeline/syntax/) (Jenkins)

Previous: [GitLab CI/CD](https://www.internhack.in/roadmaps/tracks/devops/gitlab-ci) · Next: [Artifact and Package Management](https://www.internhack.in/roadmaps/tracks/devops/artifact-management)

## More in CI/CD Pipelines and Release Strategies

- [Continuous Integration and Delivery](https://www.internhack.in/roadmaps/tracks/devops/ci-cd-concepts)
- [GitHub Actions](https://www.internhack.in/roadmaps/tracks/devops/github-actions)
- [GitLab CI/CD](https://www.internhack.in/roadmaps/tracks/devops/gitlab-ci)
- [Jenkins](https://www.internhack.in/roadmaps/tracks/devops/jenkins)
- [Artifact and Package Management](https://www.internhack.in/roadmaps/tracks/devops/artifact-management)
- [Deployment Strategies and Feature Flags](https://www.internhack.in/roadmaps/tracks/devops/deployment-strategies)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
