Skip to content

Commit

Permalink
Added enpoint part in updating build_image_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandhya1874 committed Oct 15, 2024
1 parent 4e93e1c commit ccbba8e
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions health_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,21 @@ def update_app_version(app_version, c_name, e_name, github_repo):
# Always update the latest version key
redis.json().set('latest:versions', f'$.{version_key}', version_data)
log.info(f'Updating redis key with latest version. {version_key} = {version_data}')
env_data = []
update_sc = False
for e in component["attributes"]["environments"]:
if e_name == e["name"]:
if e["build_image_tag"] is None:
e["build_image_tag"] = []
if app_version != e["build_image_tag"]:
env_data.append({"id": e["id"], "build_image_tag": app_version })
update_sc = True
else:
env_data.append({"id": e["id"]})
if update_sc:
data = {"environments": env_data}
update_sc_component(c_id, data)
if (endpoint_type == 'info'):
env_data = []
update_sc = False
for e in component["attributes"]["environments"]:
if e_name == e["name"]:
if e["build_image_tag"] is None:
e["build_image_tag"] = []
if app_version != e["build_image_tag"]:
env_data.append({"id": e["id"], "build_image_tag": app_version })
update_sc = True
else:
env_data.append({"id": e["id"]})
if update_sc:
data = {"environments": env_data}
update_sc_component(c_id, data)

except Exception as e:
log.error(e)
Expand Down

0 comments on commit ccbba8e

Please sign in to comment.