Skip to content

Chapter 4 of 10

Jobs and Pipelines

Choose between freestyle jobs and durable pipelines, then organize stages and artifacts.

38 minutes 10 quick checksBy Subha Prasad
Lesson 4 of 10Course navigation

Lesson content

Read, practise, then check your understanding

Jobs and Pipelines

Freestyle jobs configure source, triggers, build steps, and post-build actions through the UI. They remain useful for small legacy tasks. Pipelines express multi-stage delivery in code, support review and reuse, and can resume around controller interruptions.

Core ideas

  • A stage groups meaningful work such as Build, Verify, Package, or Deploy.
  • A step performs one operation through Pipeline syntax or a plugin-provided command.
  • A workspace contains the checked-out source and temporary build files on an agent.
  • Artifacts are retained build outputs; stashes are temporary files intended for movement between stages in one run.

How it works

Prefer one pipeline per releasable component with fast validation early. Run independent work in parallel where resource use stays reasonable. Archive only necessary outputs, publish reports even after failures, and make deployments consume a specific immutable build result.

Configuration example

pipeline {
  agent any
  stages {
    stage('Verify') {
      parallel {
        stage('Unit') { steps { sh 'npm test' } }
        stage('Lint') { steps { sh 'npm run lint' } }
      }
    }
    stage('Package') {
      steps {
        sh 'npm pack'
        archiveArtifacts artifacts: '*.tgz', fingerprint: true
      }
    }
  }
}

The sample is intentionally small. In a real installation, replace hostnames, labels, credentials, retention, and commands with reviewed values from your own platform standards.

Production guidance

  • Use descriptive job and stage names so dashboards and notifications communicate intent.
  • Set build retention to control disk use while preserving required audit evidence.
  • Do not use one mutable workspace as the handoff between independent jobs. Use immutable artifacts.

The chapter quiz follows this lesson and tests both terminology and safe operating choices.

Knowledge check

Answer every question correctly to complete this chapter.

Which statement correctly describes freestyle job?
Which term matches this explanation: A UI-configured job assembled from build steps and post-build actions.
Which statement correctly describes pipeline?
Which term matches this explanation: A durable sequence of delivery stages expressed as code.
Which statement correctly describes stage?
Which term matches this explanation: A named logical phase such as Build, Test, or Deploy.
Which statement correctly describes workspace?
Which term matches this explanation: A node directory where source and build files are materialized.
Which statement correctly describes build result?
Which term matches this explanation: The final state such as SUCCESS, UNSTABLE, FAILURE, or ABORTED.

0 of 10 checks passed

Your progress is saved on this device.

Jobs and Pipelines | Jenkins Lesson | Subha Prasad