Update docker-mirror-images pipeline for getting source props
Get source props for docker-mirror-images job image promotion
from source registry of image otherwise in case of using
different registries promotion will fail.
Change-Id: I9638bdd4948f67ecd3d9af58c7c8529f9d5a1772
diff --git a/docker-mirror-images.groovy b/docker-mirror-images.groovy
index 794a730..522d044 100644
--- a/docker-mirror-images.groovy
+++ b/docker-mirror-images.groovy
@@ -111,7 +111,8 @@
if (external) {
artifactoryProperties << ['com.mirantis.externalImage': external]
}
- def sourceGuessImage = sourceImage.replace(':', '/').replace(targetRegistry, '')
+ def sourceRegistry = sourceImage.split('/')[0]
+ def sourceGuessImage = sourceImage.replace(':', '/').replace(sourceRegistry, '')
def sourceImgUrl = img_data*.uri.find { it.contains(sourceGuessImage) } - '/manifest.json'
def existingProps = mcp_artifactory.getPropertiesForArtifact(sourceImgUrl)
def historyProperties = []
@@ -121,7 +122,7 @@
}
// %5C - backslash symbol is needed
historyProperties.add("${buildTime}%5C=${sourceImage}")
- artifactoryProperties << [ 'com.mirantis.versionHistory': historyProperties ]
+ artifactoryProperties << [ 'com.mirantis.versionHistory': historyProperties.join(',') ]
common.infoMsg("artifactoryProperties=> ${artifactoryProperties}")
common.retry(3, 5) {
mcp_artifactory.setProperties(tgtImgUrl, artifactoryProperties)