Hashed out a very broken tags gathering logic

This commit is contained in:
decentral1se 2021-04-02 16:28:56 +02:00
parent 90780eab91
commit 85670538c6
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A
1 changed files with 22 additions and 6 deletions

View File

@ -91,16 +91,32 @@ def get_app_features(app_path):
def get_app_versions(app_path):
versions = {}
versions = []
chdir(app_path)
tags = check_output(f"git tag --list", shell=True).strip()
for tag in tags:
# TODO
# checkout that tag in the local git branch
# parse all service images via yq or other magic
# lookup the digest with skopeo
pass
run(f"git checkout", shell=True)
services_command = "yq e .services | keys | .[] compose*.yml"
services = check_output(services_command, shell=True).decode("utf-8").split()
for service in services:
images_command = f"yq e '.services.{service}.image' compose*.yml"
images = check_output(images_command, shell=True).decode("utf-8").split()
for image in images:
if image in ("null", "---"):
continue
digest_command = f"skopeo inspect {image} | yq '.Digest'"
output = check_output(digest_command, shell=True).decode("utf-8")
digest = output.strip().split(":")[-1][:8]
versions.append(
{service: {"image": image, "tag": tag, "digest": digest}}
)
return versions