diff --git a/release/tag.groovy b/release/tag.groovy new file mode 100644 index 0000000..be1944f --- /dev/null +++ b/release/tag.groovy @@ -0,0 +1,31 @@ + +def LinkedHashMap RELEASETAG_PREFIXES = [ + 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', + 'superseded' : 'Indicates a later release has superseded the release with this prefix', + 'erroneous' : 'The release was released unintentionally', + 'faulty' : 'The release was found to have a serious fault', + 'ignore' : 'The release should be ignored', + 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', +] + +def RELEASETAG_PREFIX_SEPERATOR = '_' + +def LinkedHashMap startswithspecialprefix(String releasetag) { + def boolean hasspecialprefix = false + def String releasetagprefix = '' + def String prefixfound = '' + def String tagwithoutprefix = releasetag + + def rtsplits = releasetag.split(RELEASETAG_PREFIX_SEPERATOR) + if (rtsplits.size() > 0) + prefixfound = rtsplits[0].toLowerCase() + hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound) + tagwithoutprefix = rtsplits[1..].join(RELEASETAG_PREFIX_SEPERATOR) + } + return [ 'hasspecialprefix' : hasspecialprefix, + 'prefixfound' : prefixfound, + 'tagwithoutprefix' : tagwithoutprefix, + ] +} + +return this;