Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/stack-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,22 @@ published address of a Compose service's port, as for services, and
`{compose.<group>.project}`) and `${VAR}`; `{port}`, `{artifact}` and
`{is_main}` have no value in a command.

An `exec` line is run by the platform shell: `cmd /d /s /c` on Windows,
`sh -c` on Linux and macOS (as a service's `run` and `build`). devstack
expands the placeholders before the shell sees the line; everything else
is the shell's syntax, and that is not portable. Handing a variable to the
step's program, say the address a test suite runs against:

```toml
{ exec = 'E2E_URL={service.web.url} npx playwright test' } # sh: Linux, macOS
{ exec = 'set "E2E_URL={service.web.url}" && npx playwright test' } # cmd: Windows
```

Each line fails under the other shell. A file used on both needs no shell
syntax for it: a profile's `env` reaches every `exec` step
(`[profiles.<name>]`, below), or the step runs a script that takes
`{service.web.url}` as an argument (`node e2e/run.mjs {service.web.url}`).

Name a Compose project with `{compose.<group>.project}`, never literally:
the same command runs in a lane, whose containers are the project
`<project>-<lane>`. With `-p shop-dev` written out, the example above would
Expand Down
4 changes: 4 additions & 0 deletions skills/devstack-config/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ without a stack file starts from `devstack init` (a draft with TODOs).
sets `timeout = "…"`; give a long seed or migration one.
- **Commands with side effects** (deleting data, resetting state) get a
`confirm` text. Steps run in order; one action per step.
- **`exec` runs in the platform shell**: `cmd /d /s /c` on Windows, `sh -c`
elsewhere. `VAR=x cmd` works only under `sh`, `set "VAR=x" && cmd` only
under `cmd`; for a file used on both, pass the value through a profile's
`env` or as an argument to a script.
- **Secrets** do not belong in the stack file. Use `${VAR}` and an env file that
is not committed (`stack.env_files`), with a committed `.env.example` beside it.

Expand Down