From f2c616628ba41ff7f13ac1d0c3afb801c54e7bd4 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 21 Feb 2024 10:33:45 +0100 Subject: [PATCH] config: add BASE_CONTAINER option Downstream project may use different images or container registries. Signed-off-by: Paul Spooren --- asu/api.py | 1 + asu/asu.py | 1 + asu/build.py | 5 +---- misc/config.py | 3 +++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/asu/api.py b/asu/api.py index 4e3632dd..fac98e71 100644 --- a/asu/api.py +++ b/asu/api.py @@ -257,6 +257,7 @@ def api_v1_build_post(): req["branch_data"] = current_app.config["BRANCHES"][req["branch"]] req["repository_allow_list"] = current_app.config["REPOSITORY_ALLOW_LIST"] req["request_hash"] = request_hash + req["base_container"] = current_app.config["BASE_CONTAINER"] job = get_queue().enqueue( build, diff --git a/asu/asu.py b/asu/asu.py index af6f7796..569e82f8 100644 --- a/asu/asu.py +++ b/asu/asu.py @@ -37,6 +37,7 @@ def create_app(test_config: dict = None) -> Flask: BRANCHES_FILE=getenv("BRANCHES_FILE"), MAX_CUSTOM_ROOTFS_SIZE_MB=100, REPOSITORY_ALLOW_LIST=[], + BASE_CONTAINER="ghcr.io/openwrt/imagebuilder", ) if not test_config: diff --git a/asu/build.py b/asu/build.py index 9f1e6e8e..2f3e9bb9 100644 --- a/asu/build.py +++ b/asu/build.py @@ -51,10 +51,7 @@ def build(req: dict, job=None): f"Container version: {container_version_tag} (requested {req['version']})" ) - BASE_CONTAINER = "ghcr.io/openwrt/imagebuilder" - image = ( - f"{BASE_CONTAINER}:{req['target'].replace('/', '-')}-{container_version_tag}" - ) + image = f"{req['base_container']}:{req['target'].replace('/', '-')}-{container_version_tag}" log.info(f"Pulling {image}...") podman.images.pull(image) diff --git a/misc/config.py b/misc/config.py index cf66a207..d376637d 100644 --- a/misc/config.py +++ b/misc/config.py @@ -48,3 +48,6 @@ # token used to trigger an update of targets # if an empty string is set, the update happens periodically UPDATE_TOKEN="" + +# base container for the imagebuilder +# BASE_CONTAINER = "ghcr.io/openwrt/imagebuilder"