Compare commits

..

17 Commits

Author SHA1 Message Date
3wc
08d937104e Possible fix to invalid length "20"?
Some checks failed
continuous-integration/drone/pr Build is failing
2021-05-04 08:10:54 +02:00
3wc
935007dd86 Improve recipe new subcommand
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2021-05-03 03:22:32 +02:00
2cd1d053f0 Update change log
Some checks failed
continuous-integration/drone/push Build is failing
2021-05-02 22:18:04 +02:00
a1c8620cc0 Sort the JSON
Some checks failed
continuous-integration/drone/push Build is failing
2021-05-02 22:14:22 +02:00
39a7fc04fb Sort that JSON 2021-05-02 22:14:15 +02:00
a8b5fb5c1e Cut a new release of the apps.json 2021-05-02 22:11:12 +02:00
18e22b24ea Don't explode if missing the README 2021-05-02 22:10:58 +02:00
b53a3ed3f7 Exclude that repo too
Some checks failed
continuous-integration/drone/push Build is failing
2021-05-02 21:58:02 +02:00
112787b3aa Add gardening to exluded repos list
Some checks failed
continuous-integration/drone/push Build is failing
2021-05-02 21:48:35 +02:00
4f46ff7ee6 Remove that
Some checks failed
continuous-integration/drone/push Build is failing
2021-05-02 21:44:11 +02:00
845de093ba Let the formatter run at that
Some checks failed
continuous-integration/drone/push Build is failing
2021-05-02 21:42:55 +02:00
65e83ed885 Exclude more repos 2021-05-02 21:42:34 +02:00
b98d69b33e Remove slightly off-topic comment
Some checks failed
continuous-integration/drone/push Build is failing
2021-05-02 20:30:09 +02:00
d159b98c3c Add other plugin repos 2021-05-02 20:30:08 +02:00
1ef5c3980d Use new name of repos and sort 2021-05-02 20:30:08 +02:00
3wc
ffc569e275 Further fix to #151
Some checks failed
continuous-integration/drone/push Build is failing
2021-04-30 22:55:59 +02:00
3wc
0e28af9eb1 app-json.py: parse emoji status scores into digits 2021-04-30 22:55:59 +02:00
4 changed files with 1727 additions and 1079 deletions

View File

