[DO-550] bbl container create tags (#23)
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-shared-lib/pulls/23 Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
committed by
Aleksandr Vodyanov
parent
00ee6c88c3
commit
0233564103
@@ -112,11 +112,12 @@ class Git implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Method executes command "git push"
|
* Method executes command "git push"
|
||||||
|
* @param String branch - ветка, коммит, тег, который пушится. По умолчанию пустая строка
|
||||||
*/
|
*/
|
||||||
public push() {
|
public push(String branch = '') {
|
||||||
script.sshagent([this.creds]) {
|
script.sshagent([this.creds]) {
|
||||||
script.sh """
|
script.sh """
|
||||||
git push
|
git push ${branch}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,4 +156,29 @@ class Git implements Serializable {
|
|||||||
|
|
||||||
return this.script.sh(script: "git log -n $args.count $args.format", returnStdout: true).trim()
|
return this.script.sh(script: "git log -n $args.count $args.format", returnStdout: true).trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method executes command "git tag".
|
||||||
|
* @param Map args:
|
||||||
|
* - String tagName: имя тега
|
||||||
|
* - String pointsAt: просмотр тегов на определенном коммите
|
||||||
|
*/
|
||||||
|
public String tag(Map args = [:]) {
|
||||||
|
Map defaultArgs = [
|
||||||
|
tagName: '',
|
||||||
|
pointsAt: '',
|
||||||
|
]
|
||||||
|
|
||||||
|
defaultArgs.each { k, v ->
|
||||||
|
if (args[k] == null || args[k] == '' || args[k] == []) {
|
||||||
|
args[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.pointsAt != '') {
|
||||||
|
args.pointsAt = "--points-at ${args.pointsAt}"
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.script.sh(script: "git tag $args.tagName $args.pointsAt", returnStdout: true).trim()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user