Ensure llama stack build --config <> --image-type <> works (#879)

Fix the issues brought up in
https://github.com/meta-llama/llama-stack/issues/870

Test all combinations of (conda, container) vs. (template, config)
combos.
This commit is contained in:
Ashwin Bharambe 2025-01-25 11:13:36 -08:00 committed by GitHub
parent 7de46e40f9
commit 891bf704eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 66 additions and 37 deletions

View file

@ -78,12 +78,15 @@ class StackRun(Subcommand):
config_file = Path(args.config)
has_yaml_suffix = args.config.endswith(".yaml")
template_name = None
if not config_file.exists() and not has_yaml_suffix:
# check if this is a template
config_file = (
Path(REPO_ROOT) / "llama_stack" / "templates" / args.config / "run.yaml"
)
if config_file.exists():
template_name = args.config
if not config_file.exists() and not has_yaml_suffix:
# check if it's a build config saved to conda dir
@ -120,7 +123,12 @@ class StackRun(Subcommand):
importlib.resources.files("llama_stack")
/ "distribution/start_container.sh"
)
run_args = [script, config.container_image]
image_name = (
f"distribution-{template_name}"
if template_name
else config.container_image
)
run_args = [script, image_name]
else:
current_conda_env = os.environ.get("CONDA_DEFAULT_ENV")
image_name = args.image_name or current_conda_env