From 2af3878e8193870fa89aba64abd3beb996486485 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Fri, 10 Sep 2021 16:36:26 +0530 Subject: [PATCH] common: Pick up version details from deployment.json in common/version.py --- monkey/common/version.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/monkey/common/version.py b/monkey/common/version.py index 85a263be0..999f173fa 100644 --- a/monkey/common/version.py +++ b/monkey/common/version.py @@ -1,11 +1,19 @@ # To get the version from shell, run `python ./version.py` (see `python ./version.py -h` for # details). import argparse +import json from pathlib import Path -MAJOR = "1" -MINOR = "11" -PATCH = "0" +deployment_info_file_path = Path(__file__).parent.parent.joinpath( + "monkey_island", "cc", "deployment.json" +) +with open(deployment_info_file_path, "r") as deployment_info_file: + deployment_info = json.load(deployment_info_file) + MAJOR = deployment_info["version"]["major"] + MINOR = deployment_info["version"]["minor"] + PATCH = deployment_info["version"]["patch"] + + build_file_path = Path(__file__).parent.joinpath("BUILD") with open(build_file_path, "r") as build_file: BUILD = build_file.read()