Supply release tag processing
This commit is contained in:
parent
af3c041566
commit
44b1e13f31
1 changed files with 11 additions and 15 deletions
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
LinkedHashMap RELEASETAG_PREFIXES = [
|
||||
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',
|
||||
|
|
@ -8,33 +8,29 @@ LinkedHashMap RELEASETAG_PREFIXES = [
|
|||
'inmainline' : 'This release was associated with development branch which has now been merged into mainline',
|
||||
]
|
||||
|
||||
RELEASETAG_PREFIX_SEPERATOR = '_'
|
||||
def RELEASETAG_PREFIX_SEPERATOR = '_'
|
||||
|
||||
def startswithspecialprefix(String releasetag) {
|
||||
def boolean hasspecialprefix = false
|
||||
def String releasetagprefix = ''
|
||||
def String prefixfound = ''
|
||||
def String prefixmeaning = ''
|
||||
def String tagwithoutprefix = releasetag
|
||||
|
||||
echo "Release tag is: ${releasetag}"
|
||||
// Two forms of releasetag expected
|
||||
// <prefix>_<version>_<buildnumber>
|
||||
// <version>_<buildnumber>
|
||||
def int separatorcount = releasetag.split(RELEASETAG_PREFIX_SEPERATOR).size() - 1
|
||||
echo "separatorcount is: ${separatorcount}"
|
||||
def firstseperatorindex = releasetag.indexOf(RELEASETAG_PREFIX_SEPERATOR)
|
||||
echo "firstseperatorindex is: ${firstseperatorindex}"
|
||||
if (separatorcount >= 2) {
|
||||
if (firstseperatorindex > 0) {
|
||||
prefixfound = releasetag[0..(firstseperatorindex - 1)].toLowerCase()
|
||||
hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound)
|
||||
tagwithoutprefix = releasetag[(firstseperatorindex + 1)..-1]
|
||||
RELEASETAG_PREFIXES.each { prefix, meaning ->
|
||||
if (releasetag.toLowerCase().startsWith(prefix)) {
|
||||
prefixfound = prefix
|
||||
hasspecialprefix = true
|
||||
prefixmeaning = meaning
|
||||
tagwithoutprefix = releasetag[(prefix.size() + 1)..-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
echo "Results are: ${hasspecialprefix} ${prefixfound} ${tagwithoutprefix}"
|
||||
return [ 'hasspecialprefix' : hasspecialprefix,
|
||||
'prefixfound' : prefixfound,
|
||||
'tagwithoutprefix' : tagwithoutprefix,
|
||||
'meaning' : prefixmeaning,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue