CI/CD Pipelines: Foundations and Examples/Minimal Jenkins declarative pipeline

Run checkout, install, test, and build in a Jenkinsfile.

Section: Pipeline building blocks

Minimal Jenkins declarative pipeline

groovy
groovy
pipeline {
  agent any

  stages {
    stage('Checkout') {
      steps { checkout scm }
    }
    stage('Install') {
      steps { sh 'npm ci' }
    }
    stage('Test') {
      steps { sh 'npm test' }
    }
    stage('Build') {
      steps { sh 'npm run build' }
    }
  }
}
Explanation

Jenkins supports declarative and scripted pipeline syntax. Declarative is easier to read and standardize.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Pipeline building blocks
Minimal GitHub Actions pipeline
Build and test on pushes and pull requests.
OpenIn sheetyamlsame section
Minimal GitLab CI pipeline
Run install, test, and build using stages.
OpenIn sheetyamlsame section
Validate pull requests only
Run CI before code reaches main.
Deploy only from main
Restrict production deployment to your protected main branch.
Nightly scheduled workflow
Run audits, backups, smoke tests, or dependency checks on a schedule.