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.
Nightly scheduled workflow
Run audits, backups, smoke tests, or dependency checks on a schedule.