update jenkinsfile

This commit is contained in:
cclecle
2023-03-19 19:21:48 +00:00
parent a6c2513d9f
commit 5bb8b35c73

29
Jenkinsfile vendored
View File

@@ -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")
}
}
}