Skip to content

Commit cbffd1e

Browse files
committed
feat: configure the builder and run image (#1088)
1 parent 184ab2b commit cbffd1e

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

components/renku_data_services/session/config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class BuildsConfig:
1818

1919
enabled: bool = False
2020
build_output_image_prefix: str | None = None
21-
vscodium_python_run_image: str | None = None
21+
build_builder_image: str | None = None
22+
build_run_image: str | None = None
2223
build_strategy_name: str | None = None
2324
push_secret_name: str | None = None
2425
buildrun_retention_after_failed: timedelta | None = None
@@ -32,7 +33,8 @@ def from_env(cls) -> "BuildsConfig":
3233
"""Create a config from environment variables."""
3334
enabled = os.environ.get("IMAGE_BUILDERS_ENABLED", "false").lower() == "true"
3435
build_output_image_prefix = os.environ.get("BUILD_OUTPUT_IMAGE_PREFIX")
35-
vscodium_python_run_image = os.environ.get("BUILD_VSCODIUM_PYTHON_RUN_IMAGE")
36+
build_builder_image = os.environ.get("BUILD_BUILDER_IMAGE")
37+
build_run_image = os.environ.get("BUILD_RUN_IMAGE")
3638
build_strategy_name = os.environ.get("BUILD_STRATEGY_NAME")
3739
push_secret_name = os.environ.get("BUILD_PUSH_SECRET_NAME")
3840
buildrun_retention_after_failed_seconds = int(os.environ.get("BUILD_RUN_RETENTION_AFTER_FAILED_SECONDS") or "0")
@@ -76,7 +78,8 @@ def from_env(cls) -> "BuildsConfig":
7678
return cls(
7779
enabled=enabled or False,
7880
build_output_image_prefix=build_output_image_prefix or None,
79-
vscodium_python_run_image=vscodium_python_run_image or None,
81+
build_builder_image=build_builder_image,
82+
build_run_image=build_run_image,
8083
build_strategy_name=build_strategy_name or None,
8184
push_secret_name=push_secret_name or None,
8285
buildrun_retention_after_failed=buildrun_retention_after_failed,

components/renku_data_services/session/constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
BUILD_OUTPUT_IMAGE_NAME: Final[str] = "renku-build"
1515
"""The container image name created from Renku builds."""
1616

17-
BUILD_BUILDER_IMAGE: Final[str] = "ghcr.io/swissdatasciencecenter/renku-frontend-buildpacks/selector:0.1.0"
17+
BUILD_DEFAULT_BUILDER_IMAGE: Final[str] = "ghcr.io/swissdatasciencecenter/renku-frontend-buildpacks/selector:0.1.0"
1818

19-
BUILD_RUN_IMAGE: Final[str] = "ghcr.io/swissdatasciencecenter/renku-frontend-buildpacks/base-image:0.1.0"
19+
BUILD_DEFAULT_RUN_IMAGE: Final[str] = "ghcr.io/swissdatasciencecenter/renku-frontend-buildpacks/base-image:0.1.0"
2020
BUILD_MOUNT_DIRECTORY: Final[PurePosixPath] = PurePosixPath("/home/renku/work")
2121
BUILD_WORKING_DIRECTORY: Final[PurePosixPath] = BUILD_MOUNT_DIRECTORY
2222
BUILD_UID: Final[int] = 1000
2323
BUILD_GID: Final[int] = 1000
2424
BUILD_PORT: Final[int] = 8888
25-
DEFAULT_URLS: Final[dict[str, str]] = {
26-
"vscodium": "/",
25+
BUILD_DEFAULT_URL_PATH: Final[str] = "/"
26+
BUILD_URL_PATH_MAP: Final[dict[str, str]] = {
2727
"jupyterlab": "/lab",
2828
}
2929

components/renku_data_services/session/db.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,9 @@ async def insert_launcher(
433433
created_by_id=user.id,
434434
description=f"Generated environment for {launcher.name}",
435435
container_image="image:unknown-at-the-moment", # TODO: This should come from the build
436-
default_url=constants.DEFAULT_URLS.get(launcher.environment.frontend_variant, "/"),
436+
default_url=constants.BUILD_URL_PATH_MAP.get(
437+
launcher.environment.frontend_variant, constants.BUILD_DEFAULT_URL_PATH
438+
),
437439
port=constants.BUILD_PORT, # TODO: This should come from the build
438440
working_directory=constants.BUILD_WORKING_DIRECTORY, # TODO: This should come from the build
439441
mount_directory=constants.BUILD_MOUNT_DIRECTORY, # TODO: This should come from the build
@@ -1085,8 +1087,8 @@ def _get_buildrun_params(
10851087
return models.ShipwrightBuildRunParams(
10861088
name=build.k8s_name,
10871089
git_repository=git_repository,
1088-
build_image=constants.BUILD_BUILDER_IMAGE,
1089-
run_image=constants.BUILD_RUN_IMAGE,
1090+
build_image=self.builds_config.build_builder_image or constants.BUILD_DEFAULT_BUILDER_IMAGE,
1091+
run_image=self.builds_config.build_run_image or constants.BUILD_DEFAULT_RUN_IMAGE,
10901092
output_image=output_image,
10911093
build_strategy_name=build_strategy_name,
10921094
push_secret_name=push_secret_name,

0 commit comments

Comments
 (0)