Versioning Reference
This reference defines how version values are resolved in JSL and how to implement versioning consistently across project types.
JSL Version Resolution (Current Behavior)
From buildServiceProject.groovy, JSL resolves version in this order:
-
If
config.versionis already set (for example fromjenkins.yaml), keep it. -
Else if
pom.xmlexists, readproject.version. -
Else run
./scripts/version.sh. -
If script fails, fallback to
1.0.0.
JSL also derives:
-
config.majorVersionfrom the first segment of the resolved version.
Recommended Versioning Patterns by Project Type
Java / Maven
-
Keep version in
pom.xmlas source of truth. -
Avoid duplicating version in shell scripts unless needed for local tooling.
-
Use release branch process to manage final version transitions.
Migration Checklist
-
Choose one source of truth (
pom.xml,package.json, manifest, tag strategy). -
Implement/validate
scripts/version.shfor non-Maven projects. -
Confirm produced value is semver-compatible with your deployment tooling.
-
Verify image tags, deploy commands, and notifications all use the same version.
-
Guard against fallback
1.0.0in release flows.
Common Failure Modes
-
Script outputs extra text/newlines, causing malformed image tags.
-
Local version bump process differs from CI resolution path.
-
deployVersionis used as a permanent bypass instead of correcting source versioning. -
Snapshot/release naming conventions differ between environments.
Extension Guidance
If you need new version behavior in JSL:
-
Update version resolution logic in
buildServiceProject.groovy(or extracted helper if introduced). -
Keep backward compatibility for Maven +
scripts/version.shflows. -
Add/update tests or validation jobs in a sample project.
-
Update this reference and the main conversion guide.