sky state public push
Replace public state from a file, inline JSON, or stdin.
Synopsis
bash
sky state public push --project <slug> --file <path> [--env <slug>] [--expect-none | --expect-version <version>] [--comment <message>] [--yes]
sky state public push --project <slug> --json <json> [--env <slug>] [--expect-none | --expect-version <version>] [--comment <message>] [--yes]
sky state public push --project <slug> --json - [--env <slug>] [--expect-none | --expect-version <version>] [--comment <message>] [--yes]Description
Takes a JSON object and uploads it as the full public-state document for the specified environment. --file and --json are mutually exclusive, and exactly one is required.
Versions are positive integers, and each successful write increments the version.
Every push is written against an expected version, so a concurrent change is rejected as a conflict. Without a flag, push reads the current state first, uses its version as the expectation, and checks for removed keys or type changes before writing. --expect-none and --expect-version set the expectation directly and skip that read; see the options table.
Authentication follows the CLI auth resolution rules.
Options
| Option | Description |
|---|---|
--project <slug> | Required. Project slug. |
--file <path> | Read JSON from a file. Mutually exclusive with --json. |
--json <string> | Inline JSON string, or - to read from stdin. Mutually exclusive with --file. |
--env <slug> | Target environment. See Environments. |
--expect-none | Write as a first write; fails if public state already exists. Mutually exclusive with --expect-version. |
--expect-version <version> | Positive integer. Write only if the current version equals this value. Mutually exclusive with --expect-none. |
--comment <message> | Commit message for the new version. |
--yes | Skip confirmation prompts for breaking changes. |
--format <format> | Global format. json prints { "version": number } to stdout. |
Examples
bash
sky state public push --project my-app --file state.json --env development
cat state.json | sky state public push --project my-app --json - --env production
sky state public push --project my-app --json '{"banner":{"enabled":true}}' --env staging
sky state public push --project my-app --file state.json --env production --comment "release v2"
sky state public push --project my-app --file state.json --env production --expect-version 7 --yes
sky state public push --project my-app --file state.json --env development --expect-noneOutput
Plain success output goes to stderr:
text
Pushed
Environment: development
New version: 2JSON output goes to stdout:
json
{
"version": 2
}Errors
| Situation | Message |
|---|---|
Neither --file nor --json is provided | One of --file or --json is required. |
Both --file and --json are provided | --file and --json are mutually exclusive. Provide exactly one. |
--env cannot be resolved | Missing required option: --env |
| JSON is invalid | Invalid JSON: ... |
| JSON is not an object | Config must be a JSON object, not an array or primitive. |
Breaking changes in non-TTY without --yes | Non-interactive mode: breaking changes require --yes to confirm. |
| Version conflict | Conflict: environment was updated while editing. |