in src/com/epam/edp/Job.groovy [147:175]
def setCodebaseTags(codebase) {
def cbisSet = "${codebase.inputIs} ${codebase.outputIs}"
def cbisData = script.sh(
script: "kubectl get codebaseimagestreams.v2.edp.epam.com ${cbisSet} --ignore-not-found=true --output=json",
returnStdout: true
).trim()
def cbisJsonData = new JsonSlurperClassic().parseText(cbisData)
def images = null
if (cbisJsonData.items.spec.tags.name[0] != null){
images = cbisJsonData.items.spec.tags.name[0]
}
def tags = ['noImageExists']
if (images != null) {
tags = images.reverse()
}
def latestTag = getLatestTag(tags.collect{ (it=~/\d+|\D+/).findAll() }.sort().reverse().collect{ it.join() })
codebase.latest = latestTag
if (tags != ['noImageExists']) {
tags.add(0, "No deploy")
}
tags = setLatestLabelOnTag(tags, latestTag)
if (cbisJsonData.items.size() > 1) {
def stableTag = getStableTag(cbisJsonData.items[1].spec.tags)
codebase.stable = stableTag
tags = setStableLabelOnTag(tags, stableTag)
}
codebase.sortedTags = tags
script.println("[JENKINS][DEBUG] Existing tags for ${codebase.name}: ${tags}")
}