[Atlassian] Add support of plaintext to extractJIRA function
Related-To: PRODX-3678
Change-Id: I27ee9ce31e01abc0b7a9bf040e45fb55dd34c592
diff --git a/src/com/mirantis/mk/Atlassian.groovy b/src/com/mirantis/mk/Atlassian.groovy
index 7b06fd1..33abced 100644
--- a/src/com/mirantis/mk/Atlassian.groovy
+++ b/src/com/mirantis/mk/Atlassian.groovy
@@ -48,12 +48,18 @@
**/
List extractJIRA(String commitMsg, String matcherRegex = '([A-Z]+-[0-9]+)') {
- String msg = new String(commitMsg.decodeBase64())
- def matcher = (msg =~ matcherRegex)
- List tickets = []
+ String msg
+ try {
+ msg = new String(commitMsg.decodeBase64())
+ } catch (e) {
+ // use commitMsg as is if cannot decode so we can use the same function for plaintext too
+ msg = commitMsg
+ }
+ def matcher = (msg =~ matcherRegex)
+ List tickets = []
- matcher.each{ tickets.add(it[0]) }
- return tickets
+ matcher.each{ tickets.add(it[0]) }
+ return tickets
}
/**