update jenkinsfile
This commit is contained in:
29
Jenkinsfile
vendored
29
Jenkinsfile
vendored
@@ -150,8 +150,33 @@ pipeline {
|
||||
{
|
||||
if(sh(returnStdout: true, script: "git tag --points-at HEAD").trim().isEmpty())
|
||||
{
|
||||
echo "master push/merge must have an explicit tag release number, stopping pipeline"
|
||||
currentBuild.getRawBuild().getExecutor().doStop()
|
||||
BUMPED_VERSION = sh(script: """#!/bin/sh -
|
||||
|. ~/TOOLS_ENV/bin/activate
|
||||
|exec python - << '__EOWRAPPER__'
|
||||
|
|
||||
|from pygitversionhelper import gitversionhelper
|
||||
|import re
|
||||
|
|
||||
|lastcommit=gitversionhelper.commit.getLast(same_branch=True)
|
||||
|msg=gitversionhelper.commit.getMessage(lastcommit)
|
||||
|
|
||||
|_match=re.search(r"\\s*(?:#)?\\s*(?<=new-tag:)(?:\\s*)(?P<TAG>\\S*)",msg)
|
||||
|print(_match.group("TAG"),end="")
|
||||
|
|
||||
|__EOWRAPPER__
|
||||
""".stripMargin(),
|
||||
returnStdout: true).trim()
|
||||
if(BUMPED_VERSION.isEmpty())
|
||||
{
|
||||
echo "master push/merge must have an explicit tag release number, stopping pipeline"
|
||||
currentBuild.getRawBuild().getExecutor().doStop()
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "new-tag requested in commit message: $BUMPED_VERSION"
|
||||
sh("git tag -a $BUMPED_VERSION")
|
||||
sh("git push origin master --tags")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user