Skip to content

Add service settings and roll back only to deployments that served - #28

Merged
lnsp merged 1 commit into
masterfrom
service-settings
Nov 21, 2026
Merged

lnsp merged 1 commit into
masterfrom
service-settings

Conversation

@lnsp

@lnsp lnsp commented Nov 21, 2026

Copy link
Copy Markdown
Member

Client side of service settings (RFC-0013 release 2) and a fix to rollback's target choice.

.valar.yml

deployment:
  cpu: 500      # millicores, 100-2000 in steps of 100
  memory: 512   # MiB, 128-4096

deployment.http and deployment.minRunning are accepted as well; the server validates them. The keys are in the config types, schema/valar.yml.json and the unknown-key check. Files without them behave as before.

build push

When the push deploys, the declared keys go out in one PATCH .../settings after the artifact upload (which creates a new service) and before POST builds, because the deployment row pins settings when the build is submitted. Nothing is sent when no key is declared, with --no-deploy, or with deployment.skip. deployment.skip was documented as "build without deploying" but never read; the push now honours it.

Refusals keep the existing exit codes: 403 is notAllowed (4), with a hint that raising needs a token with full access when the server names a field; 400 is invalid (2). A server without the settings route fails the push with a clear message instead of ignoring the keys.

valar service settings

  • valar service settings [service] shows each value, whether it was set or is the default, its bounds, and the project's budget; --json passes the response through.
  • valar service settings set cpu=500 memory=2048 and valar service settings reset memory wrap PATCH.

deployment rollback

The target used to be the deployment delta places below the newest by version number, so it could be a failed or never-served deployment. It is now the newest deployment below the live one (the newest done) that served: done or expired, with no failure and no error. --delta n counts only those, and must be at least 1. The API does not distinguish an expired deployment that served from one superseded before activation, so both count.

--settings pinned|current is passed through; without it the server's default (pinned) applies.

Tests

Table-driven against a test HTTP server: PATCH between upload and build, no PATCH without keys or with --no-deploy, 403/400 mapping and the hint, old server, settings output (human and JSON passthrough), set/reset parsing, rollback target selection, and the schema golden file.

.valar.yml accepts deployment.cpu (millicores), deployment.memory (MiB),
deployment.http and deployment.minRunning. A push that deploys sends the
declared keys in one PATCH settings after the upload and before the build,
so the build's deployment pins them; nothing is sent without keys, with
--no-deploy or with deployment.skip, which the push now honours as
documented. Refusals keep their exit codes: 403 is notAllowed with a hint
that raising needs a token with full access, 400 is invalid.

valar service settings [service] shows the settings, which were set, their
bounds and the project's budget, and passes the response through with
--json. settings set name=value and settings reset name wrap PATCH.

deployment rollback now targets the newest deployment below the live one
that served (done or expired, without a failure or error) instead of
counting versions, which could pick a failed deployment. --delta counts
only those. --settings pinned|current is passed through.
@lnsp
lnsp merged commit 2a70c9e into master Nov 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant