desired_version 변경을 위한 코드 추가

This commit is contained in:
minchulahn
2023-05-03 11:43:05 +09:00
parent 2ce39ddb23
commit 80d4a70d85
3 changed files with 41 additions and 8 deletions

31
main.py Normal file
View File

@@ -0,0 +1,31 @@
import json, sys, traceback
def get_service_index():
for index, value in enumerate(json_data['service']):
if(value['name'] == service_name):
return index
exit(traceback.print_exc())
def set_desired_version():
service_index = get_service_index()
json_data["service"][service_index]["desired_version"] = desired_version
print(json_data)
if __name__ == '__main__':
if len(sys.argv) != 3 or 'rc' not in sys.argv[1]:
exit(traceback.print_exc())
desired_version = sys.argv[1].split("rc")[1]
service_name = sys.argv[2]
file_path = "./rc-version.json"
with open(file_path, 'r') as json_file:
json_data = json.load(json_file)
set_desired_version()
with open(file_path, 'w') as file:
json.dump(json_data, file, indent="\t")

View File

@@ -4,7 +4,7 @@
{
"name": "sample-app",
"version": "",
"desiredVersion": ""
"desired_version": ""
}
]
}

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
jsontemplates==0.1.0
PyYAML==6.0