Skip to content

[BUG] Filepath issue when converting/loading env file from docker-compose env_file #1678

@ycordier-pro

Description

@ycordier-pro

Expected Behavior

Hello,

It seems that with the latest version of kompose (1.30.0), there is a regression with the management of env_file.
I have a docker-compose.yaml with a properties.env file at the same level and some service definitions with :

[...]
    env_file:
      - properties.env
[...]

With version 1.29.0 of kompose, everything works fine and it generates a ConfigMap file named "properties-env-configmap.yaml" holding these values, but with version 1.30.0, I get an error like :

$ pwd
/work
$ kompose version
1.30.0 (9d8dcb518)
$ ls
docker-compose.yaml   properties.env
$ kompose -f docker-compose.yaml convert
FATA Unable to retrieve env file: Unable to read env_file: open /work/work/properties.env: no such file or directory

The path in the error contains twice the directory where the docker-compose.yaml file resides.
Thanks for looking into it !

Actual Behavior

kompose version 1.30.0 doesn't handle env_file path correctly anymore

Steps To Reproduce

Create a simple docker-compose.yaml file with an "env_file" section
Run kompose convert
Check for the path error

Kompose Version

1.30.0 (9d8dcb518)

Docker-Compose file

[...]
    env_file:
      - properties.env
[...]

Anything else?

Here's the output with debug enabled if it can be of any help :

$ kompose -v -f docker-compose.yaml convert
DEBU Checking validation of provider: kubernetes
DEBU Checking validation of controller:
DEBU Compose file dir: /work
FATA Unable to retrieve env file: Unable to read env_file: open /work/work/properties.env: no such file or directory

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions