Skip to content

Commit 1e5044c

Browse files
committed
Fix version regex
1 parent eb598e7 commit 1e5044c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

vars/mavenCiPipeline.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def call(Closure closure) {
6161
echo "Artifact ID matches"
6262
def lastVersion = lastTag.substring(artifactId.length()+1)
6363
echo "Last Version: ${lastVersion}"
64-
def versionPattern = Pattern.compile(Pattern.quote(versionTemplate).replaceAll(Pattern.quote('\\$\\{revision\\}'), '(?<revision>\\d+)').replaceAll(Pattern.quote('\\$\\{sha1\\}'), '[0-9a-fA-F]+'))
64+
def versionPattern = Pattern.compile(Pattern.quote(versionTemplate).replaceAll('\\Q${revision}\\E', '\\\\E(?<revision>\\d+)\\\\Q').replaceAll('\\Q${sha1}\\E', '\\\\E[0-9a-fA-F]+\\\\Q'))
6565
echo "Version Pattern: ${versionPattern}"
6666
def matcher = lastTag =~ versionPattern
6767
if (matcher.matches()) {

0 commit comments

Comments
 (0)