From ef4e77baa4af230cb4b6c9e71f93041561459634 Mon Sep 17 00:00:00 2001 From: jordanstephens Date: Wed, 24 Jun 2026 11:23:36 -0700 Subject: [PATCH 1/3] inject x-defang-llm on model services --- src/pkg/cli/compose/fixup.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pkg/cli/compose/fixup.go b/src/pkg/cli/compose/fixup.go index 8d9dd8f9f..a90bb201d 100644 --- a/src/pkg/cli/compose/fixup.go +++ b/src/pkg/cli/compose/fixup.go @@ -104,6 +104,10 @@ func FixupServices(ctx context.Context, provider client.Provider, project *compo for name, model := range project.Models { model.Name = name // ensure the model has a name svccfg := fixupModel(model, project, accountInfo) + if svccfg.Extensions == nil { + svccfg.Extensions = make(map[string]interface{}) + } + svccfg.Extensions["x-defang-llm"] = true project.Services[svccfg.Name] = *svccfg } From 3435037e5405d877c3987d81951aef29cd54a154 Mon Sep 17 00:00:00 2001 From: jordanstephens Date: Wed, 24 Jun 2026 11:37:53 -0700 Subject: [PATCH 2/3] convert yaml.fixup files from json to yaml --- .../Fancy-Proj_Dir/compose.yaml.fixup | 2 +- src/testdata/alttestproj/compose.yaml.fixup | 36 +- .../ambiguous-strings/compose.yaml.fixup | 76 ++-- src/testdata/base-image/compose.yaml.fixup | 59 +-- src/testdata/build-image/compose.yaml.fixup | 16 +- src/testdata/build/compose.yaml.fixup | 77 ++-- .../bun-in-compose/compose.yaml.fixup | 37 +- .../bun-in-dockerfile/compose.yaml.fixup | 37 +- .../compose-go-warn/compose.yaml.fixup | 29 +- .../configdetection/compose.yaml.fixup | 31 +- .../configoverride/compose.yaml.fixup | 21 +- src/testdata/debugproj/compose.yaml.fixup | 40 +- src/testdata/dependson/compose.yaml.fixup | 81 ++-- .../compose.yaml.fixup | 34 +- src/testdata/empty/compose.yaml.fixup | 2 +- src/testdata/emptyenv/compose.yaml.fixup | 33 +- src/testdata/extends/compose.yaml.fixup | 193 ++++---- src/testdata/fixupenv/compose.yaml.fixup | 174 +++----- src/testdata/gpu/compose.yaml.fixup | 39 +- src/testdata/healthcheck/compose.yaml.fixup | 256 +++++------ src/testdata/heroku/compose.yaml.fixup | 95 ++-- src/testdata/interpolate/compose.yaml.fixup | 37 +- src/testdata/llm/compose.yaml.fixup | 95 ++-- src/testdata/longname/compose.yaml.fixup | 16 +- src/testdata/models/compose.yaml.fixup | 242 +++++----- src/testdata/mongo/compose.yaml.fixup | 421 +++++++----------- src/testdata/networks/compose.yaml.fixup | 102 ++--- src/testdata/noprojname/compose.yaml.fixup | 2 +- src/testdata/platforms/compose.yaml.fixup | 18 +- src/testdata/ports/compose.yaml.fixup | 193 ++++---- src/testdata/postgres/compose.yaml.fixup | 159 +++---- src/testdata/profiles/compose.yaml.fixup | 35 +- src/testdata/provider/compose.yaml.fixup | 80 ++-- src/testdata/railpack/compose.yaml.fixup | 68 ++- src/testdata/redis/compose.yaml.fixup | 184 +++----- src/testdata/replicas/compose.yaml.fixup | 107 ++--- src/testdata/sanity/compose.yaml.fixup | 49 +- src/testdata/secretname/compose.yaml.fixup | 28 +- src/testdata/static-files/compose.yaml.fixup | 30 +- src/testdata/testproj/compose.yaml.fixup | 108 ++--- src/testdata/toomany/compose.yaml.fixup | 16 +- src/testdata/toomany/docker-compose.yml.fixup | 16 +- 42 files changed, 1372 insertions(+), 2002 deletions(-) diff --git a/src/testdata/Fancy-Proj_Dir/compose.yaml.fixup b/src/testdata/Fancy-Proj_Dir/compose.yaml.fixup index 9e26dfeeb..0967ef424 100644 --- a/src/testdata/Fancy-Proj_Dir/compose.yaml.fixup +++ b/src/testdata/Fancy-Proj_Dir/compose.yaml.fixup @@ -1 +1 @@ -{} \ No newline at end of file +{} diff --git a/src/testdata/alttestproj/compose.yaml.fixup b/src/testdata/alttestproj/compose.yaml.fixup index f2186d249..3d10058f2 100644 --- a/src/testdata/alttestproj/compose.yaml.fixup +++ b/src/testdata/alttestproj/compose.yaml.fixup @@ -1,22 +1,14 @@ -{ - "dfnx": { - "build": { - "context": ".", - "dockerfile": "Dockerfile" - }, - "command": null, - "deploy": { - "resources": { - "limits": { - "memory": "268435456" - } - }, - "placement": {} - }, - "entrypoint": null, - "networks": { - "default": null - }, - "restart": "unless-stopped" - } -} \ No newline at end of file +dfnx: + build: + context: . + dockerfile: Dockerfile + command: null + deploy: + placement: {} + resources: + limits: + memory: "268435456" + entrypoint: null + networks: + default: null + restart: unless-stopped diff --git a/src/testdata/ambiguous-strings/compose.yaml.fixup b/src/testdata/ambiguous-strings/compose.yaml.fixup index c8ec19a83..04d26a36e 100644 --- a/src/testdata/ambiguous-strings/compose.yaml.fixup +++ b/src/testdata/ambiguous-strings/compose.yaml.fixup @@ -1,44 +1,32 @@ -{ - "a": { - "build": { - "context": ".", - "dockerfile": "*Railpack", - "args": { - "GITSHA": "65e1234", - "INT": "1234", - "VERSION": "65e1234" - } - }, - "command": null, - "entrypoint": null, - "environment": { - "GITSHA": "65e1234", - "INT": "1234", - "VERSION": "65e1234" - }, - "networks": { - "default": null - } - }, - "b": { - "build": { - "context": ".", - "dockerfile": "*Railpack", - "args": { - "GITSHA": "65e1234", - "INT": "1234", - "VERSION": "65e1234" - } - }, - "command": null, - "entrypoint": null, - "environment": { - "GITSHA": "65e1234", - "INT": "1234", - "VERSION": "65e1234" - }, - "networks": { - "default": null - } - } -} \ No newline at end of file +a: + build: + args: + GITSHA: 65e1234 + INT: "1234" + VERSION: 65e1234 + context: . + dockerfile: '*Railpack' + command: null + entrypoint: null + environment: + GITSHA: 65e1234 + INT: "1234" + VERSION: 65e1234 + networks: + default: null +b: + build: + args: + GITSHA: 65e1234 + INT: "1234" + VERSION: 65e1234 + context: . + dockerfile: '*Railpack' + command: null + entrypoint: null + environment: + GITSHA: 65e1234 + INT: "1234" + VERSION: 65e1234 + networks: + default: null diff --git a/src/testdata/base-image/compose.yaml.fixup b/src/testdata/base-image/compose.yaml.fixup index 7c57b51d7..1f17a9d21 100644 --- a/src/testdata/base-image/compose.yaml.fixup +++ b/src/testdata/base-image/compose.yaml.fixup @@ -1,35 +1,24 @@ -{ - "mutiple-images": { - "build": { - "context": "./multiple-images", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - }, - "no-dockerfile": { - "build": { - "context": ".", - "dockerfile": "*Railpack" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - }, - "one-image": { - "build": { - "context": "./one_image", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - } -} \ No newline at end of file +mutiple-images: + build: + context: ./multiple-images + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null +no-dockerfile: + build: + context: . + dockerfile: '*Railpack' + command: null + entrypoint: null + networks: + default: null +one-image: + build: + context: ./one_image + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null diff --git a/src/testdata/build-image/compose.yaml.fixup b/src/testdata/build-image/compose.yaml.fixup index 7a1dd6617..8a8d0cc8d 100644 --- a/src/testdata/build-image/compose.yaml.fixup +++ b/src/testdata/build-image/compose.yaml.fixup @@ -1,10 +1,6 @@ -{ - "app": { - "command": null, - "entrypoint": null, - "image": "myapp:latest", - "networks": { - "default": null - } - } -} \ No newline at end of file +app: + command: null + entrypoint: null + image: myapp:latest + networks: + default: null diff --git a/src/testdata/build/compose.yaml.fixup b/src/testdata/build/compose.yaml.fixup index 3aef658cc..aa22c98a6 100644 --- a/src/testdata/build/compose.yaml.fixup +++ b/src/testdata/build/compose.yaml.fixup @@ -1,45 +1,32 @@ -{ - "build1": { - "build": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "BASE_IMAGE": "nginx" - }, - "target": "test", - "shm_size": "2147483648" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - }, - "build2": { - "build": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "BASE_IMAGE": "alpine" - }, - "target": "test", - "shm_size": "2147483648" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - }, - "normalized": { - "build": { - "context": ".", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - } -} \ No newline at end of file +build1: + build: + args: + BASE_IMAGE: nginx + context: . + dockerfile: Dockerfile + shm_size: "2147483648" + target: test + command: null + entrypoint: null + networks: + default: null +build2: + build: + args: + BASE_IMAGE: alpine + context: . + dockerfile: Dockerfile + shm_size: "2147483648" + target: test + command: null + entrypoint: null + networks: + default: null +normalized: + build: + context: . + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null diff --git a/src/testdata/bun-in-compose/compose.yaml.fixup b/src/testdata/bun-in-compose/compose.yaml.fixup index ae038f586..08e710492 100644 --- a/src/testdata/bun-in-compose/compose.yaml.fixup +++ b/src/testdata/bun-in-compose/compose.yaml.fixup @@ -1,22 +1,15 @@ -{ - "bun": { - "build": { - "context": "./app", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - }, - "restart": "unless-stopped" - }, - "server": { - "command": null, - "entrypoint": null, - "image": "oven/bun:latest", - "networks": { - "default": null - } - } -} \ No newline at end of file +bun: + build: + context: ./app + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null + restart: unless-stopped +server: + command: null + entrypoint: null + image: oven/bun:latest + networks: + default: null diff --git a/src/testdata/bun-in-dockerfile/compose.yaml.fixup b/src/testdata/bun-in-dockerfile/compose.yaml.fixup index 44523e39e..19a2bc88b 100644 --- a/src/testdata/bun-in-dockerfile/compose.yaml.fixup +++ b/src/testdata/bun-in-dockerfile/compose.yaml.fixup @@ -1,22 +1,15 @@ -{ - "bun": { - "build": { - "context": "./app", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - }, - "restart": "unless-stopped" - }, - "server": { - "command": null, - "entrypoint": null, - "image": "alpine:latest", - "networks": { - "default": null - } - } -} \ No newline at end of file +bun: + build: + context: ./app + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null + restart: unless-stopped +server: + command: null + entrypoint: null + image: alpine:latest + networks: + default: null diff --git a/src/testdata/compose-go-warn/compose.yaml.fixup b/src/testdata/compose-go-warn/compose.yaml.fixup index 3e83740cf..7bbfc9866 100644 --- a/src/testdata/compose-go-warn/compose.yaml.fixup +++ b/src/testdata/compose-go-warn/compose.yaml.fixup @@ -1,18 +1,11 @@ -{ - "echo": { - "command": null, - "entrypoint": null, - "image": "ealen/echo-server", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 80, - "protocol": "tcp", - "app_protocol": "http" - } - ] - } -} \ No newline at end of file +echo: + command: null + entrypoint: null + image: ealen/echo-server + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 80 diff --git a/src/testdata/configdetection/compose.yaml.fixup b/src/testdata/configdetection/compose.yaml.fixup index cbb7598aa..c70a77e67 100644 --- a/src/testdata/configdetection/compose.yaml.fixup +++ b/src/testdata/configdetection/compose.yaml.fixup @@ -1,18 +1,13 @@ -{ - "configdetection": { - "command": null, - "entrypoint": null, - "environment": { - "API_KEY": "50m34p1k3y", - "AWS_CLIENT_ID": "AROA1234567890ABCDEF", - "GH_PAT": "ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890", - "HIGH_ENTROPY_STRING": "VEfk5vO0Q53VkK_uicor", - "MY_URL": "https://user:p455w0rd@example.com", - "NOT_SENSITIVE": "notsensitive" - }, - "image": "alpine", - "networks": { - "default": null - } - } -} \ No newline at end of file +configdetection: + command: null + entrypoint: null + environment: + API_KEY: 50m34p1k3y + AWS_CLIENT_ID: AROA1234567890ABCDEF + GH_PAT: ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890 + HIGH_ENTROPY_STRING: VEfk5vO0Q53VkK_uicor + MY_URL: https://user:p455w0rd@example.com + NOT_SENSITIVE: notsensitive + image: alpine + networks: + default: null diff --git a/src/testdata/configoverride/compose.yaml.fixup b/src/testdata/configoverride/compose.yaml.fixup index d0ff00364..fd73c4df6 100644 --- a/src/testdata/configoverride/compose.yaml.fixup +++ b/src/testdata/configoverride/compose.yaml.fixup @@ -1,13 +1,8 @@ -{ - "service1": { - "command": null, - "entrypoint": null, - "environment": { - "VAR1": null - }, - "image": "alpine", - "networks": { - "default": null - } - } -} \ No newline at end of file +service1: + command: null + entrypoint: null + environment: + VAR1: null + image: alpine + networks: + default: null diff --git a/src/testdata/debugproj/compose.yaml.fixup b/src/testdata/debugproj/compose.yaml.fixup index 1e8051211..c7657e503 100644 --- a/src/testdata/debugproj/compose.yaml.fixup +++ b/src/testdata/debugproj/compose.yaml.fixup @@ -1,24 +1,16 @@ -{ - "failing": { - "build": { - "context": "./app", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - }, - "ok": { - "build": { - "context": ".", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - } -} \ No newline at end of file +failing: + build: + context: ./app + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null +ok: + build: + context: . + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null diff --git a/src/testdata/dependson/compose.yaml.fixup b/src/testdata/dependson/compose.yaml.fixup index ec9d9b4d0..ff5357c9c 100644 --- a/src/testdata/dependson/compose.yaml.fixup +++ b/src/testdata/dependson/compose.yaml.fixup @@ -1,48 +1,33 @@ -{ - "service1": { - "command": null, - "depends_on": { - "service2": { - "condition": "service_started", - "required": true - }, - "service3": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "image": "alpine", - "networks": { - "default": null - } - }, - "service2": { - "command": null, - "depends_on": { - "service3": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "image": "alpine", - "networks": { - "default": null - } - }, - "service3": { - "command": null, - "depends_on": { - "service3": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "image": "alpine", - "networks": { - "default": null - } - } -} \ No newline at end of file +service1: + command: null + depends_on: + service2: + condition: service_started + required: true + service3: + condition: service_started + required: true + entrypoint: null + image: alpine + networks: + default: null +service2: + command: null + depends_on: + service3: + condition: service_started + required: true + entrypoint: null + image: alpine + networks: + default: null +service3: + command: null + depends_on: + service3: + condition: service_started + required: true + entrypoint: null + image: alpine + networks: + default: null diff --git a/src/testdata/dockerfile-validation-errors/compose.yaml.fixup b/src/testdata/dockerfile-validation-errors/compose.yaml.fixup index bec623d3f..51b929051 100644 --- a/src/testdata/dockerfile-validation-errors/compose.yaml.fixup +++ b/src/testdata/dockerfile-validation-errors/compose.yaml.fixup @@ -1,21 +1,13 @@ -{ - "invalid-dockerfile": { - "build": { - "context": ".", - "dockerfile": "Dockerfile.invalid" - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 8080, - "protocol": "tcp", - "app_protocol": "http" - } - ] - } -} \ No newline at end of file +invalid-dockerfile: + build: + context: . + dockerfile: Dockerfile.invalid + command: null + entrypoint: null + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 8080 diff --git a/src/testdata/empty/compose.yaml.fixup b/src/testdata/empty/compose.yaml.fixup index 9e26dfeeb..0967ef424 100644 --- a/src/testdata/empty/compose.yaml.fixup +++ b/src/testdata/empty/compose.yaml.fixup @@ -1 +1 @@ -{} \ No newline at end of file +{} diff --git a/src/testdata/emptyenv/compose.yaml.fixup b/src/testdata/emptyenv/compose.yaml.fixup index 1b4bf9201..76f86b83f 100644 --- a/src/testdata/emptyenv/compose.yaml.fixup +++ b/src/testdata/emptyenv/compose.yaml.fixup @@ -1,20 +1,13 @@ -{ - "emptyenv": { - "build": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "ARG2": "" - } - }, - "command": null, - "entrypoint": null, - "environment": { - "ENV1": null, - "ENV2": "" - }, - "networks": { - "default": null - } - } -} \ No newline at end of file +emptyenv: + build: + args: + ARG2: "" + context: . + dockerfile: Dockerfile + command: null + entrypoint: null + environment: + ENV1: null + ENV2: "" + networks: + default: null diff --git a/src/testdata/extends/compose.yaml.fixup b/src/testdata/extends/compose.yaml.fixup index 463e5b1c1..817ec7779 100644 --- a/src/testdata/extends/compose.yaml.fixup +++ b/src/testdata/extends/compose.yaml.fixup @@ -1,109 +1,84 @@ -{ - "array-override": { - "command": null, - "entrypoint": null, - "environment": { - "EMPTY_VALUE": "bar", - "NEW_VALUE": "bar", - "NO_VALUE": "bar", - "WITH_VALUE": "bar" - }, - "image": "bogus", - "networks": { - "default": null - } - }, - "array-reset": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - } - }, - "array-set": { - "command": null, - "entrypoint": null, - "environment": { - "BASE_ONLY": "foo", - "EMPTY_VALUE": "bar", - "NEW_VALUE": "bar", - "NO_VALUE": "bar", - "WITH_VALUE": "bar" - }, - "image": "bogus", - "networks": { - "default": null - } - }, - "array-unset": { - "command": null, - "entrypoint": null, - "environment": { - "BASE_ONLY": "foo", - "EMPTY_VALUE": null, - "NEW_VALUE": null, - "NO_VALUE": null, - "WITH_VALUE": null - }, - "image": "bogus", - "networks": { - "default": null - } - }, - "map-override": { - "command": null, - "entrypoint": null, - "environment": { - "EMPTY_VALUE": "bar", - "NEW_VALUE": "bar", - "NO_VALUE": "bar", - "WITH_VALUE": "bar" - }, - "image": "bogus", - "networks": { - "default": null - } - }, - "map-reset": { - "command": null, - "entrypoint": null, - "environment": { - "BASE_ONLY": "foo" - }, - "image": "bogus", - "networks": { - "default": null - } - }, - "map-set": { - "command": null, - "entrypoint": null, - "environment": { - "BASE_ONLY": "foo", - "EMPTY_VALUE": "bar", - "NEW_VALUE": "bar", - "NO_VALUE": "bar", - "WITH_VALUE": "bar" - }, - "image": "bogus", - "networks": { - "default": null - } - }, - "map-unset": { - "command": null, - "entrypoint": null, - "environment": { - "BASE_ONLY": "foo", - "EMPTY_VALUE": null, - "NEW_VALUE": null, - "NO_VALUE": null, - "WITH_VALUE": null - }, - "image": "bogus", - "networks": { - "default": null - } - } -} \ No newline at end of file +array-override: + command: null + entrypoint: null + environment: + EMPTY_VALUE: bar + NEW_VALUE: bar + NO_VALUE: bar + WITH_VALUE: bar + image: bogus + networks: + default: null +array-reset: + command: null + entrypoint: null + image: bogus + networks: + default: null +array-set: + command: null + entrypoint: null + environment: + BASE_ONLY: foo + EMPTY_VALUE: bar + NEW_VALUE: bar + NO_VALUE: bar + WITH_VALUE: bar + image: bogus + networks: + default: null +array-unset: + command: null + entrypoint: null + environment: + BASE_ONLY: foo + EMPTY_VALUE: null + NEW_VALUE: null + NO_VALUE: null + WITH_VALUE: null + image: bogus + networks: + default: null +map-override: + command: null + entrypoint: null + environment: + EMPTY_VALUE: bar + NEW_VALUE: bar + NO_VALUE: bar + WITH_VALUE: bar + image: bogus + networks: + default: null +map-reset: + command: null + entrypoint: null + environment: + BASE_ONLY: foo + image: bogus + networks: + default: null +map-set: + command: null + entrypoint: null + environment: + BASE_ONLY: foo + EMPTY_VALUE: bar + NEW_VALUE: bar + NO_VALUE: bar + WITH_VALUE: bar + image: bogus + networks: + default: null +map-unset: + command: null + entrypoint: null + environment: + BASE_ONLY: foo + EMPTY_VALUE: null + NEW_VALUE: null + NO_VALUE: null + WITH_VALUE: null + image: bogus + networks: + default: null diff --git a/src/testdata/fixupenv/compose.yaml.fixup b/src/testdata/fixupenv/compose.yaml.fixup index f5de386c1..672738e55 100644 --- a/src/testdata/fixupenv/compose.yaml.fixup +++ b/src/testdata/fixupenv/compose.yaml.fixup @@ -1,103 +1,71 @@ -{ - "Mistral": { - "command": null, - "entrypoint": null, - "image": "mistral:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 8000, - "protocol": "tcp" - } - ] - }, - "fixup-args": { - "build": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "API_URL": "http://mock-mistral:8000" - } - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - }, - "ingress-service": { - "command": null, - "entrypoint": null, - "image": "somedb:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 5432, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "refer-self-build-arg": { - "build": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "CONFIG4": "refer-self-env.fixupenv.tenant2.defang.app" - } - }, - "command": null, - "entrypoint": null, - "networks": { - "default": null - } - }, - "refer-self-env": { - "command": null, - "entrypoint": null, - "environment": { - "CONFIG3": "refer-self-env.fixupenv.tenant2.defang.app" - }, - "image": "service:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 5678, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "ui": { - "command": null, - "entrypoint": null, - "environment": { - "API_URL": "http://mock-mistral:8000", - "SENSITIVE_DATA": null - }, - "image": "ui:latest", - "networks": { - "default": null - } - }, - "use-ingress-service": { - "command": null, - "entrypoint": null, - "environment": { - "UI_URL": "ingress-service.fixupenv.tenant2.defang.app:5432" - }, - "image": "service:latest", - "networks": { - "default": null - } - } -} \ No newline at end of file +Mistral: + command: null + entrypoint: null + image: mistral:latest + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 8000 +fixup-args: + build: + args: + API_URL: http://mock-mistral:8000 + context: . + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null +ingress-service: + command: null + entrypoint: null + image: somedb:latest + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 5432 +refer-self-build-arg: + build: + args: + CONFIG4: refer-self-env.fixupenv.tenant2.defang.app + context: . + dockerfile: Dockerfile + command: null + entrypoint: null + networks: + default: null +refer-self-env: + command: null + entrypoint: null + environment: + CONFIG3: refer-self-env.fixupenv.tenant2.defang.app + image: service:latest + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 5678 +ui: + command: null + entrypoint: null + environment: + API_URL: http://mock-mistral:8000 + SENSITIVE_DATA: null + image: ui:latest + networks: + default: null +use-ingress-service: + command: null + entrypoint: null + environment: + UI_URL: ingress-service.fixupenv.tenant2.defang.app:5432 + image: service:latest + networks: + default: null diff --git a/src/testdata/gpu/compose.yaml.fixup b/src/testdata/gpu/compose.yaml.fixup index e4cdfb7ec..be0071558 100644 --- a/src/testdata/gpu/compose.yaml.fixup +++ b/src/testdata/gpu/compose.yaml.fixup @@ -1,25 +1,14 @@ -{ - "mistral": { - "command": null, - "deploy": { - "replicas": 1, - "resources": { - "reservations": { - "devices": [ - { - "capabilities": [ - "gpu" - ], - "count": -1 - } - ] - } - }, - "placement": {} - }, - "entrypoint": null, - "networks": { - "default": null - } - } -} \ No newline at end of file +mistral: + command: null + deploy: + placement: {} + replicas: 1 + resources: + reservations: + devices: + - capabilities: + - gpu + count: -1 + entrypoint: null + networks: + default: null diff --git a/src/testdata/healthcheck/compose.yaml.fixup b/src/testdata/healthcheck/compose.yaml.fixup index 42dfd5737..57ddb8bb2 100644 --- a/src/testdata/healthcheck/compose.yaml.fixup +++ b/src/testdata/healthcheck/compose.yaml.fixup @@ -1,150 +1,106 @@ -{ - "cmd-shell": { - "command": null, - "entrypoint": null, - "healthcheck": { - "test": [ - "CMD-SHELL", - "echo hello", - "second line" - ] - }, - "image": "alpine", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 5000, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "curl": { - "command": null, - "entrypoint": null, - "healthcheck": { - "test": [ - "CMD", - "curl", - "-f", - "localhost" - ] - }, - "image": "curl", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 80, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "flask1": { - "command": null, - "entrypoint": null, - "healthcheck": { - "test": [ - "CMD", - "python", - "-c", - "import sys, urllib.request;urllib.request.urlopen(sys.argv[1]).read()", - "http://localhost/" - ], - "timeout": "1s" - }, - "image": "flask", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 5000, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "flask2": { - "command": null, - "entrypoint": null, - "healthcheck": { - "test": [ - "CMD", - "python", - "-c", - "import urllib.request;urllib.request.urlopen('http://127.0.0.1/path').read()" - ], - "interval": "10s" - }, - "image": "flask", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 5000, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "none": { - "command": null, - "entrypoint": null, - "healthcheck": { - "test": [ - "NONE", - "ignored" - ], - "timeout": "1s", - "interval": "1m0s", - "retries": 3 - }, - "image": "alpine", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 5000, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "wget": { - "command": null, - "entrypoint": null, - "healthcheck": { - "test": [ - "CMD", - "wget", - "-q", - "--spider", - "localhost:80" - ] - }, - "image": "alpine", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 80, - "protocol": "tcp", - "app_protocol": "http" - } - ] - } -} \ No newline at end of file +cmd-shell: + command: null + entrypoint: null + healthcheck: + test: + - CMD-SHELL + - echo hello + - second line + image: alpine + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 5000 +curl: + command: null + entrypoint: null + healthcheck: + test: + - CMD + - curl + - -f + - localhost + image: curl + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 80 +flask1: + command: null + entrypoint: null + healthcheck: + test: + - CMD + - python + - -c + - import sys, urllib.request;urllib.request.urlopen(sys.argv[1]).read() + - http://localhost/ + timeout: 1s + image: flask + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 5000 +flask2: + command: null + entrypoint: null + healthcheck: + interval: 10s + test: + - CMD + - python + - -c + - import urllib.request;urllib.request.urlopen('http://127.0.0.1/path').read() + image: flask + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 5000 +none: + command: null + entrypoint: null + healthcheck: + interval: 1m0s + retries: 3 + test: + - NONE + - ignored + timeout: 1s + image: alpine + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 5000 +wget: + command: null + entrypoint: null + healthcheck: + test: + - CMD + - wget + - -q + - --spider + - localhost:80 + image: alpine + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 80 diff --git a/src/testdata/heroku/compose.yaml.fixup b/src/testdata/heroku/compose.yaml.fixup index 14425bd1e..6c8ffe030 100644 --- a/src/testdata/heroku/compose.yaml.fixup +++ b/src/testdata/heroku/compose.yaml.fixup @@ -1,57 +1,38 @@ -{ - "app": { - "build": { - "context": ".", - "dockerfile": "*Railpack" - }, - "command": null, - "depends_on": { - "postgres": { - "condition": "service_started", - "required": true - }, - "redis": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "environment": { - "DATABASE_URL": "postgres://postgres:postgres@mock-postgres:5432/app", - "REDIS_URL": "redis://mock-redis:5739" - }, - "networks": { - "default": null - } - }, - "postgres": { - "command": null, - "entrypoint": null, - "image": "postgres:15-alpine", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 5432, - "protocol": "tcp" - } - ] - }, - "redis": { - "command": null, - "entrypoint": null, - "image": "redis:7-alpine", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "protocol": "tcp" - } - ] - } -} \ No newline at end of file +app: + build: + context: . + dockerfile: '*Railpack' + command: null + depends_on: + postgres: + condition: service_started + required: true + redis: + condition: service_started + required: true + entrypoint: null + environment: + DATABASE_URL: postgres://postgres:postgres@mock-postgres:5432/app + REDIS_URL: redis://mock-redis:5739 + networks: + default: null +postgres: + command: null + entrypoint: null + image: postgres:15-alpine + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 5432 +redis: + command: null + entrypoint: null + image: redis:7-alpine + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6379 diff --git a/src/testdata/interpolate/compose.yaml.fixup b/src/testdata/interpolate/compose.yaml.fixup index 6af7c87b0..9865e4822 100644 --- a/src/testdata/interpolate/compose.yaml.fixup +++ b/src/testdata/interpolate/compose.yaml.fixup @@ -1,21 +1,16 @@ -{ - "interpolate": { - "command": null, - "entrypoint": null, - "environment": { - "BRACED": "interpolate", - "DB": "postgres://user:${POSTGRES_PASSWORD}@db:5432/db", - "NAME": "interpolate", - "NODE_ENV": "${NODE_ENV}", - "NOP": "abc$def", - "NOP_BRACED": "abc${def}", - "PORT": "8080", - "VAR1": "${VAR1}", - "interpolate": "value" - }, - "image": "alpine", - "networks": { - "default": null - } - } -} \ No newline at end of file +interpolate: + command: null + entrypoint: null + environment: + BRACED: interpolate + DB: postgres://user:${POSTGRES_PASSWORD}@db:5432/db + NAME: interpolate + NODE_ENV: ${NODE_ENV} + NOP: abc$def + NOP_BRACED: abc${def} + PORT: "8080" + VAR1: ${VAR1} + interpolate: value + image: alpine + networks: + default: null diff --git a/src/testdata/llm/compose.yaml.fixup b/src/testdata/llm/compose.yaml.fixup index 0978b0653..b4eb13b1e 100644 --- a/src/testdata/llm/compose.yaml.fixup +++ b/src/testdata/llm/compose.yaml.fixup @@ -1,57 +1,38 @@ -{ - "alt-repo": { - "command": null, - "entrypoint": null, - "image": "altrepo.com/litellm:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 4000, - "protocol": "tcp" - } - ] - }, - "gateway-with-ports": { - "command": null, - "entrypoint": null, - "image": "litellm/litellm:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 5678, - "published": "5678", - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "gateway-without-ports": { - "command": null, - "entrypoint": null, - "image": "litellm/litellm:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 4000, - "protocol": "tcp" - } - ] - }, - "llm": { - "command": null, - "entrypoint": null, - "image": "llm:latest", - "networks": { - "default": null - } - } -} \ No newline at end of file +alt-repo: + command: null + entrypoint: null + image: altrepo.com/litellm:latest + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 4000 +gateway-with-ports: + command: null + entrypoint: null + image: litellm/litellm:latest + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + published: "5678" + target: 5678 +gateway-without-ports: + command: null + entrypoint: null + image: litellm/litellm:latest + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 4000 +llm: + command: null + entrypoint: null + image: llm:latest + networks: + default: null diff --git a/src/testdata/longname/compose.yaml.fixup b/src/testdata/longname/compose.yaml.fixup index 563ba7cee..f5340057c 100644 --- a/src/testdata/longname/compose.yaml.fixup +++ b/src/testdata/longname/compose.yaml.fixup @@ -1,10 +1,6 @@ -{ - "aVeryLongServiceNameThatIsDefinitelyTooLongThatWillCauseAnError": { - "command": null, - "entrypoint": null, - "image": "alpine", - "networks": { - "default": null - } - } -} \ No newline at end of file +aVeryLongServiceNameThatIsDefinitelyTooLongThatWillCauseAnError: + command: null + entrypoint: null + image: alpine + networks: + default: null diff --git a/src/testdata/models/compose.yaml.fixup b/src/testdata/models/compose.yaml.fixup index 3a33dd7a9..7886d7968 100644 --- a/src/testdata/models/compose.yaml.fixup +++ b/src/testdata/models/compose.yaml.fixup @@ -1,142 +1,100 @@ -{ - "ai_model": { - "command": [ - "--drop_params", - "--model", - "ai/model", - "--alias", - "ai/model" - ], - "entrypoint": null, - "environment": { - "LITELLM_MASTER_KEY": "networkisalreadyprivate" - }, - "image": "litellm/litellm:v1.82.3-stable.patch.3", - "networks": { - "model_provider_private": null - }, - "ports": [ - { - "mode": "host", - "target": 4000, - "protocol": "tcp" - } - ] - }, - "modellist": { - "command": null, - "depends_on": { - "ai_model": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "environment": { - "AI_MODEL_MODEL": "ai/model", - "AI_MODEL_URL": "http://mock-ai-model:4000/v1/" - }, - "image": "app", - "models": { - "ai_model": null - }, - "networks": { - "default": null, - "model_provider_private": null - } - }, - "modelmap": { - "command": null, - "depends_on": { - "ai_model": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "environment": { - "AI_MODEL_MODEL": "ai/model", - "AI_MODEL_URL": "http://mock-ai-model:4000/v1/" - }, - "image": "app", - "models": { - "ai_model": null - }, - "networks": { - "default": null, - "model_provider_private": null - } - }, - "my_model": { - "command": [ - "--drop_params", - "--model", - "ai/model", - "--alias", - "ai/model" - ], - "entrypoint": null, - "environment": { - "LITELLM_MASTER_KEY": "networkisalreadyprivate" - }, - "image": "litellm/litellm:v1.82.3-stable.patch.3", - "networks": { - "model_provider_private": null - }, - "ports": [ - { - "mode": "host", - "target": 4000, - "protocol": "tcp" - } - ] - }, - "withendpoint": { - "command": null, - "depends_on": { - "my_model": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "environment": { - "MODEL_URL": "http://mock-my-model:4000/v1/", - "MY_MODEL_MODEL": "ai/model" - }, - "image": "app", - "models": { - "my_model": { - "endpoint_var": "MODEL_URL" - } - }, - "networks": { - "default": null, - "model_provider_private": null - } - }, - "withmodelvar": { - "command": null, - "depends_on": { - "ai_model": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "environment": { - "AI_MODEL_URL": "http://mock-ai-model:4000/v1/", - "MY_MODEL_NAME": "ai/model" - }, - "image": "app", - "models": { - "ai_model": { - "model_var": "MY_MODEL_NAME" - } - }, - "networks": { - "default": null, - "model_provider_private": null - } - } -} \ No newline at end of file +ai_model: + command: + - --drop_params + - --model + - ai/model + - --alias + - ai/model + entrypoint: null + environment: + LITELLM_MASTER_KEY: networkisalreadyprivate + image: litellm/litellm:v1.82.3-stable.patch.3 + networks: + model_provider_private: null + ports: + - mode: host + protocol: tcp + target: 4000 +modellist: + command: null + depends_on: + ai_model: + condition: service_started + required: true + entrypoint: null + environment: + AI_MODEL_MODEL: ai/model + AI_MODEL_URL: http://mock-ai-model:4000/v1/ + image: app + models: + ai_model: null + networks: + default: null + model_provider_private: null +modelmap: + command: null + depends_on: + ai_model: + condition: service_started + required: true + entrypoint: null + environment: + AI_MODEL_MODEL: ai/model + AI_MODEL_URL: http://mock-ai-model:4000/v1/ + image: app + models: + ai_model: null + networks: + default: null + model_provider_private: null +my_model: + command: + - --drop_params + - --model + - ai/model + - --alias + - ai/model + entrypoint: null + environment: + LITELLM_MASTER_KEY: networkisalreadyprivate + image: litellm/litellm:v1.82.3-stable.patch.3 + networks: + model_provider_private: null + ports: + - mode: host + protocol: tcp + target: 4000 +withendpoint: + command: null + depends_on: + my_model: + condition: service_started + required: true + entrypoint: null + environment: + MODEL_URL: http://mock-my-model:4000/v1/ + MY_MODEL_MODEL: ai/model + image: app + models: + my_model: + endpoint_var: MODEL_URL + networks: + default: null + model_provider_private: null +withmodelvar: + command: null + depends_on: + ai_model: + condition: service_started + required: true + entrypoint: null + environment: + AI_MODEL_URL: http://mock-ai-model:4000/v1/ + MY_MODEL_NAME: ai/model + image: app + models: + ai_model: + model_var: MY_MODEL_NAME + networks: + default: null + model_provider_private: null diff --git a/src/testdata/mongo/compose.yaml.fixup b/src/testdata/mongo/compose.yaml.fixup index 2467e6614..dc61b5f59 100644 --- a/src/testdata/mongo/compose.yaml.fixup +++ b/src/testdata/mongo/compose.yaml.fixup @@ -1,250 +1,171 @@ -{ - "mongo": { - "command": null, - "entrypoint": null, - "environment": { - "MONGO_INITDB_ROOT_PASSWORD": "example!", - "MONGO_INITDB_ROOT_USERNAME": "root" - }, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 27017, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-express": { - "command": null, - "depends_on": { - "mongo": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "environment": { - "ME_CONFIG_BASICAUTH": "false", - "ME_CONFIG_MONGODB_ADMINPASSWORD": "example!", - "ME_CONFIG_MONGODB_ADMINUSERNAME": "root", - "ME_CONFIG_MONGODB_URL": "mongodb://root:example!@mock-mongo:27017/" - }, - "image": "mongo-express", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 8081, - "published": "8081", - "protocol": "tcp", - "app_protocol": "http" - } - ], - "restart": "always" - }, - "mongo-port1234": { - "command": [ - "--port", - "1234" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 1234, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-port1235": { - "command": [ - "--port=1235" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 1235, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-port1236": { - "command": [ - "--port", - "1236", - "--shardsvr" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 1236, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-port1237": { - "command": [ - "--port=1237", - "--configsvr" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 1237, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-port1238": { - "command": [ - "--shardsvr", - "--port", - "1238" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 1238, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-port1239": { - "command": [ - "--configsvr", - "--port=1239" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 1239, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-port27018": { - "command": [ - "--shardsvr" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 27018, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-port27019": { - "command": [ - "--configsvr" - ], - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 27019, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-unmanaged": { - "command": null, - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 27017, - "protocol": "tcp" - } - ], - "restart": "always" - }, - "mongo-wrong-image": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 27017, - "protocol": "tcp" - } - ] - }, - "short-ports": { - "command": null, - "entrypoint": null, - "image": "mongo", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 27017, - "published": "27017", - "protocol": "tcp" - } - ] - } -} \ No newline at end of file +mongo: + command: null + entrypoint: null + environment: + MONGO_INITDB_ROOT_PASSWORD: example! + MONGO_INITDB_ROOT_USERNAME: root + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 27017 + restart: always +mongo-express: + command: null + depends_on: + mongo: + condition: service_started + required: true + entrypoint: null + environment: + ME_CONFIG_BASICAUTH: "false" + ME_CONFIG_MONGODB_ADMINPASSWORD: example! + ME_CONFIG_MONGODB_ADMINUSERNAME: root + ME_CONFIG_MONGODB_URL: mongodb://root:example!@mock-mongo:27017/ + image: mongo-express + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + published: "8081" + target: 8081 + restart: always +mongo-port1234: + command: + - --port + - "1234" + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 1234 + restart: always +mongo-port1235: + command: + - --port=1235 + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 1235 + restart: always +mongo-port1236: + command: + - --port + - "1236" + - --shardsvr + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 1236 + restart: always +mongo-port1237: + command: + - --port=1237 + - --configsvr + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 1237 + restart: always +mongo-port1238: + command: + - --shardsvr + - --port + - "1238" + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 1238 + restart: always +mongo-port1239: + command: + - --configsvr + - --port=1239 + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 1239 + restart: always +mongo-port27018: + command: + - --shardsvr + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 27018 + restart: always +mongo-port27019: + command: + - --configsvr + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 27019 + restart: always +mongo-unmanaged: + command: null + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 27017 + restart: always +mongo-wrong-image: + command: null + entrypoint: null + image: example + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 27017 +short-ports: + command: null + entrypoint: null + image: mongo + networks: + default: null + ports: + - mode: host + protocol: tcp + published: "27017" + target: 27017 diff --git a/src/testdata/networks/compose.yaml.fixup b/src/testdata/networks/compose.yaml.fixup index f36fb501c..ab3831089 100644 --- a/src/testdata/networks/compose.yaml.fixup +++ b/src/testdata/networks/compose.yaml.fixup @@ -1,59 +1,43 @@ -{ - "service-default": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "default": null - } - }, - "service-internal": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "internal": null - } - }, - "service-invalid": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "invalid-network-name": {} - } - }, - "service-multi": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "default": null, - "internal": null - } - }, - "service-private": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "private": null - } - }, - "service-public": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "public": {} - } - }, - "service-public-list": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "public": null - } - } -} \ No newline at end of file +service-default: + command: null + entrypoint: null + image: example + networks: + default: null +service-internal: + command: null + entrypoint: null + image: example + networks: + internal: null +service-invalid: + command: null + entrypoint: null + image: example + networks: + invalid-network-name: {} +service-multi: + command: null + entrypoint: null + image: example + networks: + default: null + internal: null +service-private: + command: null + entrypoint: null + image: example + networks: + private: null +service-public: + command: null + entrypoint: null + image: example + networks: + public: {} +service-public-list: + command: null + entrypoint: null + image: example + networks: + public: null diff --git a/src/testdata/noprojname/compose.yaml.fixup b/src/testdata/noprojname/compose.yaml.fixup index 9e26dfeeb..0967ef424 100644 --- a/src/testdata/noprojname/compose.yaml.fixup +++ b/src/testdata/noprojname/compose.yaml.fixup @@ -1 +1 @@ -{} \ No newline at end of file +{} diff --git a/src/testdata/platforms/compose.yaml.fixup b/src/testdata/platforms/compose.yaml.fixup index ce89c569c..d73702216 100644 --- a/src/testdata/platforms/compose.yaml.fixup +++ b/src/testdata/platforms/compose.yaml.fixup @@ -1,11 +1,7 @@ -{ - "intel2": { - "command": null, - "entrypoint": null, - "image": "busybox", - "networks": { - "default": null - }, - "platform": "LINUX/X86_64" - } -} \ No newline at end of file +intel2: + command: null + entrypoint: null + image: busybox + networks: + default: null + platform: LINUX/X86_64 diff --git a/src/testdata/ports/compose.yaml.fixup b/src/testdata/ports/compose.yaml.fixup index 6a887a2b1..67c2cccf5 100644 --- a/src/testdata/ports/compose.yaml.fixup +++ b/src/testdata/ports/compose.yaml.fixup @@ -1,115 +1,78 @@ -{ - "grpc": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 9000, - "protocol": "tcp", - "app_protocol": "grpc" - } - ] - }, - "long": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 82, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "long-published": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 83, - "published": "8083", - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "short": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 80, - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "short-published": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 81, - "published": "8081", - "protocol": "tcp", - "app_protocol": "http" - } - ] - }, - "short-udp": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 84, - "protocol": "udp" - } - ] - }, - "short-udp-published": { - "command": null, - "entrypoint": null, - "image": "bogus", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 85, - "published": "8085", - "protocol": "udp" - } - ] - } -} \ No newline at end of file +grpc: + command: null + entrypoint: null + image: bogus + networks: + default: null + ports: + - app_protocol: grpc + mode: ingress + protocol: tcp + target: 9000 +long: + command: null + entrypoint: null + image: bogus + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 82 +long-published: + command: null + entrypoint: null + image: bogus + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + published: "8083" + target: 83 +short: + command: null + entrypoint: null + image: bogus + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 80 +short-published: + command: null + entrypoint: null + image: bogus + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + published: "8081" + target: 81 +short-udp: + command: null + entrypoint: null + image: bogus + networks: + default: null + ports: + - mode: host + protocol: udp + target: 84 +short-udp-published: + command: null + entrypoint: null + image: bogus + networks: + default: null + ports: + - mode: host + protocol: udp + published: "8085" + target: 85 diff --git a/src/testdata/postgres/compose.yaml.fixup b/src/testdata/postgres/compose.yaml.fixup index 1bd536444..c6af18ba2 100644 --- a/src/testdata/postgres/compose.yaml.fixup +++ b/src/testdata/postgres/compose.yaml.fixup @@ -1,96 +1,63 @@ -{ - "no-ext": { - "command": null, - "entrypoint": null, - "image": "postgres", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 5432, - "protocol": "tcp" - } - ] - }, - "no-ports": { - "command": null, - "entrypoint": null, - "image": "postgres", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 5432, - "protocol": "tcp" - } - ] - }, - "no-ports-override": { - "command": null, - "entrypoint": null, - "environment": { - "PGPORT": "5433" - }, - "image": "postgres", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 5433, - "protocol": "tcp" - } - ] - }, - "short-ports": { - "command": null, - "entrypoint": null, - "image": "postgres", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 5432, - "published": "5432", - "protocol": "tcp" - } - ] - }, - "with-ext": { - "command": null, - "entrypoint": null, - "image": "postgres", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 5432, - "protocol": "tcp" - } - ] - }, - "wrong-image": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 5432, - "protocol": "tcp" - } - ] - } -} \ No newline at end of file +no-ext: + command: null + entrypoint: null + image: postgres + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 5432 +no-ports: + command: null + entrypoint: null + image: postgres + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 5432 +no-ports-override: + command: null + entrypoint: null + environment: + PGPORT: "5433" + image: postgres + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 5433 +short-ports: + command: null + entrypoint: null + image: postgres + networks: + default: null + ports: + - mode: host + protocol: tcp + published: "5432" + target: 5432 +with-ext: + command: null + entrypoint: null + image: postgres + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 5432 +wrong-image: + command: null + entrypoint: null + image: example + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 5432 diff --git a/src/testdata/profiles/compose.yaml.fixup b/src/testdata/profiles/compose.yaml.fixup index bdae8fb87..d585ffdaa 100644 --- a/src/testdata/profiles/compose.yaml.fixup +++ b/src/testdata/profiles/compose.yaml.fixup @@ -1,21 +1,14 @@ -{ - "always": { - "command": null, - "entrypoint": null, - "image": "alpine", - "networks": { - "default": null - } - }, - "defangonly": { - "profiles": [ - "defang" - ], - "command": null, - "entrypoint": null, - "image": "alpine", - "networks": { - "default": null - } - } -} \ No newline at end of file +always: + command: null + entrypoint: null + image: alpine + networks: + default: null +defangonly: + command: null + entrypoint: null + image: alpine + networks: + default: null + profiles: + - defang diff --git a/src/testdata/provider/compose.yaml.fixup b/src/testdata/provider/compose.yaml.fixup index 63cdc7081..69a86041d 100644 --- a/src/testdata/provider/compose.yaml.fixup +++ b/src/testdata/provider/compose.yaml.fixup @@ -1,47 +1,33 @@ -{ - "ai_runner": { - "command": [ - "--drop_params", - "--model", - "ai/smollm2", - "--alias", - "ai/smollm2" - ], - "entrypoint": null, - "environment": { - "DEBUG": "true", - "LITELLM_MASTER_KEY": "networkisalreadyprivate" - }, - "image": "litellm/litellm:v1.82.3-stable.patch.3", - "networks": { - "model_provider_private": null - }, - "ports": [ - { - "mode": "host", - "target": 4000, - "protocol": "tcp" - } - ] - }, - "chat": { - "command": null, - "depends_on": { - "ai_runner": { - "condition": "service_started", - "required": true - } - }, - "entrypoint": null, - "environment": { - "AI_RUNNER_MODEL": "ai/smollm2", - "AI_RUNNER_URL": "http://mock-ai-runner:4000/v1/", - "OPENAI_API_KEY": "networkisalreadyprivate" - }, - "image": "my-chat-app", - "networks": { - "default": null, - "model_provider_private": null - } - } -} \ No newline at end of file +ai_runner: + command: + - --drop_params + - --model + - ai/smollm2 + - --alias + - ai/smollm2 + entrypoint: null + environment: + DEBUG: "true" + LITELLM_MASTER_KEY: networkisalreadyprivate + image: litellm/litellm:v1.82.3-stable.patch.3 + networks: + model_provider_private: null + ports: + - mode: host + protocol: tcp + target: 4000 +chat: + command: null + depends_on: + ai_runner: + condition: service_started + required: true + entrypoint: null + environment: + AI_RUNNER_MODEL: ai/smollm2 + AI_RUNNER_URL: http://mock-ai-runner:4000/v1/ + OPENAI_API_KEY: networkisalreadyprivate + image: my-chat-app + networks: + default: null + model_provider_private: null diff --git a/src/testdata/railpack/compose.yaml.fixup b/src/testdata/railpack/compose.yaml.fixup index 7a9061d98..ae4a0d8cc 100644 --- a/src/testdata/railpack/compose.yaml.fixup +++ b/src/testdata/railpack/compose.yaml.fixup @@ -1,41 +1,27 @@ -{ - "railpack-long": { - "build": { - "context": ".", - "dockerfile": "*Railpack" - }, - "command": [ - "exec node index.js" - ], - "entrypoint": null, - "networks": { - "default": null - } - }, - "railpack-short": { - "build": { - "context": ".", - "dockerfile": "*Railpack" - }, - "command": [ - "npm start" - ], - "entrypoint": null, - "networks": { - "default": null - } - }, - "railpackwithdockerfile": { - "build": { - "context": ".", - "dockerfile": "*Railpack" - }, - "command": [ - "something \"with space\" \"${PORT}\"" - ], - "entrypoint": null, - "networks": { - "default": null - } - } -} \ No newline at end of file +railpack-long: + build: + context: . + dockerfile: '*Railpack' + command: + - exec node index.js + entrypoint: null + networks: + default: null +railpack-short: + build: + context: . + dockerfile: '*Railpack' + command: + - npm start + entrypoint: null + networks: + default: null +railpackwithdockerfile: + build: + context: . + dockerfile: '*Railpack' + command: + - something "with space" "${PORT}" + entrypoint: null + networks: + default: null diff --git a/src/testdata/redis/compose.yaml.fixup b/src/testdata/redis/compose.yaml.fixup index 2978fb916..79ef2ac19 100644 --- a/src/testdata/redis/compose.yaml.fixup +++ b/src/testdata/redis/compose.yaml.fixup @@ -1,111 +1,73 @@ -{ - "no-ext": { - "command": null, - "entrypoint": null, - "image": "redis", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "protocol": "tcp" - } - ] - }, - "no-ports": { - "command": null, - "entrypoint": null, - "image": "redis", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "protocol": "tcp" - } - ] - }, - "no-ports-override": { - "command": [ - "--port", - "6380" - ], - "entrypoint": null, - "image": "redis", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6380, - "protocol": "tcp" - } - ] - }, - "short-ports": { - "command": null, - "entrypoint": null, - "image": "redis", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "published": "6379", - "protocol": "tcp" - } - ] - }, - "valkey-service": { - "command": null, - "entrypoint": null, - "image": "valkey/valkey:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "protocol": "tcp" - } - ] - }, - "with-ext": { - "command": null, - "entrypoint": null, - "image": "redis", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "protocol": "tcp" - } - ] - }, - "wrong-image": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "protocol": "tcp" - } - ] - } -} \ No newline at end of file +no-ext: + command: null + entrypoint: null + image: redis + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6379 +no-ports: + command: null + entrypoint: null + image: redis + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6379 +no-ports-override: + command: + - --port + - "6380" + entrypoint: null + image: redis + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6380 +short-ports: + command: null + entrypoint: null + image: redis + networks: + default: null + ports: + - mode: host + protocol: tcp + published: "6379" + target: 6379 +valkey-service: + command: null + entrypoint: null + image: valkey/valkey:latest + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6379 +with-ext: + command: null + entrypoint: null + image: redis + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6379 +wrong-image: + command: null + entrypoint: null + image: example + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6379 diff --git a/src/testdata/replicas/compose.yaml.fixup b/src/testdata/replicas/compose.yaml.fixup index 7c15a7d22..a8b7aa14f 100644 --- a/src/testdata/replicas/compose.yaml.fixup +++ b/src/testdata/replicas/compose.yaml.fixup @@ -1,63 +1,44 @@ -{ - "autoscaled": { - "command": null, - "entrypoint": null, - "image": "nginx:latest", - "networks": { - "default": null - } - }, - "default": { - "command": null, - "entrypoint": null, - "image": "nginx:latest", - "networks": { - "default": null - } - }, - "deploy": { - "command": null, - "deploy": { - "resources": { - "reservations": { - "cpus": 0.25, - "memory": "268435456" - } - }, - "placement": {} - }, - "entrypoint": null, - "image": "nginx:latest", - "networks": { - "default": null - } - }, - "managed": { - "command": null, - "entrypoint": null, - "image": "redis:latest", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "host", - "target": 6379, - "protocol": "tcp" - } - ] - }, - "replicated": { - "command": null, - "deploy": { - "replicas": 3, - "resources": {}, - "placement": {} - }, - "entrypoint": null, - "image": "nginx:latest", - "networks": { - "default": null - } - } -} \ No newline at end of file +autoscaled: + command: null + entrypoint: null + image: nginx:latest + networks: + default: null +default: + command: null + entrypoint: null + image: nginx:latest + networks: + default: null +deploy: + command: null + deploy: + placement: {} + resources: + reservations: + cpus: 0.25 + memory: "268435456" + entrypoint: null + image: nginx:latest + networks: + default: null +managed: + command: null + entrypoint: null + image: redis:latest + networks: + default: null + ports: + - mode: host + protocol: tcp + target: 6379 +replicated: + command: null + deploy: + placement: {} + replicas: 3 + resources: {} + entrypoint: null + image: nginx:latest + networks: + default: null diff --git a/src/testdata/sanity/compose.yaml.fixup b/src/testdata/sanity/compose.yaml.fixup index 1ea822bc9..7e707b730 100644 --- a/src/testdata/sanity/compose.yaml.fixup +++ b/src/testdata/sanity/compose.yaml.fixup @@ -1,30 +1,19 @@ -{ - "nginx": { - "command": null, - "deploy": { - "resources": { - "reservations": { - "memory": "268435456" - } - }, - "placement": {} - }, - "entrypoint": null, - "environment": { - "dummy": null - }, - "image": "nginx", - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 80, - "protocol": "tcp", - "app_protocol": "http" - } - ], - "restart": "unless-stopped" - } -} \ No newline at end of file +nginx: + command: null + deploy: + placement: {} + resources: + reservations: + memory: "268435456" + entrypoint: null + environment: + dummy: null + image: nginx + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 80 + restart: unless-stopped diff --git a/src/testdata/secretname/compose.yaml.fixup b/src/testdata/secretname/compose.yaml.fixup index b90e03701..350588072 100644 --- a/src/testdata/secretname/compose.yaml.fixup +++ b/src/testdata/secretname/compose.yaml.fixup @@ -1,17 +1,11 @@ -{ - "app": { - "build": { - "context": ".", - "dockerfile": "Dockerfile" - }, - "command": null, - "entrypoint": null, - "environment": { - "dummy": null - }, - "networks": { - "default": null - }, - "restart": "unless-stopped" - } -} \ No newline at end of file +app: + build: + context: . + dockerfile: Dockerfile + command: null + entrypoint: null + environment: + dummy: null + networks: + default: null + restart: unless-stopped diff --git a/src/testdata/static-files/compose.yaml.fixup b/src/testdata/static-files/compose.yaml.fixup index 7d2b7d783..fa13dc705 100644 --- a/src/testdata/static-files/compose.yaml.fixup +++ b/src/testdata/static-files/compose.yaml.fixup @@ -1,18 +1,12 @@ -{ - "x": { - "command": null, - "entrypoint": null, - "image": "blah", - "networks": { - "default": null - } - }, - "y": { - "command": null, - "entrypoint": null, - "image": "blah", - "networks": { - "default": null - } - } -} \ No newline at end of file +x: + command: null + entrypoint: null + image: blah + networks: + default: null +"y": + command: null + entrypoint: null + image: blah + networks: + default: null diff --git a/src/testdata/testproj/compose.yaml.fixup b/src/testdata/testproj/compose.yaml.fixup index b303012b1..0777cad91 100644 --- a/src/testdata/testproj/compose.yaml.fixup +++ b/src/testdata/testproj/compose.yaml.fixup @@ -1,64 +1,44 @@ -{ - "dfnx": { - "build": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "DNS": "mock-dfnx" - }, - "target": "testproj" - }, - "command": null, - "deploy": { - "resources": { - "limits": { - "cpus": 2, - "memory": "536870912" - }, - "reservations": { - "cpus": 0.25, - "memory": "268435456" - } - }, - "placement": {} - }, - "entrypoint": null, - "environment": { - "DOTENV": "enabled", - "DOT_ENV_INTERPOLATION": "enabled", - "FOO": "bar", - "dummy": null - }, - "healthcheck": { - "test": [ - "CMD", - "curl", - "-f", - "http://localhost/" - ] - }, - "networks": { - "default": null - }, - "ports": [ - { - "mode": "ingress", - "target": 80, - "protocol": "tcp", - "app_protocol": "http" - }, - { - "mode": "ingress", - "target": 1234, - "protocol": "tcp", - "app_protocol": "http" - }, - { - "mode": "host", - "target": 4567, - "protocol": "udp" - } - ], - "restart": "unless-stopped" - } -} \ No newline at end of file +dfnx: + build: + args: + DNS: mock-dfnx + context: . + dockerfile: Dockerfile + target: testproj + command: null + deploy: + placement: {} + resources: + limits: + cpus: 2 + memory: "536870912" + reservations: + cpus: 0.25 + memory: "268435456" + entrypoint: null + environment: + DOT_ENV_INTERPOLATION: enabled + DOTENV: enabled + FOO: bar + dummy: null + healthcheck: + test: + - CMD + - curl + - -f + - http://localhost/ + networks: + default: null + ports: + - app_protocol: http + mode: ingress + protocol: tcp + target: 80 + - app_protocol: http + mode: ingress + protocol: tcp + target: 1234 + - mode: host + protocol: udp + target: 4567 + restart: unless-stopped diff --git a/src/testdata/toomany/compose.yaml.fixup b/src/testdata/toomany/compose.yaml.fixup index 286e7f777..bde7b1623 100644 --- a/src/testdata/toomany/compose.yaml.fixup +++ b/src/testdata/toomany/compose.yaml.fixup @@ -1,10 +1,6 @@ -{ - "service1": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "default": null - } - } -} \ No newline at end of file +service1: + command: null + entrypoint: null + image: example + networks: + default: null diff --git a/src/testdata/toomany/docker-compose.yml.fixup b/src/testdata/toomany/docker-compose.yml.fixup index 286e7f777..bde7b1623 100644 --- a/src/testdata/toomany/docker-compose.yml.fixup +++ b/src/testdata/toomany/docker-compose.yml.fixup @@ -1,10 +1,6 @@ -{ - "service1": { - "command": null, - "entrypoint": null, - "image": "example", - "networks": { - "default": null - } - } -} \ No newline at end of file +service1: + command: null + entrypoint: null + image: example + networks: + default: null From bed85ed07d4af46d01c02f78fac5bc401516edf7 Mon Sep 17 00:00:00 2001 From: jordanstephens Date: Wed, 24 Jun 2026 11:41:55 -0700 Subject: [PATCH 3/3] convert compose.yaml.fixup snapshots from JSON to YAML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switches TestFixup from json.MarshalIndent to yaml.Marshal so that compose extensions (x-defang-llm, etc.) are included in snapshots — extensions have json:"-" in compose-go's types and were invisible to the JSON-based snapshots. Co-Authored-By: Claude Sonnet 4.6 --- src/go.mod | 2 +- src/pkg/cli/compose/fixup_test.go | 5 +- src/testdata/alttestproj/compose.yaml.fixup | 3 - .../ambiguous-strings/compose.yaml.fixup | 12 ++-- src/testdata/base-image/compose.yaml.fixup | 6 -- src/testdata/build-image/compose.yaml.fixup | 2 - src/testdata/build/compose.yaml.fixup | 18 ++---- .../bun-in-compose/compose.yaml.fixup | 4 -- .../bun-in-dockerfile/compose.yaml.fixup | 4 -- .../compose-go-warn/compose.yaml.fixup | 8 +-- .../configdetection/compose.yaml.fixup | 2 - .../configoverride/compose.yaml.fixup | 2 - src/testdata/debugproj/compose.yaml.fixup | 4 -- src/testdata/dependson/compose.yaml.fixup | 6 -- .../compose.yaml.fixup | 8 +-- src/testdata/emptyenv/compose.yaml.fixup | 6 +- src/testdata/extends/compose.yaml.fixup | 16 ----- src/testdata/fixupenv/compose.yaml.fixup | 36 ++++------- src/testdata/gpu/compose.yaml.fixup | 3 - src/testdata/healthcheck/compose.yaml.fixup | 54 +++++++--------- src/testdata/heroku/compose.yaml.fixup | 10 +-- src/testdata/interpolate/compose.yaml.fixup | 2 - src/testdata/llm/compose.yaml.fixup | 24 +++---- src/testdata/longname/compose.yaml.fixup | 2 - src/testdata/models/compose.yaml.fixup | 17 ++--- src/testdata/mongo/compose.yaml.fixup | 62 ++++++++----------- src/testdata/networks/compose.yaml.fixup | 14 ----- src/testdata/platforms/compose.yaml.fixup | 2 - src/testdata/ports/compose.yaml.fixup | 54 ++++++---------- src/testdata/postgres/compose.yaml.fixup | 32 ++++------ src/testdata/profiles/compose.yaml.fixup | 8 +-- src/testdata/provider/compose.yaml.fixup | 5 +- src/testdata/railpack/compose.yaml.fixup | 3 - src/testdata/redis/compose.yaml.fixup | 36 +++++------ src/testdata/replicas/compose.yaml.fixup | 17 +---- src/testdata/sanity/compose.yaml.fixup | 9 +-- src/testdata/secretname/compose.yaml.fixup | 2 - src/testdata/static-files/compose.yaml.fixup | 9 +-- src/testdata/testproj/compose.yaml.fixup | 19 +++--- src/testdata/toomany/compose.yaml.fixup | 2 - src/testdata/toomany/docker-compose.yml.fixup | 2 - 41 files changed, 167 insertions(+), 365 deletions(-) diff --git a/src/go.mod b/src/go.mod index 21267dbd8..299fcb8ff 100644 --- a/src/go.mod +++ b/src/go.mod @@ -87,6 +87,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 google.golang.org/grpc v1.79.3 google.golang.org/protobuf v1.36.11 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -161,7 +162,6 @@ require ( google.golang.org/genai v1.30.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect gopkg.in/ini.v1 v1.66.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( diff --git a/src/pkg/cli/compose/fixup_test.go b/src/pkg/cli/compose/fixup_test.go index 052a6a0b2..efcc392a6 100644 --- a/src/pkg/cli/compose/fixup_test.go +++ b/src/pkg/cli/compose/fixup_test.go @@ -1,7 +1,6 @@ package compose import ( - "encoding/json" "strings" "testing" @@ -10,6 +9,7 @@ import ( composeTypes "github.com/compose-spec/compose-go/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "gopkg.in/yaml.v3" ) func TestFixup(t *testing.T) { @@ -33,8 +33,7 @@ func TestFixup(t *testing.T) { services[svc.Name] = svc } - // Convert the protobuf services to pretty JSON for comparison (YAML would include all the zero values) - actual, err := json.MarshalIndent(services, "", " ") + actual, err := yaml.Marshal(services) if err != nil { t.Fatal(err) } diff --git a/src/testdata/alttestproj/compose.yaml.fixup b/src/testdata/alttestproj/compose.yaml.fixup index 3d10058f2..6610807c1 100644 --- a/src/testdata/alttestproj/compose.yaml.fixup +++ b/src/testdata/alttestproj/compose.yaml.fixup @@ -2,13 +2,10 @@ dfnx: build: context: . dockerfile: Dockerfile - command: null deploy: - placement: {} resources: limits: memory: "268435456" - entrypoint: null networks: default: null restart: unless-stopped diff --git a/src/testdata/ambiguous-strings/compose.yaml.fixup b/src/testdata/ambiguous-strings/compose.yaml.fixup index 04d26a36e..28d50e53e 100644 --- a/src/testdata/ambiguous-strings/compose.yaml.fixup +++ b/src/testdata/ambiguous-strings/compose.yaml.fixup @@ -1,13 +1,11 @@ a: build: + context: . + dockerfile: '*Railpack' args: GITSHA: 65e1234 INT: "1234" VERSION: 65e1234 - context: . - dockerfile: '*Railpack' - command: null - entrypoint: null environment: GITSHA: 65e1234 INT: "1234" @@ -16,14 +14,12 @@ a: default: null b: build: + context: . + dockerfile: '*Railpack' args: GITSHA: 65e1234 INT: "1234" VERSION: 65e1234 - context: . - dockerfile: '*Railpack' - command: null - entrypoint: null environment: GITSHA: 65e1234 INT: "1234" diff --git a/src/testdata/base-image/compose.yaml.fixup b/src/testdata/base-image/compose.yaml.fixup index 1f17a9d21..d5fd88676 100644 --- a/src/testdata/base-image/compose.yaml.fixup +++ b/src/testdata/base-image/compose.yaml.fixup @@ -2,23 +2,17 @@ mutiple-images: build: context: ./multiple-images dockerfile: Dockerfile - command: null - entrypoint: null networks: default: null no-dockerfile: build: context: . dockerfile: '*Railpack' - command: null - entrypoint: null networks: default: null one-image: build: context: ./one_image dockerfile: Dockerfile - command: null - entrypoint: null networks: default: null diff --git a/src/testdata/build-image/compose.yaml.fixup b/src/testdata/build-image/compose.yaml.fixup index 8a8d0cc8d..a99c75e34 100644 --- a/src/testdata/build-image/compose.yaml.fixup +++ b/src/testdata/build-image/compose.yaml.fixup @@ -1,6 +1,4 @@ app: - command: null - entrypoint: null image: myapp:latest networks: default: null diff --git a/src/testdata/build/compose.yaml.fixup b/src/testdata/build/compose.yaml.fixup index aa22c98a6..97b646688 100644 --- a/src/testdata/build/compose.yaml.fixup +++ b/src/testdata/build/compose.yaml.fixup @@ -1,32 +1,26 @@ build1: build: - args: - BASE_IMAGE: nginx context: . dockerfile: Dockerfile - shm_size: "2147483648" + args: + BASE_IMAGE: nginx target: test - command: null - entrypoint: null + shm_size: "2147483648" networks: default: null build2: build: - args: - BASE_IMAGE: alpine context: . dockerfile: Dockerfile - shm_size: "2147483648" + args: + BASE_IMAGE: alpine target: test - command: null - entrypoint: null + shm_size: "2147483648" networks: default: null normalized: build: context: . dockerfile: Dockerfile - command: null - entrypoint: null networks: default: null diff --git a/src/testdata/bun-in-compose/compose.yaml.fixup b/src/testdata/bun-in-compose/compose.yaml.fixup index 08e710492..7449dca59 100644 --- a/src/testdata/bun-in-compose/compose.yaml.fixup +++ b/src/testdata/bun-in-compose/compose.yaml.fixup @@ -2,14 +2,10 @@ bun: build: context: ./app dockerfile: Dockerfile - command: null - entrypoint: null networks: default: null restart: unless-stopped server: - command: null - entrypoint: null image: oven/bun:latest networks: default: null diff --git a/src/testdata/bun-in-dockerfile/compose.yaml.fixup b/src/testdata/bun-in-dockerfile/compose.yaml.fixup index 19a2bc88b..4b8f64645 100644 --- a/src/testdata/bun-in-dockerfile/compose.yaml.fixup +++ b/src/testdata/bun-in-dockerfile/compose.yaml.fixup @@ -2,14 +2,10 @@ bun: build: context: ./app dockerfile: Dockerfile - command: null - entrypoint: null networks: default: null restart: unless-stopped server: - command: null - entrypoint: null image: alpine:latest networks: default: null diff --git a/src/testdata/compose-go-warn/compose.yaml.fixup b/src/testdata/compose-go-warn/compose.yaml.fixup index 7bbfc9866..8fcc982ff 100644 --- a/src/testdata/compose-go-warn/compose.yaml.fixup +++ b/src/testdata/compose-go-warn/compose.yaml.fixup @@ -1,11 +1,9 @@ echo: - command: null - entrypoint: null image: ealen/echo-server networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 80 + protocol: tcp + app_protocol: http diff --git a/src/testdata/configdetection/compose.yaml.fixup b/src/testdata/configdetection/compose.yaml.fixup index c70a77e67..7033ce2ea 100644 --- a/src/testdata/configdetection/compose.yaml.fixup +++ b/src/testdata/configdetection/compose.yaml.fixup @@ -1,6 +1,4 @@ configdetection: - command: null - entrypoint: null environment: API_KEY: 50m34p1k3y AWS_CLIENT_ID: AROA1234567890ABCDEF diff --git a/src/testdata/configoverride/compose.yaml.fixup b/src/testdata/configoverride/compose.yaml.fixup index fd73c4df6..ef6fd7e11 100644 --- a/src/testdata/configoverride/compose.yaml.fixup +++ b/src/testdata/configoverride/compose.yaml.fixup @@ -1,6 +1,4 @@ service1: - command: null - entrypoint: null environment: VAR1: null image: alpine diff --git a/src/testdata/debugproj/compose.yaml.fixup b/src/testdata/debugproj/compose.yaml.fixup index c7657e503..2e76dab07 100644 --- a/src/testdata/debugproj/compose.yaml.fixup +++ b/src/testdata/debugproj/compose.yaml.fixup @@ -2,15 +2,11 @@ failing: build: context: ./app dockerfile: Dockerfile - command: null - entrypoint: null networks: default: null ok: build: context: . dockerfile: Dockerfile - command: null - entrypoint: null networks: default: null diff --git a/src/testdata/dependson/compose.yaml.fixup b/src/testdata/dependson/compose.yaml.fixup index ff5357c9c..4442afa97 100644 --- a/src/testdata/dependson/compose.yaml.fixup +++ b/src/testdata/dependson/compose.yaml.fixup @@ -1,5 +1,4 @@ service1: - command: null depends_on: service2: condition: service_started @@ -7,27 +6,22 @@ service1: service3: condition: service_started required: true - entrypoint: null image: alpine networks: default: null service2: - command: null depends_on: service3: condition: service_started required: true - entrypoint: null image: alpine networks: default: null service3: - command: null depends_on: service3: condition: service_started required: true - entrypoint: null image: alpine networks: default: null diff --git a/src/testdata/dockerfile-validation-errors/compose.yaml.fixup b/src/testdata/dockerfile-validation-errors/compose.yaml.fixup index 51b929051..2a219445e 100644 --- a/src/testdata/dockerfile-validation-errors/compose.yaml.fixup +++ b/src/testdata/dockerfile-validation-errors/compose.yaml.fixup @@ -2,12 +2,10 @@ invalid-dockerfile: build: context: . dockerfile: Dockerfile.invalid - command: null - entrypoint: null networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 8080 + protocol: tcp + app_protocol: http diff --git a/src/testdata/emptyenv/compose.yaml.fixup b/src/testdata/emptyenv/compose.yaml.fixup index 76f86b83f..2746b6a83 100644 --- a/src/testdata/emptyenv/compose.yaml.fixup +++ b/src/testdata/emptyenv/compose.yaml.fixup @@ -1,11 +1,9 @@ emptyenv: build: - args: - ARG2: "" context: . dockerfile: Dockerfile - command: null - entrypoint: null + args: + ARG2: "" environment: ENV1: null ENV2: "" diff --git a/src/testdata/extends/compose.yaml.fixup b/src/testdata/extends/compose.yaml.fixup index 817ec7779..6bfc09028 100644 --- a/src/testdata/extends/compose.yaml.fixup +++ b/src/testdata/extends/compose.yaml.fixup @@ -1,6 +1,4 @@ array-override: - command: null - entrypoint: null environment: EMPTY_VALUE: bar NEW_VALUE: bar @@ -10,14 +8,10 @@ array-override: networks: default: null array-reset: - command: null - entrypoint: null image: bogus networks: default: null array-set: - command: null - entrypoint: null environment: BASE_ONLY: foo EMPTY_VALUE: bar @@ -28,8 +22,6 @@ array-set: networks: default: null array-unset: - command: null - entrypoint: null environment: BASE_ONLY: foo EMPTY_VALUE: null @@ -40,8 +32,6 @@ array-unset: networks: default: null map-override: - command: null - entrypoint: null environment: EMPTY_VALUE: bar NEW_VALUE: bar @@ -51,16 +41,12 @@ map-override: networks: default: null map-reset: - command: null - entrypoint: null environment: BASE_ONLY: foo image: bogus networks: default: null map-set: - command: null - entrypoint: null environment: BASE_ONLY: foo EMPTY_VALUE: bar @@ -71,8 +57,6 @@ map-set: networks: default: null map-unset: - command: null - entrypoint: null environment: BASE_ONLY: foo EMPTY_VALUE: null diff --git a/src/testdata/fixupenv/compose.yaml.fixup b/src/testdata/fixupenv/compose.yaml.fixup index 672738e55..232be2a81 100644 --- a/src/testdata/fixupenv/compose.yaml.fixup +++ b/src/testdata/fixupenv/compose.yaml.fixup @@ -1,60 +1,48 @@ Mistral: - command: null - entrypoint: null image: mistral:latest networks: default: null ports: - mode: host - protocol: tcp target: 8000 + protocol: tcp fixup-args: build: - args: - API_URL: http://mock-mistral:8000 context: . dockerfile: Dockerfile - command: null - entrypoint: null + args: + API_URL: http://mock-mistral:8000 networks: default: null ingress-service: - command: null - entrypoint: null image: somedb:latest networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 5432 + protocol: tcp + app_protocol: http refer-self-build-arg: build: - args: - CONFIG4: refer-self-env.fixupenv.tenant2.defang.app context: . dockerfile: Dockerfile - command: null - entrypoint: null + args: + CONFIG4: refer-self-env.fixupenv.tenant2.defang.app networks: default: null refer-self-env: - command: null - entrypoint: null environment: CONFIG3: refer-self-env.fixupenv.tenant2.defang.app image: service:latest networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 5678 + protocol: tcp + app_protocol: http ui: - command: null - entrypoint: null environment: API_URL: http://mock-mistral:8000 SENSITIVE_DATA: null @@ -62,8 +50,6 @@ ui: networks: default: null use-ingress-service: - command: null - entrypoint: null environment: UI_URL: ingress-service.fixupenv.tenant2.defang.app:5432 image: service:latest diff --git a/src/testdata/gpu/compose.yaml.fixup b/src/testdata/gpu/compose.yaml.fixup index be0071558..bd571d1fe 100644 --- a/src/testdata/gpu/compose.yaml.fixup +++ b/src/testdata/gpu/compose.yaml.fixup @@ -1,7 +1,5 @@ mistral: - command: null deploy: - placement: {} replicas: 1 resources: reservations: @@ -9,6 +7,5 @@ mistral: - capabilities: - gpu count: -1 - entrypoint: null networks: default: null diff --git a/src/testdata/healthcheck/compose.yaml.fixup b/src/testdata/healthcheck/compose.yaml.fixup index 57ddb8bb2..34ef42647 100644 --- a/src/testdata/healthcheck/compose.yaml.fixup +++ b/src/testdata/healthcheck/compose.yaml.fixup @@ -1,6 +1,4 @@ cmd-shell: - command: null - entrypoint: null healthcheck: test: - CMD-SHELL @@ -10,13 +8,11 @@ cmd-shell: networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 5000 + protocol: tcp + app_protocol: http curl: - command: null - entrypoint: null healthcheck: test: - CMD @@ -27,13 +23,11 @@ curl: networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 80 + protocol: tcp + app_protocol: http flask1: - command: null - entrypoint: null healthcheck: test: - CMD @@ -46,49 +40,43 @@ flask1: networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 5000 + protocol: tcp + app_protocol: http flask2: - command: null - entrypoint: null healthcheck: - interval: 10s test: - CMD - python - -c - import urllib.request;urllib.request.urlopen('http://127.0.0.1/path').read() + interval: 10s image: flask networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 5000 + protocol: tcp + app_protocol: http none: - command: null - entrypoint: null healthcheck: - interval: 1m0s - retries: 3 test: - NONE - ignored timeout: 1s + interval: 1m0s + retries: 3 image: alpine networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 5000 + protocol: tcp + app_protocol: http wget: - command: null - entrypoint: null healthcheck: test: - CMD @@ -100,7 +88,7 @@ wget: networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 80 + protocol: tcp + app_protocol: http diff --git a/src/testdata/heroku/compose.yaml.fixup b/src/testdata/heroku/compose.yaml.fixup index 6c8ffe030..63fef888a 100644 --- a/src/testdata/heroku/compose.yaml.fixup +++ b/src/testdata/heroku/compose.yaml.fixup @@ -2,7 +2,6 @@ app: build: context: . dockerfile: '*Railpack' - command: null depends_on: postgres: condition: service_started @@ -10,29 +9,24 @@ app: redis: condition: service_started required: true - entrypoint: null environment: DATABASE_URL: postgres://postgres:postgres@mock-postgres:5432/app REDIS_URL: redis://mock-redis:5739 networks: default: null postgres: - command: null - entrypoint: null image: postgres:15-alpine networks: default: null ports: - mode: host - protocol: tcp target: 5432 + protocol: tcp redis: - command: null - entrypoint: null image: redis:7-alpine networks: default: null ports: - mode: host - protocol: tcp target: 6379 + protocol: tcp diff --git a/src/testdata/interpolate/compose.yaml.fixup b/src/testdata/interpolate/compose.yaml.fixup index 9865e4822..62ce67c70 100644 --- a/src/testdata/interpolate/compose.yaml.fixup +++ b/src/testdata/interpolate/compose.yaml.fixup @@ -1,6 +1,4 @@ interpolate: - command: null - entrypoint: null environment: BRACED: interpolate DB: postgres://user:${POSTGRES_PASSWORD}@db:5432/db diff --git a/src/testdata/llm/compose.yaml.fixup b/src/testdata/llm/compose.yaml.fixup index b4eb13b1e..277f796ad 100644 --- a/src/testdata/llm/compose.yaml.fixup +++ b/src/testdata/llm/compose.yaml.fixup @@ -1,38 +1,34 @@ alt-repo: - command: null - entrypoint: null image: altrepo.com/litellm:latest networks: default: null ports: - mode: host - protocol: tcp target: 4000 + protocol: tcp + x-defang-llm: true gateway-with-ports: - command: null - entrypoint: null image: litellm/litellm:latest networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp - published: "5678" + - mode: ingress target: 5678 + published: "5678" + protocol: tcp + app_protocol: http + x-defang-llm: true gateway-without-ports: - command: null - entrypoint: null image: litellm/litellm:latest networks: default: null ports: - mode: host - protocol: tcp target: 4000 + protocol: tcp + x-defang-llm: true llm: - command: null - entrypoint: null image: llm:latest networks: default: null + x-defang-llm: true diff --git a/src/testdata/longname/compose.yaml.fixup b/src/testdata/longname/compose.yaml.fixup index f5340057c..e82ddca85 100644 --- a/src/testdata/longname/compose.yaml.fixup +++ b/src/testdata/longname/compose.yaml.fixup @@ -1,6 +1,4 @@ aVeryLongServiceNameThatIsDefinitelyTooLongThatWillCauseAnError: - command: null - entrypoint: null image: alpine networks: default: null diff --git a/src/testdata/models/compose.yaml.fixup b/src/testdata/models/compose.yaml.fixup index 7886d7968..7d3773234 100644 --- a/src/testdata/models/compose.yaml.fixup +++ b/src/testdata/models/compose.yaml.fixup @@ -5,7 +5,6 @@ ai_model: - ai/model - --alias - ai/model - entrypoint: null environment: LITELLM_MASTER_KEY: networkisalreadyprivate image: litellm/litellm:v1.82.3-stable.patch.3 @@ -13,15 +12,14 @@ ai_model: model_provider_private: null ports: - mode: host - protocol: tcp target: 4000 + protocol: tcp + x-defang-llm: true modellist: - command: null depends_on: ai_model: condition: service_started required: true - entrypoint: null environment: AI_MODEL_MODEL: ai/model AI_MODEL_URL: http://mock-ai-model:4000/v1/ @@ -31,13 +29,12 @@ modellist: networks: default: null model_provider_private: null + x-defang-llm: true modelmap: - command: null depends_on: ai_model: condition: service_started required: true - entrypoint: null environment: AI_MODEL_MODEL: ai/model AI_MODEL_URL: http://mock-ai-model:4000/v1/ @@ -54,7 +51,6 @@ my_model: - ai/model - --alias - ai/model - entrypoint: null environment: LITELLM_MASTER_KEY: networkisalreadyprivate image: litellm/litellm:v1.82.3-stable.patch.3 @@ -62,15 +58,14 @@ my_model: model_provider_private: null ports: - mode: host - protocol: tcp target: 4000 + protocol: tcp + x-defang-llm: true withendpoint: - command: null depends_on: my_model: condition: service_started required: true - entrypoint: null environment: MODEL_URL: http://mock-my-model:4000/v1/ MY_MODEL_MODEL: ai/model @@ -82,12 +77,10 @@ withendpoint: default: null model_provider_private: null withmodelvar: - command: null depends_on: ai_model: condition: service_started required: true - entrypoint: null environment: AI_MODEL_URL: http://mock-ai-model:4000/v1/ MY_MODEL_NAME: ai/model diff --git a/src/testdata/mongo/compose.yaml.fixup b/src/testdata/mongo/compose.yaml.fixup index dc61b5f59..b4bc973b5 100644 --- a/src/testdata/mongo/compose.yaml.fixup +++ b/src/testdata/mongo/compose.yaml.fixup @@ -1,6 +1,4 @@ mongo: - command: null - entrypoint: null environment: MONGO_INITDB_ROOT_PASSWORD: example! MONGO_INITDB_ROOT_USERNAME: root @@ -9,16 +7,16 @@ mongo: default: null ports: - mode: host - protocol: tcp target: 27017 + protocol: tcp restart: always + x-defang-mongodb: + allow-downtime: true mongo-express: - command: null depends_on: mongo: condition: service_started required: true - entrypoint: null environment: ME_CONFIG_BASICAUTH: "false" ME_CONFIG_MONGODB_ADMINPASSWORD: example! @@ -28,144 +26,138 @@ mongo-express: networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp - published: "8081" + - mode: ingress target: 8081 + published: "8081" + protocol: tcp + app_protocol: http restart: always mongo-port1234: command: - --port - "1234" - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 1234 + protocol: tcp restart: always + x-defang-mongodb: true mongo-port1235: command: - --port=1235 - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 1235 + protocol: tcp restart: always + x-defang-mongodb: true mongo-port1236: command: - --port - "1236" - --shardsvr - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 1236 + protocol: tcp restart: always mongo-port1237: command: - --port=1237 - --configsvr - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 1237 + protocol: tcp restart: always + x-defang-mongodb: true mongo-port1238: command: - --shardsvr - --port - "1238" - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 1238 + protocol: tcp restart: always + x-defang-mongodb: true mongo-port1239: command: - --configsvr - --port=1239 - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 1239 + protocol: tcp restart: always + x-defang-mongodb: true mongo-port27018: command: - --shardsvr - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 27018 + protocol: tcp restart: always + x-defang-mongodb: true mongo-port27019: command: - --configsvr - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 27019 + protocol: tcp restart: always + x-defang-mongodb: true mongo-unmanaged: - command: null - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp target: 27017 + protocol: tcp restart: always mongo-wrong-image: - command: null - entrypoint: null image: example networks: default: null ports: - mode: host - protocol: tcp target: 27017 + protocol: tcp + x-defang-mongodb: true short-ports: - command: null - entrypoint: null image: mongo networks: default: null ports: - mode: host - protocol: tcp - published: "27017" target: 27017 + published: "27017" + protocol: tcp diff --git a/src/testdata/networks/compose.yaml.fixup b/src/testdata/networks/compose.yaml.fixup index ab3831089..6b69ffd9e 100644 --- a/src/testdata/networks/compose.yaml.fixup +++ b/src/testdata/networks/compose.yaml.fixup @@ -1,43 +1,29 @@ service-default: - command: null - entrypoint: null image: example networks: default: null service-internal: - command: null - entrypoint: null image: example networks: internal: null service-invalid: - command: null - entrypoint: null image: example networks: invalid-network-name: {} service-multi: - command: null - entrypoint: null image: example networks: default: null internal: null service-private: - command: null - entrypoint: null image: example networks: private: null service-public: - command: null - entrypoint: null image: example networks: public: {} service-public-list: - command: null - entrypoint: null image: example networks: public: null diff --git a/src/testdata/platforms/compose.yaml.fixup b/src/testdata/platforms/compose.yaml.fixup index d73702216..46251fa69 100644 --- a/src/testdata/platforms/compose.yaml.fixup +++ b/src/testdata/platforms/compose.yaml.fixup @@ -1,6 +1,4 @@ intel2: - command: null - entrypoint: null image: busybox networks: default: null diff --git a/src/testdata/ports/compose.yaml.fixup b/src/testdata/ports/compose.yaml.fixup index 67c2cccf5..37f13a5af 100644 --- a/src/testdata/ports/compose.yaml.fixup +++ b/src/testdata/ports/compose.yaml.fixup @@ -1,78 +1,64 @@ grpc: - command: null - entrypoint: null image: bogus networks: default: null ports: - - app_protocol: grpc - mode: ingress - protocol: tcp + - mode: ingress target: 9000 + protocol: tcp + app_protocol: grpc long: - command: null - entrypoint: null image: bogus networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 82 + protocol: tcp + app_protocol: http long-published: - command: null - entrypoint: null image: bogus networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp - published: "8083" + - mode: ingress target: 83 + published: "8083" + protocol: tcp + app_protocol: http short: - command: null - entrypoint: null image: bogus networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 80 + protocol: tcp + app_protocol: http short-published: - command: null - entrypoint: null image: bogus networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp - published: "8081" + - mode: ingress target: 81 + published: "8081" + protocol: tcp + app_protocol: http short-udp: - command: null - entrypoint: null image: bogus networks: default: null ports: - mode: host - protocol: udp target: 84 + protocol: udp short-udp-published: - command: null - entrypoint: null image: bogus networks: default: null ports: - mode: host - protocol: udp - published: "8085" target: 85 + published: "8085" + protocol: udp diff --git a/src/testdata/postgres/compose.yaml.fixup b/src/testdata/postgres/compose.yaml.fixup index c6af18ba2..1bbcb4485 100644 --- a/src/testdata/postgres/compose.yaml.fixup +++ b/src/testdata/postgres/compose.yaml.fixup @@ -1,26 +1,21 @@ no-ext: - command: null - entrypoint: null image: postgres networks: default: null ports: - mode: host - protocol: tcp target: 5432 + protocol: tcp no-ports: - command: null - entrypoint: null image: postgres networks: default: null ports: - mode: host - protocol: tcp target: 5432 + protocol: tcp + x-defang-postgres: null no-ports-override: - command: null - entrypoint: null environment: PGPORT: "5433" image: postgres @@ -28,36 +23,35 @@ no-ports-override: default: null ports: - mode: host - protocol: tcp target: 5433 + protocol: tcp + x-defang-postgres: null short-ports: - command: null - entrypoint: null image: postgres networks: default: null ports: - mode: host - protocol: tcp - published: "5432" target: 5432 + published: "5432" + protocol: tcp + x-defang-postgres: null with-ext: - command: null - entrypoint: null image: postgres networks: default: null ports: - mode: host - protocol: tcp target: 5432 + protocol: tcp + x-defang-postgres: + allow-downtime: true wrong-image: - command: null - entrypoint: null image: example networks: default: null ports: - mode: host - protocol: tcp target: 5432 + protocol: tcp + x-defang-postgres: null diff --git a/src/testdata/profiles/compose.yaml.fixup b/src/testdata/profiles/compose.yaml.fixup index d585ffdaa..a9311b3cd 100644 --- a/src/testdata/profiles/compose.yaml.fixup +++ b/src/testdata/profiles/compose.yaml.fixup @@ -1,14 +1,10 @@ always: - command: null - entrypoint: null image: alpine networks: default: null defangonly: - command: null - entrypoint: null + profiles: + - defang image: alpine networks: default: null - profiles: - - defang diff --git a/src/testdata/provider/compose.yaml.fixup b/src/testdata/provider/compose.yaml.fixup index 69a86041d..8cfed67d5 100644 --- a/src/testdata/provider/compose.yaml.fixup +++ b/src/testdata/provider/compose.yaml.fixup @@ -5,7 +5,6 @@ ai_runner: - ai/smollm2 - --alias - ai/smollm2 - entrypoint: null environment: DEBUG: "true" LITELLM_MASTER_KEY: networkisalreadyprivate @@ -14,15 +13,13 @@ ai_runner: model_provider_private: null ports: - mode: host - protocol: tcp target: 4000 + protocol: tcp chat: - command: null depends_on: ai_runner: condition: service_started required: true - entrypoint: null environment: AI_RUNNER_MODEL: ai/smollm2 AI_RUNNER_URL: http://mock-ai-runner:4000/v1/ diff --git a/src/testdata/railpack/compose.yaml.fixup b/src/testdata/railpack/compose.yaml.fixup index ae4a0d8cc..31f4e40f8 100644 --- a/src/testdata/railpack/compose.yaml.fixup +++ b/src/testdata/railpack/compose.yaml.fixup @@ -4,7 +4,6 @@ railpack-long: dockerfile: '*Railpack' command: - exec node index.js - entrypoint: null networks: default: null railpack-short: @@ -13,7 +12,6 @@ railpack-short: dockerfile: '*Railpack' command: - npm start - entrypoint: null networks: default: null railpackwithdockerfile: @@ -22,6 +20,5 @@ railpackwithdockerfile: dockerfile: '*Railpack' command: - something "with space" "${PORT}" - entrypoint: null networks: default: null diff --git a/src/testdata/redis/compose.yaml.fixup b/src/testdata/redis/compose.yaml.fixup index 79ef2ac19..943af4027 100644 --- a/src/testdata/redis/compose.yaml.fixup +++ b/src/testdata/redis/compose.yaml.fixup @@ -1,73 +1,67 @@ no-ext: - command: null - entrypoint: null image: redis networks: default: null ports: - mode: host - protocol: tcp target: 6379 + protocol: tcp no-ports: - command: null - entrypoint: null image: redis networks: default: null ports: - mode: host - protocol: tcp target: 6379 + protocol: tcp + x-defang-redis: null no-ports-override: command: - --port - "6380" - entrypoint: null image: redis networks: default: null ports: - mode: host - protocol: tcp target: 6380 + protocol: tcp + x-defang-redis: null short-ports: - command: null - entrypoint: null image: redis networks: default: null ports: - mode: host - protocol: tcp - published: "6379" target: 6379 + published: "6379" + protocol: tcp + x-defang-redis: null valkey-service: - command: null - entrypoint: null image: valkey/valkey:latest networks: default: null ports: - mode: host - protocol: tcp target: 6379 + protocol: tcp + x-defang-redis: true with-ext: - command: null - entrypoint: null image: redis networks: default: null ports: - mode: host - protocol: tcp target: 6379 + protocol: tcp + x-defang-redis: + allow-downtime: true wrong-image: - command: null - entrypoint: null image: example networks: default: null ports: - mode: host - protocol: tcp target: 6379 + protocol: tcp + x-defang-redis: null diff --git a/src/testdata/replicas/compose.yaml.fixup b/src/testdata/replicas/compose.yaml.fixup index a8b7aa14f..2be6562c6 100644 --- a/src/testdata/replicas/compose.yaml.fixup +++ b/src/testdata/replicas/compose.yaml.fixup @@ -1,44 +1,33 @@ autoscaled: - command: null - entrypoint: null image: nginx:latest networks: default: null + x-defang-autoscaling: true default: - command: null - entrypoint: null image: nginx:latest networks: default: null deploy: - command: null deploy: - placement: {} resources: reservations: cpus: 0.25 memory: "268435456" - entrypoint: null image: nginx:latest networks: default: null managed: - command: null - entrypoint: null image: redis:latest networks: default: null ports: - mode: host - protocol: tcp target: 6379 + protocol: tcp + x-defang-redis: true replicated: - command: null deploy: - placement: {} replicas: 3 - resources: {} - entrypoint: null image: nginx:latest networks: default: null diff --git a/src/testdata/sanity/compose.yaml.fixup b/src/testdata/sanity/compose.yaml.fixup index 7e707b730..19bbeb3d4 100644 --- a/src/testdata/sanity/compose.yaml.fixup +++ b/src/testdata/sanity/compose.yaml.fixup @@ -1,19 +1,16 @@ nginx: - command: null deploy: - placement: {} resources: reservations: memory: "268435456" - entrypoint: null environment: dummy: null image: nginx networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 80 + protocol: tcp + app_protocol: http restart: unless-stopped diff --git a/src/testdata/secretname/compose.yaml.fixup b/src/testdata/secretname/compose.yaml.fixup index 350588072..72d4a4cc7 100644 --- a/src/testdata/secretname/compose.yaml.fixup +++ b/src/testdata/secretname/compose.yaml.fixup @@ -2,8 +2,6 @@ app: build: context: . dockerfile: Dockerfile - command: null - entrypoint: null environment: dummy: null networks: diff --git a/src/testdata/static-files/compose.yaml.fixup b/src/testdata/static-files/compose.yaml.fixup index fa13dc705..90ef5dca2 100644 --- a/src/testdata/static-files/compose.yaml.fixup +++ b/src/testdata/static-files/compose.yaml.fixup @@ -1,12 +1,13 @@ x: - command: null - entrypoint: null image: blah networks: default: null + x-defang-static-files: ./folder "y": - command: null - entrypoint: null image: blah networks: default: null + x-defang-static-files: + folder: ./folder + redirects: true - www.example.com + x-unsupported: asdf diff --git a/src/testdata/testproj/compose.yaml.fixup b/src/testdata/testproj/compose.yaml.fixup index 0777cad91..2a65e3b5b 100644 --- a/src/testdata/testproj/compose.yaml.fixup +++ b/src/testdata/testproj/compose.yaml.fixup @@ -1,13 +1,11 @@ dfnx: build: - args: - DNS: mock-dfnx context: . dockerfile: Dockerfile + args: + DNS: mock-dfnx target: testproj - command: null deploy: - placement: {} resources: limits: cpus: 2 @@ -15,7 +13,6 @@ dfnx: reservations: cpus: 0.25 memory: "268435456" - entrypoint: null environment: DOT_ENV_INTERPOLATION: enabled DOTENV: enabled @@ -30,15 +27,15 @@ dfnx: networks: default: null ports: - - app_protocol: http - mode: ingress - protocol: tcp + - mode: ingress target: 80 - - app_protocol: http - mode: ingress protocol: tcp + app_protocol: http + - mode: ingress target: 1234 + protocol: tcp + app_protocol: http - mode: host - protocol: udp target: 4567 + protocol: udp restart: unless-stopped diff --git a/src/testdata/toomany/compose.yaml.fixup b/src/testdata/toomany/compose.yaml.fixup index bde7b1623..f97ec1802 100644 --- a/src/testdata/toomany/compose.yaml.fixup +++ b/src/testdata/toomany/compose.yaml.fixup @@ -1,6 +1,4 @@ service1: - command: null - entrypoint: null image: example networks: default: null diff --git a/src/testdata/toomany/docker-compose.yml.fixup b/src/testdata/toomany/docker-compose.yml.fixup index bde7b1623..f97ec1802 100644 --- a/src/testdata/toomany/docker-compose.yml.fixup +++ b/src/testdata/toomany/docker-compose.yml.fixup @@ -1,6 +1,4 @@ service1: - command: null - entrypoint: null image: example networks: default: null