Skip to content

Commit

Permalink
feat(envd): Add switch for custom envd context (flyteorg#2500)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <pingsutw@apache.org>
  • Loading branch information
pingsutw committed Jun 20, 2024
1 parent 32bab30 commit b98e941
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/flytekit-envd/flytekitplugins/envd/image_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from flytekit.tools.ignore import DockerIgnore, GitIgnore, IgnoreGroup, StandardIgnore

FLYTE_LOCAL_REGISTRY = "localhost:30000"
FLYTE_ENVD_CONTEXT = "FLYTE_ENVD_CONTEXT"


class EnvdImageSpecBuilder(ImageSpecBuilder):
Expand All @@ -38,6 +39,9 @@ def build_image(self, image_spec: ImageSpec):


def envd_context_switch(registry: str):
if os.getenv(FLYTE_ENVD_CONTEXT):
execute_command(f"envd context use --name {os.getenv(FLYTE_ENVD_CONTEXT)}")
return
if registry == FLYTE_LOCAL_REGISTRY:
# Assume buildkit daemon is running within the sandbox and exposed on port 30003
command = "envd context create --name flyte-sandbox --builder tcp --builder-address localhost:30003 --use"
Expand Down

0 comments on commit b98e941

Please sign in to comment.