Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/heat 55 populate build image tag in service catalogue #31

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions health_ping.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +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}')
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 Expand Up @@ -131,6 +146,7 @@ def process_env(c_name, e_name, endpoint, endpoint_type, component):
stream_data.update({'error': str(e)})
log.error(e)


# Try to get app version.
try:
version_locations = (
Expand All @@ -153,9 +169,6 @@ def process_env(c_name, e_name, endpoint, endpoint_type, component):
except Exception as e:
log.error(e)

# Current component ID needed for strapi api call
c_id = component["id"]

# Try to get active agencies
try:
if ('activeAgencies' in output) and (endpoint_type == 'info'):
Expand Down Expand Up @@ -291,6 +304,8 @@ def startHttpServer():
for env in component["attributes"]["environments"]:
c_name = component["attributes"]["name"]
e_name = env["name"]
# Current component ID needed for strapi api call
c_id = component["id"]
if (env["url"]) and (env["monitor"] == True):
if env["health_path"]:
endpoint = f'{env["url"]}{env["health_path"]}'
Expand Down