Jenkinsfile Validator
Validate, lint, audit, or check Jenkinsfiles and shared libraries.
- Skill ID
- akin-ozer/cc-devops-skills/jenkinsfile-validator
- Publisher
- akin-ozer
- Repository
- cc-devops-skills
- Installs
- 0
- Files
- 25
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
akin-ozer/cc-devops-skills/jenkinsfile-validatorInstalls these files- SKILL.md
- examples/bad-declarative-pipeline.Jenkinsfile
- examples/bad-scripted-pipeline.Jenkinsfile
- examples/declarative-docker.Jenkinsfile
- examples/declarative-kubernetes.Jenkinsfile
- examples/declarative-parallel.Jenkinsfile
- examples/declarative-unknown-plugins.Jenkinsfile
- examples/scripted-basic.Jenkinsfile
- examples/scripted-conditional.Jenkinsfile
- examples/scripted-docker.Jenkinsfile
- examples/shared-library/src/com/example/BuildConfig.groovy
- examples/shared-library/vars/BadStep.groovy
- examples/shared-library/vars/buildApp.groovy
- references/best_practices.md
- references/common_plugins.md
- references/declarative_syntax.md
- references/scripted_syntax.md
- scripts/best_practices.sh
- scripts/common_validation.sh
- scripts/validate_declarative.sh
- scripts/validate_jenkinsfile.sh
- scripts/validate_scripted.sh
- scripts/validate_shared_library.sh
- tests/run_local_ci.sh
- tests/test_validate_jenkinsfile.sh
What this skill tells the agent
Jenkinsfile Validator Skill
Use this skill to validate Jenkins pipelines and shared libraries with local scripts first, then optionally enrich findings with plugin documentation.
Trigger Phrases
Use this skill when requests look like:
- "Validate this Jenkinsfile"
- "Check this pipeline for security issues"
- "Lint my Declarative/Scripted pipeline"
- "Why is this Jenkins pipeline failing syntax checks?"
- "Validate vars/.groovy or src//.groovy shared library files"
Scope
This skill validates:
- Declarative pipelines (
pipeline { ... }) - Scripted pipelines (
node { ... }and Groovy-style pipelines) - Shared library files (
vars/*.groovy,src/**/*.groovy) - Hardcoded credential patterns
- Pipeline best practices and maintainability signals
Prerequisites
Run commands from repository root unless noted.
Required tools
bashgrepsedawkheadwcfind(needed for shared-library directory scans)
Recommended tools
jq(optional; improves JSON-heavy troubleshooting workflows)
Script prerequisites
- Scripts live in
devops-skills-plugin/skills/jenkinsfile-validator/scripts/ - Main orchestrator can run child scripts even if
+xis missing (it usesbashfallback) - If you want direct execution (
./script.sh), make scripts executable:
chmod +x devops-skills-plugin/skills/jenkinsfile-validator/scripts/*.shPreflight check (recommended)
SKILL_DIR="devops-skills-plugin/skills/jenkinsfile-validator"
command -v bash grep sed awk head wc find >/dev/null && echo "required tools: ok" || echo "required tools: missing"
command -v jq >/dev/null && echo "jq: installed (optional)" || echo "jq: missing (optional)"
[ -d "$SKILL_DIR/scripts" ] && echo "scripts dir: ok" || echo "scripts dir: missing"
[ -f "$SKILL_DIR/scripts/validate_jenkinsfile.sh" ] && echo "main validator: ok" || echo "main validator: missing"Quick Start (Normalized Paths)
Use a single base path variable to avoid path ambiguity.
SKILL_DIR="devops-skills-plugin/skills/jenkinsfile-validator"
TARGET_JENKINSFILE="Jenkinsfile"
# Full validation (recommended)
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" "$TARGET_JENKINSFILE"Common options
SKILL_DIR="devops-skills-plugin/skills/jenkinsfile-validator"
TARGET_JENKINSFILE="Jenkinsfile"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --syntax-only "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --security-only "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --best-practices "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --no-security "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --no-best-practices "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --strict "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --assume-declarative "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_jenkinsfile.sh" --assume-scripted "$TARGET_JENKINSFILE"Shared library validation
SKILL_DIR="devops-skills-plugin/skills/jenkinsfile-validator"
bash "$SKILL_DIR/scripts/validate_shared_library.sh" vars/myStep.groovy
bash "$SKILL_DIR/scripts/validate_shared_library.sh" vars/
bash "$SKILL_DIR/scripts/validate_shared_library.sh" src/
bash "$SKILL_DIR/scripts/validate_shared_library.sh" /path/to/shared-libraryRegression and local CI checks
SKILL_DIR="devops-skills-plugin/skills/jenkinsfile-validator"
bash "$SKILL_DIR/tests/run_local_ci.sh"run_local_ci.sh is the supported local/CI entrypoint for regression coverage. It runs:
bash -nsyntax checks for allscripts/*.shandtests/*.shfilestests/test_validate_jenkinsfile.shregression scenarios
Deterministic Validation Flow
1) Detect pipeline type
pipeline {=> Declarative validatornode (...)ornode {=> Scripted validator- Unknown => fails closed by default (
ERROR [TypeDetection]) - Override intentionally ambiguous files with
--assume-declarativeor--assume-scripted
2) Run syntax validation
- Declarative:
validate_declarative.sh - Scripted:
validate_scripted.sh
3) Run security scan
common_validation.sh check_credentials
4) Run best practices check
best_practices.sh
5) Aggregate and return final status
- Unified summary with pass/fail per phase and final exit code
6) Run regression suite after script changes
bash tests/run_local_ci.sh- Intended for both local pre-commit checks and CI job wiring
Individual Script Commands (Advanced)
SKILL_DIR="devops-skills-plugin/skills/jenkinsfile-validator"
TARGET_JENKINSFILE="Jenkinsfile"
# Type detection
bash "$SKILL_DIR/scripts/common_validation.sh" detect_type "$TARGET_JENKINSFILE"
# Syntax-only by type
bash "$SKILL_DIR/scripts/validate_declarative.sh" "$TARGET_JENKINSFILE"
bash "$SKILL_DIR/scripts/validate_scripted.sh" "$TARGET_JENKINSFILE"
# Security-only
bash "$SKILL_DIR/scripts/common_validation.sh" check_credentials "$TARGET_JENKINSFILE"
# Best-practices-only
bash "$SKILL_DIR/scripts/best_practices.sh" "$TARGET_JENKINSFILE"Exit Code and Log Interpretation
Main orchestrator: validate_jenkinsfile.sh
0: Validation passed1: Validation failed (syntax/security errors, or warnings in--strictmode)2: Usage or environment error (bad args, missing file, missing required tools)
Sub-scripts
validate_declarative.sh:0pass (errors=0),1usage/file/validation failurevalidate_scripted.sh:0pass (errors=0),1usage/file/validation failurecommon_validation.sh check_credentials:0no credential errors,1credential issues foundvalidate_shared_library.sh:0pass,1validation errors found,2invalid input targetbest_practices.sh:1only for usage/file errors; content findings are reported in logs and score output
Log severity patterns
ERROR [Line N]: ...=> must fixWARNING [Line N]: ...=> should reviewINFO [Line N]: ...=> optional improvement- Summary banners (
VALIDATION PASSED/FAILED) determine final interpretation quickly
Practical interpretation rules
- For CI gating, rely on main orchestrator exit code.
- Use
--strictwhen warnings should fail pipelines. - When
best_practices.shis run standalone, read report sections (CRITICAL ISSUES,IMPROVEMENTS RECOMMENDED, score); do not rely only on exit code.
Fallback Behavior
Missing optional tools
- If
jqis missing, continue validation; treat as non-blocking.
Non-executable child scripts
- Main orchestrator warns and falls back to
bash <script>execution.
Missing child scripts
- Main orchestrator reports runner error and returns failure for that phase.
Unknown plugin steps
Use this order:
- Check local reference:
devops-skills-plugin/skills/jenkinsfile-validator/references/common_plugins.md - Context7 lookup:
mcp__context7__resolve-library-idwith query likejenkinsci <plugin-name>-pluginmcp__context7__query-docsfor usage and parameters
- Web fallback: plugins.jenkins.io and official Jenkins docs
Offline/air-gapped mode
- Run all local validators.
- If plugin docs cannot be fetched, report: "Plugin docs lookup skipped due to environment constraints; local validation only."
Plugin Documentation Lookup Workflow
When plugin-specific validation is requested:
- Identify unknown steps from Jenkinsfile or validator logs.
- Check
references/common_plugins.mdfirst. - If missing, use Context7 (
resolve-library-idthenquery-docs). - If still missing, use web search against official plugin index/docs.
- Return required parameters, optional parameters, version-sensitive notes, and security guidance.
References
Local references:
devops-skills-plugin/skills/jenkinsfile-validator/references/declarative_syntax.md
More from akin-ozer
Use this skill in a project
Open any RiverX project, search the Skills panel for akin-ozer/cc-devops-skills/jenkinsfile-validator, and install it in one click.
