Repository navigation
Accept ${VAR} references in typed stacker.yml fields - #292
Merged
Merged
Conversation
local-ai-packaged writes replicas: ${OLLAMA_CPU_REPLICAS}. POST
/api/v1/deploy/validate reads stacker.yml without filling variables, so
the reference arrived as the literal string and was refused with
"replicas must be a whole number, 0 or more". The same happened to every
CLI command that reads stacker.yml raw and writes it back.
A count is now a number or a ${VAR} reference (${NAME}, ${NAME:-1} and
the other compose modifiers, $NAME). Read raw, the reference is kept and
written to the generated compose and back to stacker.yml as is; filled,
it is the number. Anything else is still refused. A server-rendered
compose only carries a known number, so a reference is left out there.
Tests (fail before the fix): oneclick_deploy
replicas_from_an_env_reference_is_valid, stack_service_runtime_fields
a_count_written_as_a_variable_reference_is_kept. nextest 2879 passed,
36 skipped; BDD 334 scenarios passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012TKZy6f5shPzM9WLdswH6f
The CLI fills ${VAR} before it reads stacker.yml, and the filled value is
a string. Every boolean and number refused it: privileged: ${PRIV} with
PRIV=false failed with "invalid type: string \"false\", expected a
boolean", and the same for healthcheck.retries, proxy.auto_detect,
deploy.server.port, ai.enabled/timeout, monitoring.status_panel,
metrics.enabled/telegraf, alerts.interval/on_recovery, hooks.notify and
the pipe retry settings. They now also read "true"/"false" and a whole
number written as a string; anything else is still refused.
Deploy validation reads stacker.yml without filling variables. A port
mapping with a variable in it ("${APP_PORT:-8080}:80",
"127.0.0.1:${DB_PORT}:5432") or a public port "${PUBLIC_PORT}/tcp" failed
E007/E005. The variable part is now let through and the rest of the
entry is still checked.
Still refused when unfilled: a boolean, a number other than replicas or a
device count, or a fixed-choice value written as ${VAR}.
Tests (fail before the fix): stacker_yml_variable_references. nextest
2883 passed, 36 skipped; BDD 334 scenarios passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012TKZy6f5shPzM9WLdswH6f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
POST /api/v1/deploy/validatereads stacker.yml without filling variables. A stack with(local-ai-packaged) was refused with
replicas must be a whole number, 0 or more, so its Quick Deploy could not start. CLI commands that read stacker.yml raw and write it back failed the same way. This came in withff95ebd9(typeddeploy.replicas).A sweep that wrote
${X}into every value of a full stacker.yml found more:privileged: ${PRIV}withPRIV=false:invalid type: string "false", expected a boolean);"${APP_PORT:-8080}:80","127.0.0.1:${DB_PORT}:5432",public_ports: ["${PUBLIC_PORT}/tcp"]) failed E007/E005.Changes
91319659:deploy.replicasand a devicecountare a number or a${VAR}reference (${NAME},${NAME:-1}and the other compose modifiers,$NAME). Read raw, the reference is kept as written, both in the generated compose and when stacker.yml is written back. Filled, it is the number. Anything else is still refused. A server-rendered compose (project app) can only carry a known number, so a reference is left out there.b22303c5:"true"/"false"and a whole number written as a string;${VAR}part through and still checks the rest of the entry (range, protocol).Still refused when unfilled: a boolean, a number other than replicas or count, or a fixed-choice value (
app.type,restart,deploy.targetand so on) written as${VAR}. Its type cannot be known until the deploy fills it. No stack in stacker-project-examples does this.Tests
The new tests failed before the fix:
oneclick_deploy::replicas_from_an_env_reference_is_valid;stack_service_runtime_fields_contract(3 new);stacker_yml_variable_references(4 new).Results:
cargo nextest run -E 'not binary(bdd)': 2883 passed, 36 skipped;cargo test --test bdd: 334 scenarios passed.cargo clippy -- -D warningsfails on the existingbuild.rs:37. Without-D warningsit reports 86 warnings, all in code this PR does not touch.Contract mirror updated (
deploy.replicasand count may be a reference).🤖 Generated with Claude Code
https://claude.ai/code/session_012TKZy6f5shPzM9WLdswH6f