[DockerImageScanner] Get affected version just once

Change-Id: I44fcf348dfd7cc64c670ba48922e83abfd2148d1
Related-PROD: https://mirantis.jira.com/browse/RE-534
diff --git a/src/com/mirantis/mk/DockerImageScanner.groovy b/src/com/mirantis/mk/DockerImageScanner.groovy
index 5bbb95c..8178564 100644
--- a/src/com/mirantis/mk/DockerImageScanner.groovy
+++ b/src/com/mirantis/mk/DockerImageScanner.groovy
@@ -212,6 +212,11 @@
             }
     }
 
+    def affectedVersion = ''
+    if (jiraNamespace == 'PRODX') {
+        affectedVersion = getLatestAffectedVersion(cred, productName)
+    }
+
     def jira_summary = ''
     def jira_description = ''
     imageDict.each{
@@ -254,9 +259,7 @@
                     'cve'
                 ]
             ]
-            def affectedVersion = ''
             if (jiraNamespace == 'PRODX') {
-                affectedVersion = getLatestAffectedVersion(cred, productName)
                 basicIssueJSON['fields']['customfield_19000'] = [value:"${team_assignee}"]
                 basicIssueJSON['fields']['versions'] = [["name": affectedVersion]]
             }