@ -9,6 +9,10 @@
# abra x.x.x (UNRELEASED) # abra x.x.x (UNRELEASED)
- Sort `apps.json` when publishing ([39a7fc0](https://git.autonomic.zone/coop-cloud/abra/commit/39a7fc04fb5df1a6d78b84f51838530ab3eb76db))
- Fix publishing of rating for new apps ([0e28af9](https://git.autonomic.zone/coop-cloud/abra/commit/0e28af9eb1af6c6da705b4614ddd173c60576629))
- Detect compose filenames in `n+1` release generation ([ffc569e](https://git.autonomic.zone/coop-cloud/abra/commit/ffc569e275df7ca784a4db1a3331e17975fd8c87))
# abra 0.7.3 (2021-04-28) # abra 0.7.3 (2021-04-28)
- Only check for pw(q)gen if we're actually trying to use them ([#147](https://git.autonomic.zone/coop-cloud/abra/issues/147)) - Only check for pw(q)gen if we're actually trying to use them ([#147](https://git.autonomic.zone/coop-cloud/abra/issues/147))

12
abra
View File

@ -1649,7 +1649,7 @@ sub_app_secret_generate(){
if [[ -n "$LENGTH" ]]; then if [[ -n "$LENGTH" ]]; then
if [ -z "$abra__cmd_" ]; then if [ -z "$abra__cmd_" ]; then
require_binary pwgen require_binary pwgen
abra__cmd_="pwgen -s \"$LENGTH\" 1" abra__cmd_="pwgen -s $LENGTH 1"
fi fi
else else
if [ -z "$abra__cmd_" ]; then if [ -z "$abra__cmd_" ]; then
@ -1881,6 +1881,7 @@ Create a new application recipe called <recipe>."
sub_recipe_create() { sub_recipe_create() {
recipe="$abra__recipe_" recipe="$abra__recipe_"
recipe_kebab="${recipe//-/_}"
recipe_dir="$ABRA_DIR/apps/$recipe" recipe_dir="$ABRA_DIR/apps/$recipe"
@ -1894,7 +1895,11 @@ sub_recipe_create() {
cd "$recipe_dir" || error "Failed to create directory '$recipe_dir'" cd "$recipe_dir" || error "Failed to create directory '$recipe_dir'"
rm -rf .git .gitea rm -rf .git .gitea .drone.yml
sed -i "s/\${REPO_NAME}/$recipe/g" README.md
sed -i "s/\${REPO_NAME_TITLE}/$recipe/g" README.md
sed -i "s/\${REPO_NAME_KEBAB}/$recipe_kebab/g" .env.sample
success "New recipe created in '$recipe_dir', happy hacking! 👌" success "New recipe created in '$recipe_dir', happy hacking! 👌"
} }
@ -2019,8 +2024,7 @@ sub_recipe_release() {
for compose_file in "${compose_files[@]}"; do for compose_file in "${compose_files[@]}"; do
mapfile -t services < <($YQ e -N '.services | keys | .[]' "$compose_file" | sort -u) mapfile -t services < <($YQ e -N '.services | keys | .[]' "$compose_file" | sort -u)
if [ "$compose_file" = "compose.yml" ] && ! printf '%s\0' "${services[@]}" | grep -Fqxz -- "app"; then
if ! printf '%s\0' "${services[@]}" | grep -Fqxz -- "app"; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
warning 'No `app` service found; which one should we use for the version number?' warning 'No `app` service found; which one should we use for the version number?'
select service_item in "${services[@]##*/}"; do select service_item in "${services[@]##*/}"; do

View File

@ -25,15 +25,21 @@ SCRIPT_PATH = Path(__file__).absolute().parent
REPOS_TO_SKIP = ( REPOS_TO_SKIP = (
"abra", "abra",
"abra-apps", "abra-apps",
"abra-gandi",
"abra-hetzner",
"backup-bot", "backup-bot",
"cloud.autonomic.zone", "coopcloud.tech",
"docs.cloud.autonomic.zone", "coturn",
"docker-cp-deploy",
"docker-dind-bats-kcov",
"docs.coopcloud.tech",
"example", "example",
"gardening",
"organising", "organising",
"pyabra", "pyabra",
"stack-ssh-deploy",
"radicle-seed-node", "radicle-seed-node",
"coturn", "stack-ssh-deploy",
"swarm-cronjob",
) )
log = getLogger(__name__) log = getLogger(__name__)
@ -101,7 +107,6 @@ def clone_all_apps(repos_json):
repos = [[p["name"], p["ssh_url"]] for p in repos_json] repos = [[p["name"], p["ssh_url"]] for p in repos_json]
for name, url in repos: for name, url in repos:
continue
if name in REPOS_TO_SKIP: if name in REPOS_TO_SKIP:
continue continue
@ -145,11 +150,6 @@ def generate_apps_json(repos_json):
"default_branch": repo_details.get("default_branch", ""), "default_branch": repo_details.get("default_branch", ""),
"description": repo_details.get("description", ""), "description": repo_details.get("description", ""),
"website": repo_details.get("website", ""), "website": repo_details.get("website", ""),
# Note(decentral1se): please note that the app metadata do not
# correspond to version tags. We simply parse the latest metadata
# list from HEAD. This may lead to unexpected situations where
# users believe X feature is available under Y version but it is
# not.
"features": metadata, "features": metadata,
"versions": get_app_versions(app_path, cached_apps_json), "versions": get_app_versions(app_path, cached_apps_json),
"icon": repo_details.get("avatar_url", ""), "icon": repo_details.get("avatar_url", ""),
@ -164,9 +164,13 @@ def get_app_metadata(app_path):
chdir(app_path) chdir(app_path)
try:
with open(f"{app_path}/README.md", "r") as handle: with open(f"{app_path}/README.md", "r") as handle:
log.info(f"{app_path}/README.md") log.info(f"{app_path}/README.md")
contents = handle.read() contents = handle.read()
except Exception:
log.info(f"No {app_path}/README.md discovered, moving on")
return {}
try: try:
for match in findall(r"\*\*.*\s\*", contents): for match in findall(r"\*\*.*\s\*", contents):
@ -179,6 +183,10 @@ def get_app_metadata(app_path):
"rating": match.split(",")[1].strip(), "rating": match.split(",")[1].strip(),
"source": match.split(",")[-1].replace("*", "").strip(), "source": match.split(",")[-1].replace("*", "").strip(),
} }
elif title == "status":
value = {"❶💚": 1, "❷💛": 2, "❸🍎": 3, "❹💣": 4, "?": 5, "": 5}[
match.split(":")[-1].replace("*", "").strip()
]
else: else:
value = match.split(":")[-1].replace("*", "").strip() value = match.split(":")[-1].replace("*", "").strip()
@ -276,7 +284,13 @@ def main():
target = f"{SCRIPT_PATH}/../deploy/apps.coopcloud.tech/apps.json" target = f"{SCRIPT_PATH}/../deploy/apps.coopcloud.tech/apps.json"
with open(target, "w", encoding="utf-8") as handle: with open(target, "w", encoding="utf-8") as handle:
dump(generate_apps_json(repos_json), handle, ensure_ascii=False, indent=4) dump(
generate_apps_json(repos_json),
handle,
ensure_ascii=False,
indent=4,
sort_keys=True,
)
log.info(f"Successfully generated {target}") log.info(f"Successfully generated {target}")

File diff suppressed because it is too large Load Diff