fix jenkinsfile

This commit is contained in:
kirill.labutin 2026-08-13 22:31:42 +03:00
parent 9d0dfe4979
commit a8ca76cbc1
1 changed files with 8 additions and 3 deletions

11
Jenkinsfile vendored
View File

@ -1,5 +1,11 @@
@groovy.transform.Field String VERSION
@NonCPS
String extractBaseVersion(String pom) {
def matcher = pom =~ /<artifactId>pf-sdn<\/artifactId>\s*<version>([0-9.]+)<\/version>/
return matcher.find() ? matcher.group(1) : null
}
pipeline {
agent any
@ -8,12 +14,11 @@ pipeline {
steps {
script {
def pom = readFile('pom.xml')
def matcher = pom =~ /<artifactId>pf-sdn<\/artifactId>\s*<version>([0-9.]+)<\/version>/
if (!matcher.find()) {
def baseVersion = extractBaseVersion(pom)
if (!baseVersion) {
error "Project version not found in pom.xml"
}
def baseVersion = matcher.group(1)
echo "Base version from pom: ${baseVersion}"
def parts = baseVersion.tokenize('.')