[SERVER-59198] versionArray is not aware of -alpha git tags Created: 09/Aug/21  Updated: 29/Oct/23  Resolved: 27/Sep/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Kelsey Schubert Assignee: Jonathan Streets (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

The current version array on r5.1.0-alpha-325-ga5dd822066

	"versionArray" : [
		5,
		1,
		1,
		-100
	],

This makes it look like 5.1.0 has already been released which is incorrect.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 27/Sep/21 ]

Author:

{'name': 'Jon Streets', 'email': 'jonathan.streets@mongodb.com'}

Message: SERVER-59198 versionArray is not aware of -alpha git tags
Branch: master
https://github.com/mongodb/mongo/commit/c203f95e7bec67d75123116f59bdb9776ab68207

Comment by Kelsey Schubert [ 09/Aug/21 ]

I've written the following standalone python script which should address this issue:

import re
 
def version(versionString):
    version_parts = [ x for x in re.match(r'^(\d+)\.(\d+)\.(\d+)-?((?:(rc|alpha)(\d?))?.*)?',
        versionString).groups() ]
    print(version_parts)
    version_extra = version_parts[3] if version_parts[3] else ""
    if version_parts[4] == 'rc':
        version_parts[3] = int(version_parts[5]) + -25
    elif version_parts[4] == 'alpha':
        if version_parts[5] == '':
            version_parts[3] = -50
        else:
            version_parts[3] = int(version_parts[5]) + -50
    elif version_parts[3]:
        version_parts[2] = int(version_parts[2]) + 1
        version_parts[3] = -100
    else:
        version_parts[3] = 0
    version_parts = [ int(x) for x in version_parts[:4]]
    return version_parts
 
print(version("5.1.0-rc0-325-ga5dd822066"))
print(version("5.1.0-alpha-325-ga5dd822066"))
print(version("5.1.0-alpha1-325-ga5dd822066"))

It produces the following output:

['5', '1', '0', 'rc0-325-ga5dd822066', 'rc', '0']
[5, 1, 0, -25]
['5', '1', '0', 'alpha-325-ga5dd822066', 'alpha', '']
[5, 1, 0, -50]
['5', '1', '0', 'alpha1-325-ga5dd822066', 'alpha', '1']
[5, 1, 0, -49]

Comment by Kelsey Schubert [ 09/Aug/21 ]

Relevant code block: https://github.com/mongodb/mongo/blob/a5dd822066bb5157b632a62f86acbe1d2363ee58/src/mongo/SConscript#L16-L43

Generated at Thu Feb 08 05:46:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.