Jenkins cheat sheet

Jenkins is a customizable CI/CD automation server.

On this page

Table of contents

Use this page for fast recall. Use Full documentation when you want the complete end-to-end path.

Quick workflow

A simple 5-step flow you can follow when using Jenkins in real work.

1) Setup

Install/run the tool and confirm version. Create a minimal config.

2) Small change

Do one small action end-to-end to prove the workflow.

3) Validate

Check output, logs, and status. Catch mistakes early.

4) Automate

Convert it into a repeatable script or pipeline step.

5) Productionize

Add safety: secrets, rollback, observability, and docs.

Workflows you will actually reuse

These are practical sequences you can copy into your own checklist or runbook.

Pipeline as code (Jenkinsfile)

Goal: Keep build/deploy logic in git with reviews and repeatability.

- Create a Jenkinsfile in repo.

- Use agents and credentials bindings instead of hardcoding secrets.

- Archive artifacts and publish test reports.

- Add stages for build, test, and deploy with approvals for prod.

- Backup Jenkins home and lock down plugins and admin access.

Key Concepts

- Pipelines

- Agents

- Plugins

Learning path (high-level):

- Pipeline basics

- Agent setup

- Secure production Jenkins

Quick Start

Run Jenkins

Command

docker run -p 8080:8080 jenkins/jenkins:lts

Unlock admin panel

Create first pipeline

Common Commands

Short descriptions and practical intent. Search, filter, copy, and reuse.

Showing 6

Ops
curl -I http://localhost:8080/login

Check Jenkins availability.

Ops
docker logs <jenkins-container>

View Jenkins container logs.

Ops
docker exec -it <jenkins-container> bash

Shell inside Jenkins container.

Setup
cat /var/jenkins_home/secrets/initialAdminPassword

Read initial admin password.

CLI
java -jar jenkins-cli.jar -s http://localhost:8080/ help

Check Jenkins CLI commands.

Plugins
jenkins-plugin-cli --plugins git workflow-aggregator

Install plugins for image builds.

Copyable snippets

Small blocks you can drop into your terminal, config, or runbook.

Minimal Jenkinsfile (build + test)

text

pipeline {
  agent any
  stages {
    stage('Install') { steps { sh 'npm ci' } }
    stage('Build') { steps { sh 'npm run build' } }
  }
}

Troubleshooting checklist

When things break, follow this order to stay calm and move fast.

- If builds get stuck: check executor availability and agent connectivity.

- If plugins break: pin versions and test upgrades in staging Jenkins first.

Pitfalls

The common mistakes that slow people down when using Jenkins.

- Copy-pasting commands without understanding inputs/outputs and side effects.

- Not documenting defaults (ports, paths, credentials) and then getting stuck in prod.

- Skipping logs and metrics when troubleshooting; always collect evidence first.

Mini lab (practice)

Do these tasks in order. You will feel the tool instead of just reading about it.

- Install or run the tool locally (or in Docker) and verify it works with a hello-world action.

- Create a minimal config and run the most common command 3 times (with a small change each time).

- Break something on purpose and document how you debugged it in your Notes.

Interview prompts

Use these to test if you truly understand the basics (and can explain them clearly).

- Explain the tool’s role in a real CI/CD pipeline from commit to production.

- Describe the most common failure you’ve seen with this tool and how you fixed it.

- What would you monitor/alert on for this tool in production?

Official Docs

https://www.jenkins.io/doc/