Back to cheat sheet hub

Jenkins Cheat Sheet

A concise pipeline reference for using Jenkins in test automation workflows, including staged execution and report handling.

Selenium Module 9 AI Module 6 Pipelines

Jenkins in One Line

Jenkins automates build, test, report, and deployment steps through repeatable jobs and pipelines.

commit -> Jenkins job -> tests -> reports -> notifications

Job Types

Know the difference between freestyle jobs and pipelines.

Common options:
- freestyle
- declarative pipeline
- scripted pipeline
- multibranch pipeline

Jenkinsfile Basics

Pipelines-as-code keep CI logic versioned alongside the framework.

pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'npm test'
      }
    }
  }
}

Stages

Split the pipeline into meaningful checkpoints.

Typical stages:
- checkout
- build / install
- execute tests
- publish reports
- notify

Agents

Agents define where the pipeline or stage will actually run.

agent any
agent { label 'linux' }

Artifacts and Reports

Always publish execution evidence so failures can be investigated later.

Useful outputs:
- ExtentReports
- Playwright HTML report
- screenshots
- logs

Parameters and Environments

Parameterized pipelines help teams choose browser, environment, or suite type at runtime.

Common parameters:
- environment
- browser
- suite type
- retry mode

Notifications

Close the feedback loop so the right people know when the pipeline breaks.

Notify via:
- email
- Slack
- Teams
- issue comments

AI Integration Angle

Jenkins pipelines can also include AI summary or failure triage steps when appropriate.

Examples:
- summarize failures
- cluster repeated errors
- draft release-test status