diff --git a/build/update-pom/Jenkinsfile b/build/update-pom/Jenkinsfile index fd3dd068c2..790d4f17ae 100644 --- a/build/update-pom/Jenkinsfile +++ b/build/update-pom/Jenkinsfile @@ -76,13 +76,13 @@ def updateVersion() { if (!params.portalVersion?.trim().isEmpty()) { sh '''#!/bin/bash - update_xml() { - python3 - < changes to tag , need removing namespace + root = stripNamespace(root) # By default, tags like are changed to tag , need removing namespace version = root.find("version") if version is not None: - version.text = portal_version + version.text = portalVersion dependencies = root.find("dependencies") if dependencies is not None: for dependency in dependencies.findall("dependency"): - group_id = dependency.find("groupId") - if group_id is not None and group_id.text in [ + groupId = dependency.find("groupId") + if groupId is not None and groupId.text in [ "com.axonivy.portal", ]: - version_tag = dependency.find("version") - if version_tag is not None: - version_tag.text = portal_version + versionTag = dependency.find("version") + if versionTag is not None: + versionTag.text = portalVersion # Write changes back to the file - tree.write(file_path, encoding="utf-8", xml_declaration=True) -EOF # End Python scripts - need correct indentation + tree.write(filePath, encoding="utf-8", xml_declaration=True) +except Exception as e: + print(f"Failed to process {filePath}: {e}", file=sys.stderr) +EOF } - file_patterns=( + filePatterns=( "AxonIvyPortal/*/pom.xml" "Showcase/*/pom.xml" "AxonIvyPortal/portal-selenium-test/customized_pom.xml" @@ -127,9 +127,9 @@ EOF # End Python scripts - need correct indentation "Documentation/public-api/pom.xml" ) - for pattern in "${file_patterns[@]}"; do + for pattern in "${filePatterns[@]}"; do for file in $pattern; do - update_xml "$file" + updatePortalVersion "$file" done done '''