TOPIC 13/1916 MINNOT STARTED

Jenkins part 4: your first Jenkinsfile pipeline

Write a small Jenkinsfile with stages, keep it in source control, make a Pipeline job from it, and read the stage view to see which stage failed.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a bakery checklist on the wall. The list says mix, then bake, then check. The same helper can run it. A board by the door shows which step the current loaf is stuck on. Anyone can read the list. It is not hidden in the baker's head.

The list is the Jenkinsfile. The steps are stages. The board is the stage view.

Tom, a tester at Daily List, a to-do list app, writes the checklist into the project. Leo can review it like any other file.

What it is: A tells Jenkins, a (CI) server, what to do. It is a text file named Jenkinsfile in the project. A declarative stage block is a named part such as Test, and the stage view grid has one column per stage. A freestyle job is the neighbour, and that one is only a form on the website. This file can be reviewed in git.

Why it matters: A job that only exists in the Jenkins form cannot be reviewed in a . Tom can change a step without a written history. The Jenkinsfile puts the Daily List pipeline next to the tests, so Mei can read every stage before it runs.

PLAIN WORDS · 1 in this section
declarative
saying what should be true, not the steps

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB A bakery line with a checklist on the wall.

  1. Checklist
  2. Jobs
  3. Board
Bakery line

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
The checklist on the wallThe Jenkinsfile
One job on the listA stage
Doing the jobA step
The board by the doorThe stage view

WHERE THIS PICTURE STOPS

  • A checklist is on paper, but a Jenkinsfile is kept with the code.
  • A baker may skip a job, but Jenkins runs the stages in order.
  • A board shows loaves, but the stage view shows runs.

HOOK

Checklist, jobs, board.

TELL A FRIEND

A checklist, jobs and a board.

OFTEN MIXED UP WITH Jenkins part 3: triggers, schedules and parameters. That topic sets timers and choices on a job. This one writes the job as a file with stages and reads the stage view.

PRACTISE AND KEEP

Sources for this topic — 2 sources
  1. Market practice

    Using a Jenkinsfile (Jenkins documentation) ↗ — Jenkins · Jenkins docs say a declarative pipeline is a series of stages. Each stage runs steps. The agent directive is required. The sh step runs a shell command on Unix-like systems. The post section supports conditions such as always

    The official guide to keeping a pipeline in a file that lives with the code. Official project documentation. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Getting started with Pipeline (Jenkins documentation) ↗ — Jenkins · Jenkins docs say you pick Pipeline script from SCM in a Pipeline job. You choose the source control type and repository. The Script Path field names the Jenkinsfile. Each stage becomes a column in the stage view

    The Jenkins page on getting started with Pipeline. In a Pipeline job you choose Pipeline script from SCM as the definition. You pick the source control type and fill in the repository. The Script Path field names the Jenkinsfile and defaults to Jenkinsfile at the root. Each stage becomes a column in the stage view. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.