Do not fail docker image mirror if history props not loaded
In case when we mirror a new image from external source history props
for sourceImage can't be loaded so do not fail whole pipeline at all.
Change-Id: Iee1e6b6b98b139c5fe6c12fa7bb341f27f550fba
diff --git a/docker-mirror-images.groovy b/docker-mirror-images.groovy
index 0de5590..55a38c9 100644
--- a/docker-mirror-images.groovy
+++ b/docker-mirror-images.groovy
@@ -128,13 +128,17 @@
if (external) {
artifactoryProperties << ['com.mirantis.externalImage': external]
}
- def sourceRegistry = sourceImage.split('/')[0]
- def sourceImgUrl = imageURL(sourceRegistry, sourceImage, source_image_sha256) - '/manifest.json'
- def existingProps = mcp_artifactory.getPropertiesForArtifact(sourceImgUrl)
def historyProperties = []
- // check does the source image have already history props
- if (existingProps) {
- historyProperties = existingProps.get('com.mirantis.versionHistory', [])
+ try {
+ def sourceRegistry = sourceImage.split('/')[0]
+ def sourceImgUrl = imageURL(sourceRegistry, sourceImage, source_image_sha256) - '/manifest.json'
+ def existingProps = mcp_artifactory.getPropertiesForArtifact(sourceImgUrl)
+ // check does the source image have already history props
+ if (existingProps) {
+ historyProperties = existingProps.get('com.mirantis.versionHistory', [])
+ }
+ } catch (Exception e) {
+ common.warningMsg("Can't find history for ${sourceImage}.")
}
// %5C - backslash symbol is needed
historyProperties.add("${buildTime}%5C=${sourceImage}")