Solved - How to retrieve the Mendix version of a revision without the Team Server API?
0
I am currently working on a project where the customer uses Mendix on CloudFoundry in a SAP environment. We are looking to implement CI/CD, bud sadly (and amazingly), the Team Server and Build API are available only for Mendix cloud apps, even though we do use the team server as well. I have an opinion about that, but that besides the question. Without having the API's as an option, I'm now trying to see how far i can come with SVN. What I've got so far is: - svn info <TeamServerURL> → this gives me the latest revision that was committed - svn log <TeamServerURL> –r -123 (with 123 being the revision number) → this gives me the branch this revision is part of - svn ls <TeamServerURL>/tags → this gives me all the tags, so i can check the highest revision a deployment package was created from - svn co <TeamServerURL>/trunk or /branches/<branchname> → this downloads the latest revision in the specified branch, but not yet packaged So the last thing I need to do before I can deploy (for which there is an API available in the CloudFoundry/SAP environment), is to create a package. I can use MxBuild for that, but every Mendix version has a new version of MxBuild. So I need the Mendix version of a certain revision, how to obtain that information? Again, without the help of the Team Server API, because, well, that would be helpful ;)
asked
Joris van der Heijden
2 answers
0
Mendix must have solved this issue in their Docker buildpacks, so I dug around a bit in the Python code and I found the following snippet:
def get_version(build_path):
file_name = os.path.join(build_path, "model", "metadata.json")
try:
with open(file_name) as file_handle:
data = json.loads(file_handle.read())
return MXVersion(data["RuntimeVersion"])
except IOError:
mpr = util.get_mpr_file_from_dir(build_path)
if not mpr:
raise Exception("No model/metadata.json or .mpr found in archive")
cursor = sqlite3.connect(mpr).cursor()
cursor.execute("SELECT _ProductVersion FROM _MetaData LIMIT 1")
record = cursor.fetchone()
return MXVersion(record[0])