Git Course 0%

Pipeline, job, runner, artifact, environment

Beginner Core Git ≈ 8 min

What you will learn

  • What each term means and how the pieces relate
  • The GitLab and GitHub words for the same thing
  • Why a job that works locally can fail on a runner

After this lesson you can

  • I can read a pipeline page and describe what is happening

Why this matters

Every conversation about automation uses these words, and most of them mean something slightly different on each platform. Ten minutes here makes the rest of the section, and every pipeline page you ever open, readable.

How the pieces fit

The anatomy of a pipeline A push starts a pipeline. The pipeline contains two stages that run in order: check, then deploy. The check stage contains two jobs that run at the same time, lint docs and tests. The deploy stage contains one job, pages, which only runs if both check jobs passed. Each job runs on a runner, which is a machine, and a job can keep files as artifacts. Labels explain that stages run one after another, jobs inside a stage run at the same time, and the whole pipeline is red if any job fails. git push or a merge request PIPELINE — one run, everything below stage: check job: lint-docs npx markdownlint-cli job: tests python -m unittest stage: deploy job: pages publishes the built site artifact: public/ only if both pass jobs in a stage run at the same time stages run one after another Runner the machine a job runs on, fresh each time, from an image Artifact a file a job keeps: a report, a built site, a test result Red pipeline any job failed; the merge button locks until it is green GitHub uses the same shapes with different words: a workflow of jobs made of steps, ordered with "needs" instead of stages.
A push starts a pipeline; stages run in order; jobs inside a stage run together; each job runs on a runner and can keep artifacts.

The words

Word Means
Pipeline Everything that runs for one trigger: all the stages and jobs together
Stage A phase, such as check or deploy; stages run one after another
Job One unit of work, such as tests; jobs in the same stage run at the same time
Step One command inside a job (GitHub's word; GitLab calls these script lines)
Runner The machine that executes a job, usually a fresh container from an image
Image The starting environment for a job: python:3.13-slim, node:20
Artifact A file a job produces and keeps: a report, a built site, a test result
Cache Files kept between runs to save time, such as downloaded dependencies
Variable A value given to a job, sometimes secret (lesson 9.12)
Environment A named place a job deploys to: staging, production (lesson 14.6)
Deployment One act of putting a build into an environment
Status check The pipeline result as seen by the merge request (lesson 14.7)

GitLab and GitHub, side by side

Concept GitLab GitHub
The whole run Pipeline Workflow run
The file .gitlab-ci.yml .github/workflows/*.yml
A phase Stage Expressed with needs between jobs
A unit of work Job Job
A command A line under script A step with run
A reusable piece include, templates An action, used with uses
The machine Runner Runner
Kept files Artifact Artifact
A secret CI/CD variable Actions secret

The terminology map has the full comparison.

Artifacts, briefly

An artifact is how a job hands something to a human or to a later job. Three common uses:

  • A built site, passed to the deployment job. The site you are reading is published this way.
  • A test or coverage report, downloadable from the job page, which is where "the tests passed but what did they check?" is answered.
  • A rendered preview of documentation, which lets a reviewer read the change as a page rather than as a diff.

Artifacts expire, usually after days or weeks, so a link to one in a review comment goes stale. Say what it showed, not just where it was.

Why a job fails when your machine is fine

This is the most common confusion for someone new to CI, and it has four usual causes:

Cause How it shows
Different version The image pins Python 3.12 and you have 3.13, or the reverse
A missing dependency It is installed on your machine and not in the image
A file you never committed The runner clones the repository, and it does not have your uncommitted work
A different working directory or environment variable Paths and settings differ from your shell

The third is worth remembering: the runner only sees what is committed and pushed. "It works on my machine" is often literally true and means a file is missing from the commit.

Reading a pipeline page

Whatever the platform, the same three questions:

  1. Which job failed? The pipeline page tells you this and nothing else useful.
  2. Where in that job? Open it and find the failed step or the end of the log.
  3. Is it mine? Does the error name a file I changed, and does the same job fail on main?

How to do it

The vocabulary is on the platform, but the most useful command is the one that shows you what the jobs actually run:

Terminal
$ cat .gitlab-ci.yml

Every script line is a command you can run yourself, in your own shell, before pushing.

Common mistakes

  • Confusing stage and job. The stage failed because a job in it did; the job is where the log is.
  • Thinking a skipped job failed. Skipped means an earlier stage stopped, or a rule excluded it.
  • Expecting the runner to see uncommitted files. It clones what you pushed.
  • Linking to an artifact in a review comment and assuming it will still be there next month.
  • Assuming a green pipeline means the change is correct. It means the checks that exist passed.

Try it yourself

Goal: map the vocabulary onto a real pipeline.

  1. Open your project's most recent pipeline or workflow run.
  2. Write down its stages (or job dependencies), its jobs, and which image each job uses.
  3. Find one job's log and identify where the setup ends and the real work begins.
  4. Find any artifacts the run produced, and note when they expire.
  5. Take one script or run line and execute it in your own terminal.

Expected result: a description of the pipeline in the words from this lesson, and one of its checks running on your machine.

Show solution

Step 5 is the habit worth taking away. A pipeline is not magic infrastructure: it is a list of commands someone wrote down, running on a clean machine. Once you have run one of them yourself, the whole thing stops being opaque.

Check yourself

1. Jobs in the same stage:
2. Your tests pass locally and fail on the runner. What is the most common cause worth checking first?
3. What is an artifact?

Key terms

Pipeline Artifact Environment Build Logs (program output)