parent
e8510c8aeb
commit
7482362af1
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from json import dump
|
from json import dump
|
||||||
from os import chdir, getcwd, listdir
|
from os import chdir, environ, getcwd, listdir
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from re import findall, search
|
from re import findall, search
|
||||||
@ -31,6 +31,21 @@ parser = argparse.ArgumentParser(description="Generate a new apps.json")
|
|||||||
parser.add_argument("--output", type=Path, default=f"{getcwd()}/apps.json")
|
parser.add_argument("--output", type=Path, default=f"{getcwd()}/apps.json")
|
||||||
|
|
||||||
|
|
||||||
|
def skopeo_login():
|
||||||
|
"""Log into the docker registry to avoid rate limits."""
|
||||||
|
user = environ.get("SKOPEO_USER")
|
||||||
|
password = environ.get("SKOPEO_PASSWORD")
|
||||||
|
registry = environ.get("SKOPEO_REGISTRY", "docker.io")
|
||||||
|
|
||||||
|
if not user or not password:
|
||||||
|
log.info("Failed to log in via Skopeo due to missing env vars")
|
||||||
|
return
|
||||||
|
|
||||||
|
login_cmd = f"skopeo login {registry} -u {user} -p {password}"
|
||||||
|
output = _run_cmd(login_cmd, shell=True)
|
||||||
|
log.info(f"Skopeo login attempt: {output}")
|
||||||
|
|
||||||
|
|
||||||
def get_published_apps_json():
|
def get_published_apps_json():
|
||||||
"""Retrieve already published apps json."""
|
"""Retrieve already published apps json."""
|
||||||
url = "https://apps.coopcloud.tech"
|
url = "https://apps.coopcloud.tech"
|
||||||
@ -202,6 +217,8 @@ def main():
|
|||||||
"""Run the script."""
|
"""Run the script."""
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
skopeo_login()
|
||||||
|
|
||||||
repos_json = get_repos_json()
|
repos_json = get_repos_json()
|
||||||
clone_all_apps(repos_json)
|
clone_all_apps(repos_json)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user