Configures Jenkins declarative pipeline test stages - `Jenkinsfile` with stages, parallel + per-agent execution, post-actions (always / failure / success), pipeline-junit-plugin for test reports, lockable resources for shared infra. Use for Jenkins-based CI (common in enterprise / regulated environments).
76
95%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Deeper recipes split out of jenkinsfile-test-stages SKILL.md:
serializing shared infrastructure, injecting environment plus
masked credentials, and scheduling / multi-branch behavior.
pipeline {
agent any
stages {
stage('Integration') {
steps {
lock(resource: 'shared-test-database') {
sh 'npm run test:integration'
}
}
}
}
}lock(...) uses the Lockable Resources Plugin to serialize
access to shared resources (test DB, license-locked tool, etc.).
pipeline {
agent any
environment {
CI = 'true'
NODE_ENV = 'test'
}
stages {
stage('Test') {
steps {
withCredentials([string(credentialsId: 'npm-auth-token', variable: 'NODE_AUTH_TOKEN')]) {
sh 'npm ci && npm test'
}
}
}
}
}withCredentials([...]) masks secrets in build logs.
pipeline {
agent any
triggers {
cron('0 4 * * *') // daily at 4 AM
pollSCM('*/15 * * * *') // poll every 15 min (or use webhook)
}
options {
timeout(time: 30, unit: 'MINUTES')
timestamps()
ansiColor('xterm')
buildDiscarder(logRotator(numToKeepStr: '20'))
}
stages { /* ... */ }
}Per-branch behavior via Multibranch Pipeline job type (separate config in Jenkins UI).