Add vars/\src\com\sphinx\BuildInfo.groovy

This commit is contained in:
khaled committed 2026-09-30 14:35:08 +00:00
1 parent 9c022dd78f
commit 480185639f
1 file changed
+19
+19
View File
@@ -0,0 +1,19 @@
package com.sphinx
// Helper class: build a version string and expose it to pipelines.
// Usage in a Jenkinsfile:
// import com.sphinx.BuildInfo
// def info = new BuildInfo(this)
// echo info.version('demo')
class BuildInfo implements Serializable {
def steps
BuildInfo(steps) { this.steps = steps }
String version(String app) {
return "${app}-1.0.${steps.env.BUILD_NUMBER}"
}
String timestamp() {
return new Date().format("yyyyMMdd-HHmmss")
}
}