Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTDEV-49586 - Updating promotion plugin to support in RT java V21 and groovy V4 #473

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions build/promotion/promotion.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.artifactory.util.StringInputStream

import static groovy.xml.XmlUtil.serialize
import static org.artifactory.repo.RepoPathFactory.create
import groovy.xml.XmlUtil

promotions {
/**
Expand Down Expand Up @@ -273,13 +274,16 @@ def getStageRepoPath(Artifact stageArtifact, Set<FileInfo> stageArtifactsList) {
// it complains about Node.parent when I refer to <parent> tag
private StatusHolder generateAndDeployReleasePomFile(RepoPath stageRepoPath, releaseRepoPath, List<FileInfo> innerModuleDependencies, Set<FileInfo> stageArtifactsList, String snapExp) {
def stagePom = repositories.getStringContent(stageRepoPath)
def project = new XmlSlurper(false, false).parseText(stagePom)
def parser = new groovy.xml.XmlParser()
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
parser.setFeature("http://xml.org/sax/features/external-general-entities", false)
def project = parser.parseText(stagePom)
if (!project.version.isEmpty()) {
project.version = extractVersion(project.version.text(), snapExp)
project.version[0].value = extractVersion(project.version.text(), snapExp)
}
// also try the parent
if (!project.parent.version.isEmpty()) {
project.parent.version = extractVersion(project.parent.version.text(), snapExp)
project.parent.version[0].value = extractVersion(project.parent.version.text(), snapExp)
}

innerModuleDependencies.each { FileInfo artifact ->
Expand All @@ -295,16 +299,17 @@ private StatusHolder generateAndDeployReleasePomFile(RepoPath stageRepoPath, rel
}

private StringInputStream streamXml(xml) {
String result = new StreamingMarkupBuilder().bind { mkp.yield xml }
new StringInputStream(serialize(result))
def serialized = XmlUtil.serialize(xml)
new StringInputStream(serialized)
}

// Pars the xml and modify values and deploy
private StatusHolder generateAndDeployReleaseIvyFile(RepoPath stageRepoPath, releaseRepoPath, List<FileInfo> innerModuleDependencies, String snapExp) {
def stageIvy = repositories.getStringContent(stageRepoPath)
// stageIvy.replace('m:classifier','classifier')
def slurper = new XmlSlurper(false, false)
slurper.keepWhitespace = true
def slurper = new groovy.xml.XmlParser(false, false)
slurper.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
slurper.setFeature("http://xml.org/sax/features/external-general-entities", false)
def releaseIvy = slurper.parseText(stageIvy)
def info = releaseIvy.info[0]
def stageRev = [email protected]()
Expand Down
Loading