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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
run: |
./ob-smoke${{ runner.os == 'Windows' && '.exe' || '' }} version
./ob-smoke${{ runner.os == 'Windows' && '.exe' || '' }} --help
./ob-smoke${{ runner.os == 'Windows' && '.exe' || '' }} schema --out "${{ runner.temp }}/onebox.run-v2.schema.json"
./ob-smoke${{ runner.os == 'Windows' && '.exe' || '' }} schema --out "${{ runner.temp }}/onebox.run-v1.schema.json"

e2e:
name: End-to-end (Docker)
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://raw.githubusercontent.com/labstack/onebox/main/docs/onebox.run-v2.schema.json
api_version: onebox.run/v2
# yaml-language-server: $schema=https://raw.githubusercontent.com/labstack/onebox/main/docs/onebox.run-v1.schema.json
api_version: onebox.run/v1
app: shop
environments:
production:
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 at `site/public/onebox.run-v2.schema.json`. Those pages carry
// schema published at `site/public/onebox.run-v1.schema.json`. 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{"onebox.run-v2.schema.json": string(schema)}
publicFiles := map[string]string{"onebox.run-v1.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 @@ -318,12 +318,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("..", "..", "docs", "onebox.run-v2.schema.json"))
onDisk, err := os.ReadFile(filepath.Join("..", "..", "docs", "onebox.run-v1.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 docs/onebox.run-v2.schema.json")
t.Error("the published schema differs from docs/onebox.run-v1.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 @@ -63,7 +63,7 @@ func writeProject(t *testing.T) string {
t.Helper()
dir := t.TempDir()
obYAML := `
api_version: onebox.run/v2
api_version: onebox.run/v1
app: demo
environments: { production: { server: deploy@example.invalid } }
workloads:
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestValidateOK(t *testing.T) {
func TestPreflightBlocksDeploy(t *testing.T) {
dir := writeProject(t)
obYAML := `
api_version: onebox.run/v2
api_version: onebox.run/v1
app: demo
environments: { production: { server: deploy@example.invalid } }
workloads:
Expand Down
4 changes: 2 additions & 2 deletions cmd/ob/doctor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func doctorTestDependencies(t *testing.T) doctorDependencies {
oldBinary := filepath.Join(oldDir, "ob")
currentBinary := filepath.Join(currentDir, "ob")
cfg := &app.Spec{
APIVersion: "onebox.run/v2",
APIVersion: "onebox.run/v1",
Name: "demo",
Environments: map[string]app.Environment{
"production": {
Expand Down Expand Up @@ -195,7 +195,7 @@ func TestDoctorReportsIncompatibleProjectPolicy(t *testing.T) {
deps := doctorTestDependencies(t)
deps.loadConfig = func(string) (*app.Spec, error) {
return &app.Spec{
APIVersion: "onebox.run/v2",
APIVersion: "onebox.run/v1",
Environments: map[string]app.Environment{
"production": {Policy: app.Policy{MinOneboxVersion: "v2027.1.0"}},
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/ob/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func runInit(ctx context.Context, cmd *cobra.Command, g *globalFlags) error {
// errors from the moment the file exists rather than after someone finds
// out it could.
fmt.Fprintf(&b, "# yaml-language-server: $schema=%s\n", app.SchemaID)
b.WriteString("api_version: onebox.run/v2\n")
b.WriteString("api_version: onebox.run/v1\n")
fmt.Fprintf(&b, "app: %s\n", application)
b.WriteString("environments:\n production:\n server: deploy@CHANGE-ME\n")
b.WriteString("workloads:\n")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ob/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestInitClassifiesAndDoctors(t *testing.T) {
}
y := string(b)
for _, want := range []string{
"api_version: onebox.run/v2",
"api_version: onebox.run/v1",
"server: deploy@CHANGE-ME",
"workloads:",
"role: application",
Expand Down
4 changes: 2 additions & 2 deletions cmd/ob/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"testing"
)

const mainTestProject = `api_version: onebox.run/v2
const mainTestProject = `api_version: onebox.run/v1
app: demo
environments: {production: {server: deploy@example.invalid}}
image: nginx:1.27
proxy: {kind: none}
`

const mainTestBuildProject = `api_version: onebox.run/v2
const mainTestBuildProject = `api_version: onebox.run/v1
app: demo
environments: {production: {server: deploy@example.invalid}}
workloads:
Expand Down
4 changes: 2 additions & 2 deletions cmd/ob/ops_contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func writeOpsContractProject(t *testing.T, dir string, encrypted bool) string {
}
}
path := filepath.Join(dir, "project.yml")
if err := os.WriteFile(path, []byte(`api_version: onebox.run/v2
if err := os.WriteFile(path, []byte(`api_version: onebox.run/v1
app: shop
environments:
production: {server: deploy@example.invalid}
Expand Down Expand Up @@ -169,7 +169,7 @@ func TestDestroyConfirmationMismatchIsCancelledBeforeTargetContact(t *testing.T)
func TestServiceLogsAndExecNDJSONTagChannelsAndTargetKind(t *testing.T) {
dir := t.TempDir()
config := filepath.Join(dir, "project.yml")
if err := os.WriteFile(config, []byte(`api_version: onebox.run/v2
if err := os.WriteFile(config, []byte(`api_version: onebox.run/v1
app: shop
environments:
production: {server: deploy@example.invalid}
Expand Down
8 changes: 4 additions & 4 deletions cmd/ob/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func TestStructuredDeployRequiresApprovalArtifactWithoutPrompting(t *testing.T)
// failure appears at the consumer rather than here.
func TestStructuredOutputCarriesNoDiagnostics(t *testing.T) {
dir := t.TempDir()
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v2
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v1
app: shop
environments:
production: {server: root@203.0.113.10}
Expand Down Expand Up @@ -347,7 +347,7 @@ routes:
// publish outlives the terminal it would have scrolled off.
func TestStructuredOutputCarriesNoPlaintextSecret(t *testing.T) {
dir := t.TempDir()
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v2
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v1
app: shop
environments:
production: {server: root@203.0.113.10}
Expand Down Expand Up @@ -424,7 +424,7 @@ func TestCommandGroupsValidateOutputBeforeRenderingHelp(t *testing.T) {
func TestEjectStructuredOutputIsVersioned(t *testing.T) {
for _, mode := range []string{"json"} {
dir := t.TempDir()
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v2
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v1
app: shop
environments:
production: {server: root@203.0.113.10}
Expand Down Expand Up @@ -455,7 +455,7 @@ image: nginx

func TestStructuredReadFailuresEmitTypedSafeRecords(t *testing.T) {
dir := t.TempDir()
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v2
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v1
app: shop
environments:
production: {server: root@203.0.113.10}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ob/preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func addPreviewCommand(root *cobra.Command, g *globalFlags) {
cmd := &cobra.Command{
Use: "preview",
Short: "render the runtime the declarative contract generates (no target, no changes)",
Long: "Load an onebox.run/v2 project, resolve the environment's overrides, and print\n" +
Long: "Load an onebox.run/v1 project, resolve the environment's overrides, and print\n" +
"the Compose runtime Onebox would generate, with its content digest.\n\n" +
"Nothing is contacted and nothing is written. Environment values are redacted:\n" +
"a preview must never put a secret on a terminal.",
Expand Down
6 changes: 3 additions & 3 deletions cmd/ob/preview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
)

const previewProject = `api_version: onebox.run/v2
const previewProject = `api_version: onebox.run/v1
app: demo
environments:
production: {server: root@1.2.3.4}
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestPreviewAppliesEnvironmentOverrides(t *testing.T) {
// wrong, where, and what to run.
func TestPreviewFailureIsActionable(t *testing.T) {
dir := t.TempDir()
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v2
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v1
app: demo
environments: {production: {server: h}}
workloads: {web: {role: application, build: ., routes: [{hostname: d.example.com, port: 80}]}}
Expand Down Expand Up @@ -133,7 +133,7 @@ func dirEntries(t *testing.T, dir string) int {
func TestEjectPicksAFreeName(t *testing.T) {
dir := t.TempDir()
writeFile(t, dir, "compose.yaml", "services:\n db: {image: postgres}\n")
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v2
writeFile(t, dir, "ob.yml", `api_version: onebox.run/v1
app: ledger
environments: {production: {server: root@1.2.3.4}}
workloads:
Expand Down
2 changes: 1 addition & 1 deletion cmd/ob/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func addSchemaCommand(root *cobra.Command, g *globalFlags) {
cmd := &cobra.Command{
Use: "schema",
Short: "print the JSON Schema for the project file, for editors",
Long: "Write the JSON Schema for the `onebox.run/v2` project file.\n\n" +
Long: "Write the JSON Schema for the `onebox.run/v1` project file.\n\n" +
"Reference it from the first line of a project so an editor can offer\n" +
"completion, hover documentation and inline errors:\n\n" +
" # yaml-language-server: $schema=" + app.SchemaID + "\n\n" +
Expand Down
3 changes: 1 addition & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ the repository rather than to a reader.

| Path | What it is |
|---|---|
| [`onebox.run-v2.schema.json`](onebox.run-v2.schema.json) | The current JSON Schema for the project file. Generated from the Go model by `ob schema` and tested byte-for-byte against it. `app.SchemaID` points at this path on `main`, and `ob init` writes that URL onto the first line of every scaffolded project. |
| [`onebox.run-v1.schema.json`](onebox.run-v1.schema.json) | The frozen v1 schema, retained so the stable schema URL in existing v1 projects continues to resolve. |
| [`onebox.run-v1.schema.json`](onebox.run-v1.schema.json) | The current JSON Schema for the project file. Generated from the Go model by `ob schema` and tested byte-for-byte against it. `app.SchemaID` points at this path on `main`, and `ob init` writes that URL onto the first line of every scaffolded project. |
| [`product.md`](product.md) | Product direction. Not an implementation contract, and not a capability list. |

## Where the user documentation went
Expand Down
Loading