deploy: add --provision_only to provision resources without rolling out servers#1847
Draft
ns-kosti wants to merge 5 commits into
Draft
deploy: add --provision_only to provision resources without rolling out servers#1847ns-kosti wants to merge 5 commits into
ns-kosti wants to merge 5 commits into
Conversation
Add a PrepareDeployMode (full deploy vs provision-only) threaded through the deploy planner. No behaviour change yet; the mode is consumed in later commits. Amp-Thread-ID: https://ampcode.com/threads/T-019ef9f5-4ba4-711c-b45c-370fd77b0c55 Co-authored-by: Amp <amp@ampcode.com>
A no-op invocation that consumes resource instance outputs via RequiredOutput. Used by provision-only deployments to balance output accounting when the requested servers (the usual consumers) are not rolled out. Not wired up yet. Amp-Thread-ID: https://ampcode.com/threads/T-019ef9f5-4ba4-711c-b45c-370fd77b0c55 Co-authored-by: Amp <amp@ampcode.com>
In provision-only mode, keep resource provisioning (including servers that resources require, e.g. a colocated database) but do not roll out the requested servers or runtime ingress. A no-op sink consumes resource outputs that the dropped servers would have consumed, keeping the plan's output accounting balanced. Amp-Thread-ID: https://ampcode.com/threads/T-019ef9f5-4ba4-711c-b45c-370fd77b0c55 Co-authored-by: Amp <amp@ampcode.com>
Provisions resources without rolling out the requested servers. Adjusts the completion output to point at "ns deploy" for the rollout. Amp-Thread-ID: https://ampcode.com/threads/T-019ef9f5-4ba4-711c-b45c-370fd77b0c55 Co-authored-by: Amp <amp@ampcode.com>
Cover the two correctness-critical helpers: keeping only resource-required servers, and building an output sink that consumes every produced resource instance. Amp-Thread-ID: https://ampcode.com/threads/T-019ef9f5-4ba4-711c-b45c-370fd77b0c55 Co-authored-by: Amp <amp@ampcode.com>
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.
What
Adds
ns deploy --provision_only, which provisions a stack's resources (e.g.applies Postgres schema) without rolling out the requested servers. This lets
resource provisioning run as its own step — for example, applying database
schema as a gated CI step that can fail before any application rollout.
Why
The resource provider that applies database schema runs as part of every
deploy and emits the connection instance the servers consume. Today there is
no way to run that provisioning on its own. Splitting it out enables:
Note: a subsequent
ns deploystill re-runs the provider, because resourceinstances are produced per-deploy and consumed to build each server's runtime
config — they are not persisted between deploys. This change re-orders
provisioning into its own step; it does not remove it from the rollout deploy.
How
provision-onlyis a deploy planning mode (PrepareDeployMode), not a filterover the assembled plan:
DeploymentSpecbeforedeployment planning, so the requested servers and their runtime-config ops
are never emitted.
from the server-resources discovered while planning resources.
OpConsumeResourceOutputsinvocation consumes the resource instanceoutputs that the dropped servers would have consumed, so the plan's output
accounting stays balanced.
rolled out. Ingress-as-resource fragments deploy through the same path and
are likewise not applied.
Testing
go test ./internal/planning/deploy/...resource-required servers, and building an output sink that consumes every
produced resource instance.
Notes