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
12 changes: 2 additions & 10 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,14 @@ env-namespace:
# file list failed to build reports a clean tree, which is the one answer a
# check like this must never give by accident.
listing=$(mktemp)
scanned=$(mktemp)
trap 'rm -f "${listing}" "${scanned}"' EXIT
trap 'rm -f "${listing}"' EXIT
git ls-files -z > "${listing}"
if [ ! -s "${listing}" ]; then
echo "no tracked files listed — the scan checked nothing" >&2
exit 1
fi
# The migration table in the environment-variables guide is the one place
# the old names are allowed, because naming them is the whole point of it.
grep -zZv '^site/src/content/docs/guides/environment-variables.mdx$' < "${listing}" > "${scanned}" || true
if [ ! -s "${scanned}" ]; then
echo "the exemption matched every tracked file — the scan checked nothing" >&2
exit 1
fi
set +e
stray=$(xargs -0 grep -nHE '\bOB_[A-Z0-9_]+' < "${scanned}")
stray=$(xargs -0 grep -nHE '\bOB_[A-Z0-9_]+' < "${listing}")
status=$?
set -e
case "${status}" in
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Starting from an existing Compose project, `ob init` writes the first draft.
This is a complete single-workload project:

```yaml
# yaml-language-server: $schema=https://onebox.run/schemas/application/v1alpha1/application.schema.json
apiVersion: onebox.run/v1alpha1
# yaml-language-server: $schema=https://onebox.run/schemas/application/v1alpha2/application.schema.json
apiVersion: onebox.run/v1alpha2
kind: Application
metadata:
name: shop
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$id": "https://onebox.run/schemas/application/v1alpha1/application.schema.json",
"$id": "https://onebox.run/schemas/application/v1alpha2/application.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"description": "One application, its workloads, the services it needs, and how a release rolls out.",
"properties": {
"apiVersion": {
"const": "onebox.run/v1alpha1",
"const": "onebox.run/v1alpha2",
"description": "Authored Application API identity.",
"type": "string"
},
Expand Down Expand Up @@ -1299,35 +1299,6 @@
"additionalProperties": {
"additionalProperties": false,
"allOf": [
{
"if": {
"required": [
"execution"
]
},
"then": {
"not": {
"required": [
"compose"
]
},
"properties": {
"dataEffect": {
"const": "None"
},
"deploymentPhase": {
"const": "None"
},
"operatorRun": {
"const": "Allowed"
}
},
"required": [
"schedule",
"dataEffect"
]
}
},
{
"oneOf": [
{
Expand Down Expand Up @@ -1474,11 +1445,6 @@
"required": [
"inputs"
]
},
{
"required": [
"execution"
]
}
]
}
Expand Down Expand Up @@ -1690,104 +1656,6 @@
},
"type": "array"
},
"execution": {
"additionalProperties": false,
"description": "Opt-in durable scheduled execution. Requires a native operator-runnable phase-none job with dataEffect None. Stores non-secret checkpoints on the host and permits explicit same-release resume.",
"properties": {
"retention": {
"default": "168h",
"description": "Time from creation during which an unsuccessful execution may be resumed, at most 30d. Active executions remain protected. Expects a duration such as 30s, 5m, 1h30m or 14d.",
"pattern": "^(([0-9]+([.][0-9]+)?(ns|us|µs|ms|s|m|h))+|[0-9]+d)$",
"type": "string"
},
"steps": {
"description": "Optional ordered steps using this job's image and entrypoint. Omit to execute the job command as one step. At most 32 steps.",
"items": {
"additionalProperties": false,
"properties": {
"command": {
"description": "Argument vector passed to the job image's entrypoint. No shell evaluation is performed.",
"items": {
"type": "string"
},
"maxItems": 128,
"minItems": 1,
"type": "array"
},
"id": {
"description": "Unique stable step identifier, used by output references. Expects lower-case letters, digits and hyphens, starting with a letter, at most 40 characters.",
"pattern": "^[a-z]([a-z0-9-]{0,38}[a-z0-9])?$",
"type": "string"
},
"inputs": {
"additionalProperties": {
"type": "string"
},
"description": "Environment variables populated from a preceding step's declared output, written as step.OUTPUT.",
"propertyNames": {
"pattern": "^[A-Z][A-Z0-9_]*$"
},
"type": "object"
},
"outputs": {
"description": "Required string keys in the JSON object written to ONEBOX_OUTPUT_FILE. Values are non-secret, at most 4096 bytes each and 16384 bytes total.",
"items": {
"description": "Expects upper-case letters, digits and underscores, starting with a letter.",
"pattern": "^[A-Z][A-Z0-9_]*$",
"type": "string"
},
"maxItems": 32,
"type": "array",
"uniqueItems": true
},
"retry": {
"additionalProperties": false,
"description": "Per-step retry policy; defaults to schedule.retry. All steps and backoff share the activation timeout.",
"properties": {
"attempts": {
"default": 1,
"description": "Total attempts including the first, 1 to 10.",
"examples": [
3
],
"maximum": 10,
"minimum": 1,
"type": "integer"
},
"backoff": {
"default": "30s",
"description": "Sleep before the second attempt; it doubles after each failure. Expects a duration such as 30s, 5m, 1h30m or 14d.",
"examples": [
"1m"
],
"pattern": "^(([0-9]+([.][0-9]+)?(ns|us|µs|ms|s|m|h))+|[0-9]+d)$",
"type": "string"
},
"maxBackoff": {
"default": "10m",
"description": "Upper bound for the doubling sleep. Expects a duration such as 30s, 5m, 1h30m or 14d.",
"examples": [
"30m"
],
"pattern": "^(([0-9]+([.][0-9]+)?(ns|us|µs|ms|s|m|h))+|[0-9]+d)$",
"type": "string"
}
},
"type": "object"
}
},
"required": [
"id",
"command"
],
"type": "object"
},
"maxItems": 32,
"type": "array"
}
},
"type": "object"
},
"extraHosts": {
"description": "Additional host-to-address entries added to the container.",
"items": {
Expand Down Expand Up @@ -2562,6 +2430,6 @@
"metadata",
"spec"
],
"title": "Onebox Application (onebox.run/v1alpha1)",
"title": "Onebox Application (onebox.run/v1alpha2)",
"type": "object"
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Package applicationv1alpha1 embeds the public Onebox Application contract.
package applicationv1alpha1
// Package applicationv1alpha2 embeds the public Onebox Application contract.
package applicationv1alpha2

import _ "embed"

// Schema is the exact JSON Schema published for onebox.run/v1alpha1.
// Schema is the exact JSON Schema published for onebox.run/v1alpha2.
//
//go:embed application.schema.json
var Schema []byte
2 changes: 1 addition & 1 deletion api/testdata/application/invalid/extension.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: onebox.run/v1alpha1
apiVersion: onebox.run/v1alpha2
kind: Application
metadata: {name: shop}
spec:
Expand Down
15 changes: 15 additions & 0 deletions api/testdata/application/invalid/previous-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: onebox.run/v1alpha1
kind: Application
metadata:
name: shop
spec:
environments:
production:
server: root@example.invalid
workloads:
nightly:
role: Job
image: busybox
dataEffect: None
schedule:
cron: "0 2 * * *"
17 changes: 17 additions & 0 deletions api/testdata/application/invalid/retired-job-execution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: onebox.run/v1alpha2
kind: Application
metadata:
name: shop
spec:
environments:
production:
server: root@example.invalid
workloads:
nightly:
role: Job
image: busybox
dataEffect: None
schedule:
cron: "0 2 * * *"
execution:
retention: 168h
2 changes: 1 addition & 1 deletion api/testdata/application/invalid/root-shorthand.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: onebox.run/v1alpha1
apiVersion: onebox.run/v1alpha2
kind: Application
metadata: {name: shop}
spec:
Expand Down
2 changes: 1 addition & 1 deletion api/testdata/application/invalid/snake-case.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: onebox.run/v1alpha1
apiVersion: onebox.run/v1alpha2
kind: Application
metadata: {name: shop}
spec:
Expand Down
2 changes: 1 addition & 1 deletion api/testdata/application/valid/minimal.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: onebox.run/v1alpha1
apiVersion: onebox.run/v1alpha2
kind: Application
metadata:
name: shop
Expand Down
4 changes: 2 additions & 2 deletions cmd/ob-docgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
// So this program is the only writer of `site/src/content/docs/reference/`
// — the field pages, `drivers.mdx`, `errors.mdx` and `cli.mdx` — and of the
// schema published below `site/public/schemas/application/v1alpha1/`. Those pages carry
// schema published below `site/public/schemas/application/v1alpha2/`. Those pages carry
// a generated marker,
// which `--check` reads in both directions: it fails when a page differs from
// what this binary would produce, and when a marked page survives that no
Expand Down Expand Up @@ -67,7 +67,7 @@ func main() {
os.Exit(1)
}
schema = append(schema, '\n')
publicFiles := map[string]string{"schemas/application/v1alpha1/application.schema.json": string(schema)}
publicFiles := map[string]string{"schemas/application/v1alpha2/application.schema.json": string(schema)}

if check {
if err := verify(out, files); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/ob-docgen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ func TestPublishedSchemaMatchesTheCheckedInCopy(t *testing.T) {
}
// Skipping on a read failure would turn "someone moved the file" into a
// passing test, which is the drift this exists to catch.
onDisk, err := os.ReadFile(filepath.Join("..", "..", "api", "application", "v1alpha1", "application.schema.json"))
onDisk, err := os.ReadFile(filepath.Join("..", "..", "api", "application", "v1alpha2", "application.schema.json"))
if err != nil {
t.Fatalf("the checked-in schema must be readable: %v", err)
}
if strings.TrimSpace(string(generated)) != strings.TrimSpace(string(onDisk)) {
t.Error("the published schema differs from api/application/v1alpha1/application.schema.json")
t.Error("the published schema differs from api/application/v1alpha2/application.schema.json")
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/ob/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestConfirmInteractiveDeployRequiresConfirmationWithoutPolicyApproval(t *te
func writeProject(t *testing.T) string {
t.Helper()
dir := t.TempDir()
obYAML := `apiVersion: onebox.run/v1alpha1
obYAML := `apiVersion: onebox.run/v1alpha2
kind: Application
metadata:
name: demo
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestValidateOK(t *testing.T) {

func TestPreflightBlocksDeploy(t *testing.T) {
dir := writeProject(t)
obYAML := `apiVersion: onebox.run/v1alpha1
obYAML := `apiVersion: onebox.run/v1alpha2
kind: Application
metadata:
name: demo
Expand Down
Loading
Loading