Commit e52460d2 authored by Alexander's avatar Alexander

error code = 1 if bin script failed

parent a13a149b
......@@ -21,6 +21,7 @@ command_args = [{'path': path,
for path
in paths]
error:int = 0
res_str = []
for command_arg in command_args:
path = command_arg['path']
......@@ -34,11 +35,19 @@ for command_arg in command_args:
os.remove(os.path.join(ROOT, DOCKER_COMPOSE_NAME))
res_str.append(f"{image_name} built with exit code {exit_val}")
if exit_val != 0:
error = exit_val
os.system(f"docker push {image_name}")
# push created Docker image
exit_val = os.system(f"docker push {image_name}")
res_str.append(f"{image_name} pushed with exit code {exit_val}")
if exit_val != 0:
error = exit_val
print(f"Found {len(command_args)} images")
for s in res_str:
print(s)
sys.exit(1 if error > 0 else 0)
\ No newline at end of file
import os
import sys
EXTERNAL_IP = "143.205.173.225"
# apply or delete config
kube_command = 'apply'
if len(sys.argv) == 2:
......@@ -14,14 +12,10 @@ for p, _, f in os.walk('./'):
if 'deployment.yml' == file:
paths.append(os.path.normpath(p))
error:int = 0
for path in paths:
os.system(f"kubectl {kube_command} -f {path}")
# if kube_command == 'apply':
# # apply external ip
# service_name = path.split(os.path.normpath('/'))[-2] # -1 is deployment folder
# if service_name.split('-')[-1] == 'microservice':
# # remove microservice suffix
# service_name = service_name[:len(service_name)-len('-microservice')]
# os.system(f"kubectl patch service {service_name} -p '{{\"spec\":{{\"externalIPs\":[\"{EXTERNAL_IP}\"]}}}}'")
\ No newline at end of file
exit_val = os.system(f"kubectl {kube_command} -f {path}")
if exit_val != 0:
error = exit_val
sys.exit(1 if error > 0 else 0)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment