Refactor tag logic to its own helper
This commit is contained in:
parent
b01e1d5fbc
commit
1a1d694001
@ -1,16 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
|
||||
String call(Map config = [:]) {
|
||||
Map defaults = [
|
||||
dirtyFlag: '-dirty'
|
||||
]
|
||||
Map runConfig = defaults + config
|
||||
|
||||
void call() {
|
||||
checkout scm
|
||||
|
||||
gitTag = sh(
|
||||
script: "git describe --tags --always --dirty=${runConfig.dirtyFlag}",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
return gitTag
|
||||
}
|
||||
|
||||
14
vars/getCurrentTag.groovy
Normal file
14
vars/getCurrentTag.groovy
Normal file
@ -0,0 +1,14 @@
|
||||
#!/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()
|
||||
return gitTag
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user