Summary
On the Kubernetes path, a service whose environment: is a sequence crashes with a ValueError for two entry forms that are legal in Docker Compose:
- SOME_VAR — the pass-through form (take the value from the environment)
- URL=a=b — a value that itself contains =
Both deploy fine on compose and fail on k8s, so a pod file can be validated locally and then break only against a cluster.
Cause
src/stack/deploy/k8s/helpers.py:355, in envs_from_compose_file:
env_var, env_val = item.split("=", 2)
split("=", 2) yields up to three parts, so URL=a=b unpacks into two names and raises. With no = at all it yields one part and raises as well. The sibling function envs_from_environment_variables_map (same file, ~line 369) already uses the correct split("=", 1), but that still doesn't cover the no-= case.
Why the pass-through form matters
docs/stack-files.md:371 documents - SOME_VAR as a legal entry that "carries no value of its own" and shadows nothing, and _warn_about_shadowed_config (src/stack/deploy/deployment_create.py:449-479) handles it explicitly. So the form is documented and supported everywhere except the k8s env builder.
Suggested fix
In envs_from_compose_file, split on "=" with maxsplit 1, and for an entry with no = take the value from environ (matching Compose semantics), omitting the variable when it is unset.
Found while reviewing PR #289; not part of that diff.
Summary
On the Kubernetes path, a service whose
environment:is a sequence crashes with aValueErrorfor two entry forms that are legal in Docker Compose:- SOME_VAR— the pass-through form (take the value from the environment)- URL=a=b— a value that itself contains=Both deploy fine on compose and fail on k8s, so a pod file can be validated locally and then break only against a cluster.
Cause
src/stack/deploy/k8s/helpers.py:355, inenvs_from_compose_file:split("=", 2)yields up to three parts, soURL=a=bunpacks into two names and raises. With no=at all it yields one part and raises as well. The sibling functionenvs_from_environment_variables_map(same file, ~line 369) already uses the correctsplit("=", 1), but that still doesn't cover the no-=case.Why the pass-through form matters
docs/stack-files.md:371documents- SOME_VARas a legal entry that "carries no value of its own" and shadows nothing, and_warn_about_shadowed_config(src/stack/deploy/deployment_create.py:449-479) handles it explicitly. So the form is documented and supported everywhere except the k8s env builder.Suggested fix
In
envs_from_compose_file, split on"="with maxsplit 1, and for an entry with no=take the value fromenviron(matching Compose semantics), omitting the variable when it is unset.Found while reviewing PR #289; not part of that diff.