20 lines
495 B
Groovy
20 lines
495 B
Groovy
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")
|
|
}
|
|
}
|