json 구조 변경

This commit is contained in:
minchulahn
2023-05-30 17:58:35 +09:00
parent 4fa3ac060c
commit 6660cc8791
3 changed files with 227 additions and 171 deletions

10
main.py
View File

@@ -2,20 +2,22 @@ import json, sys, traceback
def get_service_index():
for index, value in enumerate(json_data['service']):
if(value['name'] == sys.argv[2]):
if(value['name'] == serviceName):
return index
exit(traceback.print_exc())
def set_latest_version():
service_index = get_service_index()
json_data["service"][service_index]["latest_version"] = sys.argv[1]
json_data["service"][service_index]["latest_candidate_version"] = releaseTag
if __name__ == '__main__':
if len(sys.argv) != 3:
exit(traceback.print_exc())
file_path = "./candidate-version.json"
releaseTag = sys.argv[1]
serviceName = sys.argv[2]
file_path = "./version.json"
with open(file_path, 'r') as json_file:
json_data = json.load(json_file)