Commit 563698f6 authored by Shubhika's avatar Shubhika

Add conditional replacement in the merge request title for special chars in the CI

parent 4a1ff8c5
...@@ -595,7 +595,9 @@ pipeline { ...@@ -595,7 +595,9 @@ pipeline {
for (htmlFile in htmlFiles) { for (htmlFile in htmlFiles) {
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' ${htmlFile}" sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' ${htmlFile}"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' ${htmlFile}" def unsafePattern = /[^a-zA-Z0-9",\.\?\-_ %\+\[\]\(\)~]/
def sanitizedTitle = env.gitlabMergeRequestTitle.replaceAll(unsafePattern, '-')
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${sanitizedTitle}#' ${htmlFile}"
} }
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' ${htmlFile}" sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' ${htmlFile}"
archiveArtifacts artifacts: htmlFile archiveArtifacts artifacts: htmlFile
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment