CLI spec: stack becomes route; base becomes layout
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
parent
5925767841
commit
8b77c15eac
99
cmd/spec.cue
99
cmd/spec.cue
@ -29,29 +29,21 @@ import (
|
|||||||
description: "A system for application delivery as code (ADC)"
|
description: "A system for application delivery as code (ADC)"
|
||||||
|
|
||||||
doc: """
|
doc: """
|
||||||
Every dagger operation happens inside a STACK: an isolated sandbox with its own state and execution environment.
|
Every dagger command is applied to a route. A route is a complete delivery environment with its own layout, inputs and outputs.
|
||||||
|
|
||||||
A stack is made of 3 layers:
|
The same application can be delivered in different configurations using different routes.
|
||||||
1. Base configuration (see `dagger base`)
|
For example, an application may have a "production" route, staging routes for QA, and experimental development routes.
|
||||||
2. Input values and artifacts (see `dagger input`)
|
|
||||||
3. Output values and artifacts (see `dagger output`)
|
|
||||||
|
|
||||||
If a command does not specify a stack explicitly, dagger tries to auto-select by searching for stacks connected
|
If a route is not specified, dagger auto-selects one as follows:
|
||||||
to the current directory, either as a base, input or base:
|
* If exactly one route is connected to the current directory, the command proceeds automatically.
|
||||||
- If no stack matches the search, the command fails
|
* If more than one route matches, the user is prompted to select one.
|
||||||
- If exactly one stack matches, the command proceeds in that stack
|
* If no route matches, the command returns an error.
|
||||||
- If more than one stack matches, the user is prompted to select one of them
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
flag: {
|
flag: {
|
||||||
"--workspace": {
|
"--route": {
|
||||||
alt: "-w"
|
alt: "-r"
|
||||||
description: "Select a workspace"
|
description: "Select a route"
|
||||||
default: "$HOME/.dagger"
|
|
||||||
}
|
|
||||||
"--stack": {
|
|
||||||
alt: "-s"
|
|
||||||
description: "Select a stack"
|
|
||||||
arg: "NAME"
|
arg: "NAME"
|
||||||
}
|
}
|
||||||
"--log-format": {
|
"--log-format": {
|
||||||
@ -68,25 +60,25 @@ import (
|
|||||||
|
|
||||||
command: {
|
command: {
|
||||||
new: {
|
new: {
|
||||||
description: "Create a new stack"
|
description: "Create a new route"
|
||||||
flag: {
|
flag: {
|
||||||
"--name": {
|
"--name": {
|
||||||
alt: "-n"
|
alt: "-n"
|
||||||
description: "Specify a stack name"
|
description: "Specify a route name"
|
||||||
default: "name of current directory"
|
default: "name of current directory"
|
||||||
}
|
}
|
||||||
|
|
||||||
"--base-dir": description: "Load base configuration from a local directory"
|
"--layout-dir": description: "Load layout from a local directory"
|
||||||
|
|
||||||
"--base-git": description: "Load base configuration from a git repository"
|
"--layout-git": description: "Load layout from a git repository"
|
||||||
|
|
||||||
"--base-package": description: "Load base configuration from a cue package"
|
"--layout-package": description: "Load layout from a cue package"
|
||||||
|
|
||||||
"--base-file": description: "Load base configuration from a cue or json file"
|
"--layout-file": description: "Load layout from a cue or json file"
|
||||||
|
|
||||||
"--up": {
|
"--up": {
|
||||||
alt: "-u"
|
alt: "-u"
|
||||||
description: "Bring the stack online"
|
description: "Bring the route online"
|
||||||
}
|
}
|
||||||
|
|
||||||
"--setup": {
|
"--setup": {
|
||||||
@ -96,18 +88,18 @@ import (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list: description: "List available stacks"
|
list: description: "List available routes"
|
||||||
|
|
||||||
query: {
|
query: {
|
||||||
arg: "[EXPR] [flags]"
|
arg: "[EXPR] [flags]"
|
||||||
description: "Query the contents of a stack"
|
description: "Query the contents of a route"
|
||||||
doc:
|
doc:
|
||||||
"""
|
"""
|
||||||
EXPR may be any valid CUE expression. The expression is evaluated against the stack contents. The stack is not changed.
|
EXPR may be any valid CUE expression. The expression is evaluated against the route contents. The route is not changed.
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
# Print all contents of the input and base layers (omit output)
|
# Print all contents of the layout and input layers (omit output)
|
||||||
$ dagger query -l input,base
|
$ dagger query -l input,layout
|
||||||
|
|
||||||
# Print complete contents for a particular component
|
# Print complete contents for a particular component
|
||||||
$ dagger query www.build
|
$ dagger query www.build
|
||||||
@ -126,7 +118,7 @@ import (
|
|||||||
// Use --revision or --change or --change-id instead?
|
// Use --revision or --change or --change-id instead?
|
||||||
"--version": {
|
"--version": {
|
||||||
alt: "-v"
|
alt: "-v"
|
||||||
description: "Query a specific version of the stack"
|
description: "Query a specific version of the route"
|
||||||
default: "latest"
|
default: "latest"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +131,7 @@ import (
|
|||||||
"--layer": {
|
"--layer": {
|
||||||
alt: "-l"
|
alt: "-l"
|
||||||
description: """
|
description: """
|
||||||
Comma-separated list of layers to query (any of "input", "base", "output")
|
Comma-separated list of layers to query (any of "input", "layout", "output")
|
||||||
"""
|
"""
|
||||||
default: "all"
|
default: "all"
|
||||||
}
|
}
|
||||||
@ -148,75 +140,70 @@ import (
|
|||||||
}
|
}
|
||||||
|
|
||||||
up: {
|
up: {
|
||||||
description: "Bring a stack online using latest base and inputs"
|
description: "Bring a route online with latest layout and inputs"
|
||||||
flag: "--no-cache": description: "Disable all run cache"
|
flag: "--no-cache": description: "Disable all run cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
down: {
|
down: {
|
||||||
description: "Take a stack offline (WARNING: may destroy infrastructure)"
|
description: "Take a route offline (WARNING: may destroy infrastructure)"
|
||||||
flag: "--no-cache": description: "Disable all run cache"
|
flag: "--no-cache": description: "Disable all run cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
history: description: "List past changes to a stack"
|
history: description: "List past changes to a route"
|
||||||
|
|
||||||
destroy: {
|
delete: {
|
||||||
description: "Destroy a stack"
|
description: "Delete a route after taking it offline (WARNING: may destroy infrastructure)"
|
||||||
|
|
||||||
flag: "--force": {
|
|
||||||
alt: "-f"
|
|
||||||
description: "Destroy environment state even if cleanup pipelines fail to complete (EXPERTS ONLY)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base: {
|
layout: {
|
||||||
description: "Manage a stack's base configuration"
|
description: "Manage a route's layout"
|
||||||
|
|
||||||
command: {
|
command: {
|
||||||
package: {
|
package: {
|
||||||
description: "Load base configuration from a cue package"
|
description: "Load layout from a cue package"
|
||||||
arg: "PKG"
|
arg: "PKG"
|
||||||
doc:
|
doc:
|
||||||
"""
|
"""
|
||||||
Examples:
|
Examples:
|
||||||
dagger base package dagger.io/templates/jamstack
|
dagger layout package dagger.io/templates/jamstack
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
dir: {
|
dir: {
|
||||||
description: "Load base configuration from a local directory"
|
description: "Load layout from a local directory"
|
||||||
arg: "PATH"
|
arg: "PATH"
|
||||||
doc:
|
doc:
|
||||||
"""
|
"""
|
||||||
Examples:
|
Examples:
|
||||||
dagger base dir ./infra/prod
|
dagger layout dir ./infra/prod
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
git: {
|
git: {
|
||||||
description: "Load base configuration from a git repository"
|
description: "Load layout from a git repository"
|
||||||
arg: "REMOTE REF [SUBDIR]"
|
arg: "REMOTE REF [SUBDIR]"
|
||||||
doc:
|
doc:
|
||||||
"""
|
"""
|
||||||
Examples:
|
Examples:
|
||||||
dagger base git https://github.com/dagger/dagger main examples/simple
|
dagger layout git https://github.com/dagger/dagger main examples/simple
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
file: {
|
file: {
|
||||||
description: "Load base configuration from a cue file"
|
description: "Load layout from a cue file"
|
||||||
arg: "PATH|-"
|
arg: "PATH|-"
|
||||||
doc:
|
doc:
|
||||||
"""
|
"""
|
||||||
Examples:
|
Examples:
|
||||||
dagger base file ./base.cue
|
dagger layout file ./layout.cue
|
||||||
echo 'message: "hello, \(name)!", name: string | *"world"' | dagger base file -
|
echo 'message: "hello, \(name)!", name: string | *"world"' | dagger layout file -
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input: {
|
input: {
|
||||||
description: "Manage a stack's inputs"
|
description: "Manage a route's inputs"
|
||||||
|
|
||||||
command: {
|
command: {
|
||||||
// FIXME: details of individual input commands
|
// FIXME: details of individual input commands
|
||||||
@ -229,10 +216,10 @@ import (
|
|||||||
}
|
}
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
description: "Manage a stack's outputs"
|
description: "Manage a route's outputs"
|
||||||
// FIXME: bind output values or artifacts
|
// FIXME: bind output values or artifacts
|
||||||
// to local dir or file
|
// to local dir or file
|
||||||
// BONUS: bind a stack output to another stack's input?
|
// BONUS: bind a route output to another route's input?
|
||||||
}
|
}
|
||||||
|
|
||||||
login: description: "Login to Dagger Cloud"
|
login: description: "Login to Dagger Cloud"
|
||||||
|
Reference in New Issue
Block a user