Make use of caching for speeding up tags generation
See coop-cloud/abra#129.
This commit is contained in:
parent
3720ef838d
commit
be5383b164
@ -9,7 +9,7 @@
|
||||
from json import dump
|
||||
from logging import DEBUG, basicConfig, getLogger
|
||||
from os import chdir, listdir, mkdir
|
||||
from os.path import exists, expanduser
|
||||
from os.path import basename, exists, expanduser
|
||||
from pathlib import Path
|
||||
from re import findall, search
|
||||
from shlex import split
|
||||
@ -85,6 +85,7 @@ def clone_all_apps():
|
||||
def generate_apps_json():
|
||||
"""Generate the abra-apps.json application versions file."""
|
||||
apps_json = {}
|
||||
cached_apps_json = get_published_apps_json()
|
||||
|
||||
for app in listdir(CLONES_PATH):
|
||||
if app in REPOS_TO_SKIP:
|
||||
@ -104,7 +105,7 @@ def generate_apps_json():
|
||||
# users believe X feature is available under Y version but it is
|
||||
# not.
|
||||
"features": get_app_features(app_path),
|
||||
"versions": get_app_versions(app_path),
|
||||
"versions": get_app_versions(app_path, cached_apps_json),
|
||||
}
|
||||
|
||||
return apps_json
|
||||
@ -140,7 +141,7 @@ def get_app_features(app_path):
|
||||
return features
|
||||
|
||||
|
||||
def get_app_versions(app_path):
|
||||
def get_app_versions(app_path, cached_apps_json):
|
||||
versions = {}
|
||||
|
||||
chdir(app_path)
|
||||
@ -153,7 +154,14 @@ def get_app_versions(app_path):
|
||||
|
||||
initial_branch = _run_cmd("git rev-parse --abbrev-ref HEAD")
|
||||
|
||||
app_name = basename(app_path)
|
||||
existing_tags = cached_apps_json[app_name]["versions"].keys()
|
||||
|
||||
for tag in tags:
|
||||
if tag in existing_tags:
|
||||
log.info(f"Skipping {tag} because we've already processed it")
|
||||
continue
|
||||
|
||||
_run_cmd(f"git checkout {tag}")
|
||||
|
||||
services_cmd = "yq e '.services | keys | .[]' compose*.yml"
|
||||
|
Loading…
Reference in New Issue
Block a user