devspace init -> Docker-Compose migration ignores ENVs/--vars
excalq opened this issue · 1 comments
What happened?
When running devspace init
in an existing codebase having docker-compose.yaml
, Devspace prompts for migration from Docker Compose. However, it seems to ignore either locally sourced/exported ENVs as well as use of --vars
. When docker-compose.yaml
uses ENVs for the ports
values, the migration crashes.
set -a; source .env
# Same result with or without using --var=... below
devspace init --var=DB_PORT=27017 --var=EXPRESS_PORT=1337
? Docker Compose configuration detected. Do you want to create a DevSpace configuration based on Docker Compose? Convert existing docker-compose.yml to devspace.yaml
WARN[0001] The "EXPRESS_PORT" variable is not set. Defaulting to a blank string.
WARN[0001] The "EXPRESS_PORT" variable is not set. Defaulting to a blank string.
...
WARN[0001] The "DB_PORT" variable is not set. Defaulting to a blank string.
WARN[0001] The "DB_PORT" variable is not set. Defaulting to a blank string.
fatal 1 error(s) decoding:
* error decoding 'Ports': No port specified: :<empty>
What did you expect to happen instead?
Devspace would create a configuration respecting ENV setting of service's ports, and populate ENVs from the .env
file.
How can we reproduce the bug? (as minimally and precisely as possible)
No devspace.yaml exist yet, new project in a small existing node.js codebase, with MongoDB and Redis DBs.
Local Environment:
- DevSpace Version: [use
devspace --version
]
devspace version 6.3.12 - Operating System: windows | linux | mac
MacOS - ARCH of the OS: AMD64 | ARM64 | i386
ARM64
Kubernetes Cluster: - Cloud Provider: google | aws | azure | other
N/A - Kubernetes Version: [use
kubectl version
]
(Minikube, k8s 1.28)
Anything else we need to know?
Can you try setting the environment variables like this and report back?
DB_PORT=27017 EXPRESS_PORT=1337 devspace init
IIRC --var
values won't be picked up by the docker-compose libraries used internally.