Fix service version collection

Closes coop-cloud/abra#128.
This commit is contained in:
decentral1se 2021-04-03 20:18:31 +02:00
parent 57f74b0d46
commit 0369a18c6e
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A

View File

@ -159,7 +159,7 @@ def get_app_versions(app_path):
services_cmd = "yq e '.services | keys | .[]' compose*.yml" services_cmd = "yq e '.services | keys | .[]' compose*.yml"
services = _run_cmd(services_cmd, shell=True).split() services = _run_cmd(services_cmd, shell=True).split()
service_versions = [] service_versions = {}
for service in services: for service in services:
services_cmd = f"yq e '.services.{service}.image' compose*.yml" services_cmd = f"yq e '.services.{service}.image' compose*.yml"
images = _run_cmd(services_cmd, shell=True).split() images = _run_cmd(services_cmd, shell=True).split()
@ -172,15 +172,13 @@ def get_app_versions(app_path):
output = _run_cmd(images_cmd, shell=True) output = _run_cmd(images_cmd, shell=True)
service_version_info = { service_version_info = {
service: { "image": image.split(":")[0],
"image": image.split(":")[0], "tag": image.split(":")[-1],
"tag": image.split(":")[-1], "digest": output.split(":")[-1][:8],
"digest": output.split(":")[-1][:8],
}
} }
log.info(f"Parsed {service_version_info}") log.info(f"Parsed {service_version_info}")
service_versions.append(service_version_info) service_versions[service] = service_version_info
versions[tag] = service_versions versions[tag] = service_versions