24 lines
473 B
Groovy
24 lines
473 B
Groovy
#!/usr/bin/env groovy
|
|
|
|
String call(Map config = [:]) {
|
|
Map defaults = [
|
|
dirtyFlag: '-dirty'
|
|
]
|
|
Map runConfig = defaults + config
|
|
|
|
gitTag = sh(
|
|
script: "git describe --tags --always --dirty=${runConfig.dirtyFlag}",
|
|
returnStdout: true
|
|
).trim()
|
|
|
|
gitHash = sh(
|
|
script: 'git rev-parse --short HEAD',
|
|
returnStdout: true
|
|
).trim()
|
|
|
|
runConfig.tag = gitTag
|
|
runConfig.hash = gitHash
|
|
|
|
return runConfig
|
|
}
|