[docker-image-scanner] Additionaly escape new line characters only in comments
Change-Id: Id11dc6f3edb42bb7531f2ce167338f145e03e359
Related-PROD: https://mirantis.jira.com/browse/RE-435
diff --git a/src/com/mirantis/mk/DockerImageScanner.groovy b/src/com/mirantis/mk/DockerImageScanner.groovy
index 6bab04c..536de37 100644
--- a/src/com/mirantis/mk/DockerImageScanner.groovy
+++ b/src/com/mirantis/mk/DockerImageScanner.groovy
@@ -195,13 +195,13 @@
jiraNamespace = 'PRODX'
}
jira_summary = "[${image_key}] Found CVEs in Docker image"
- jira_description = "${image.key}\\n"
+ jira_description = "${image.key}\n"
image.value.each{
pkg ->
- jira_description += "__* ${pkg.key}\\n"
+ jira_description += "__* ${pkg.key}\n"
pkg.value.each{
cve ->
- jira_description += "________${cve}\\n"
+ jira_description += "________${cve}\n"
}
}
@@ -228,9 +228,10 @@
basicIssueJSON['fields']['versions'] = [["name": "Backlog"]]
}
def post_issue_json = JsonOutput.toJson(basicIssueJSON)
+ def jira_comment = jira_description.replaceAll(/\n/, '\\\\n')
def post_comment_json = """
{
- "body": "${jira_description}"
+ "body": "${jira_comment}"
}
"""
def jira_key = cacheLookUp(dict, image_key, image.key)