Ravindra BagaleCourses & study guides Track your progress

Guides

Jenkins Pipeline for Beginners

Read this guide in: English · मराठी · हिंदी

Why do we need a Jenkins Pipeline? Because there is a real problem between developers and operations when the company runs CI on its own server. Developers want automatic checks. Operations — the employee on the server side — often owns the Jenkins controller. A Jenkinsfile describes the same stages as code: checkout, run steps, fail early — then Build Now and read Console Output.

Friends, Jenkins is still common at Infosys-style clients. First see who owns the controller. Then the Declarative skeleton sticks.

Quick answer

Hold this vertical picture:

  1. Developer — wants pipeline-as-code next to the app.
  2. Operations — server-side person who often administers Jenkins.
  3. The problem — manual builds / “run it on my machine” / no shared console log.
  4. Jenkins Pipeline — Declarative Jenkinsfile + Build Now.
  5. Pocket line: stages in Git (or pasted script) → Build Now → read console.

Language: English · मराठी · हिंदी

Why do we need Jenkins Pipeline?

  1. Many companies already have Jenkins for CI/CD.
  2. Operations on the server side needs one place to see build history.
  3. Pipeline-as-code stops “click the UI differently every Friday.”

Need a Jenkins you are allowed to use (lab VM/container). Do not scan servers you do not own. Basic Git. Compare: GitHub Actions.

What does operations have to do with Jenkins?

  1. Operations often installs plugins, agents, and credentials on the controller.
  2. Developers write the Jenkinsfile; both read Console Output when red.
  3. Prefer Jenkinsfile in Git so reviews travel with the app.

What is the problem? Suppose we are…

Suppose we are building Instagram (like updates)

Suppose every profile change is “built” by whoever remembers the local script. Operations has no Jenkins history when production breaks.

Suppose we are working at Netflix and we are giving updates

Suppose high-frequency updates need the same stages every time. A Declarative pipeline is that checklist as code.

Suppose you are working in Infosys on a client project

Suppose the client’s operations team already runs Jenkins. Your job is a Pipeline job + Jenkinsfile they can audit — not a private laptop ritual.

GitHub Actions CI pipeline on every push A git push starts a workflow from .yml: checkout the repo, run job steps on a runner, then report pass or fail. git push to main Workflow ci.yml on: push Job · runner 1. checkout 2. ls / test 3. report Result ✓ pass / fail CI proof before deploy Diagram of the YAML idea — no live GitHub login required to learn the shape

A git push starts a workflow from .yml: checkout on a runner, run steps, report pass or fail.

How Jenkins answers that same fight

Declarative skeleton:

pipeline {
  agent any
  stages {
    stage('Checkout') {
      steps { checkout scm }
    }
    stage('Check') {
      steps { sh 'ls -la' }
    }
  }
}

Steps in Jenkins UI:

  1. Open Jenkins and sign in (lab URL you administer).
  2. New Item → name like client-ci → Pipeline → OK.
  3. Definition: Pipeline script (paste skeleton) or Pipeline script from SCM (real projects).
  4. Build Now → open build → Console Output.
  5. Add a failing check once (sh 'test -f README.md') and learn to read the red log.
  6. Store the Jenkinsfile next to application code for review history.

Ravindra Bagale's Tip

Students install twenty plugins on day one and break the controller. Use Declarative with sh steps you understand. Stable beats fancy. Lakshat theva.

What you should see

  1. Build history blue/green (success) or red (failure).
  2. Console Output prints each sh command and exit code.
  3. Stage view lists Checkout → Check in order.

Common errors — story pain then fix

Pain from the stories Likely cause Fix
checkout scm fails in script-only job No SCM configured Plain sh steps, or Pipeline from SCM
sh not found on Windows agent Agent OS Unix agent or bat on Windows
Permissions denied writing workspace Agent user rights Fix agent user — never unsafe world-writable modes
Pipeline syntax error Missing braces Start from the skeleton
Slow builds Heavy tools every run Keep first lab tiny

Samajla ka? Why Jenkins = company-owned CI where operations and developers share Console Output; Instagram / Netflix / Infosys “suppose”; Jenkinsfile = pipeline as code. Build Now, read the console.

Frequently asked questions

What is Jenkins?

An open-source automation server commonly used for CI/CD pipelines.

What is a Jenkinsfile?

A text file (usually in Git) that defines the Pipeline as code.

Declarative vs Scripted?

Declarative pipeline { } is the beginner-friendly syntax. Scripted is more Groovy-heavy.

Jenkins vs GitHub Actions?

Actions lives inside GitHub. Jenkins is a separate server you operate — useful in many companies.

What is an agent?

Where the stages run — built-in node or a labelled worker.

Is Jenkins only for Java?

No. Pipelines can run shell, Docker, Node, Python and more.