feat: add coder_script_order resource for declarative script ordering#526
Open
SasSwart wants to merge 1 commit into
Open
feat: add coder_script_order resource for declarative script ordering#526SasSwart wants to merge 1 commit into
SasSwart wants to merge 1 commit into
Conversation
Add a config-only managed resource that lets templates declare ordering constraints between coder_script resources on an agent. Each rule block declares that the scripts in run must wait for the scripts in after to reach a given lifecycle state (completes or starts). Multiple resources are additive. Follows the coder_script/coder_env pattern: CreateContext sets a uuid id and validates each rule, with Noop read/delete. Includes docs, an example, and unit tests. Generated by Coder Agents on behalf of @SasSwart.
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.
Overview
Adds a
coder_script_ordermanaged resource that lets templates declare ordering dependencies betweencoder_scriptresources. Coder's provisioner and agent consume these declarations to gate script execution and record ordering in the sync-unit timeline (companion change in coder/coder#27160).A rule declares that every script in
runmust wait for every script inafterto reachstate. Multiplecoder_script_orderblocks (and multipleruleblocks) are additive.Details
provider/script_order.go: config-only managed resource, same pattern ascoder_script/coder_env(Create sets a generated UUID id; Read/Delete are no-ops). Schema is a repeatableruleblock:run: list of strings, required.after: list of strings, optional.state: string, optional, default"completes", validated tocompletes/starts.provider/provider.go: registers"coder_script_order"inResourcesMap.examples/resources/coder_script_order/resource.tf+ generateddocs/resources/script_order.md.provider/script_order_test.go: unit tests covering rule parsing and empty-runhandling.ruleis markedForceNewbecause the resource has no update path (config-only, likecoder_script); the SDK'sInternalValidaterequires it.make fmtandmake gen(tfplugindocs) are clean.Notes
The consuming coder/coder change keys off the
coder_script_ordertype name in Terraform state, so it can be developed and unit-tested against state fixtures. End-to-end use requires this resource to be released and the provider version bumped in coder/coder.Generated by Coder Agents on behalf of @SasSwart.