runfinch / finch

The Finch CLI is an open source client for container development
https://www.runfinch.com
Apache License 2.0
3.51k stars 90 forks source link

Unable to use the "--env-file" option on "finch compose up" command #890

Open nodematerial opened 5 months ago

nodematerial commented 5 months ago

Describe the bug Cannot use --env-file option with finch compose up command

software version finch: 1.1.3 MacOS: Sonoma 14.4.1

Steps to reproduce

  1. Put two files below in the same directory.
    
    # compose.yml

services: show-env: command:

# .env.test

A=1
B=2
  1. Execute the following command.
    finch compose up --env-file .env.test show-env

Expected behavior The busybox container executes env command, and the container stops. The standard output may be like as follows

INFO[0000] Ensuring image busybox
INFO[0000] Creating container test-show-env-1
INFO[0000] Attaching to logs
show-env-1 |PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
show-env-1 |A=1
show-env-1 |B=2
show-env-1 |HOME=/root
INFO[0000] Container "test-show-env-1" exited
INFO[0000] All the containers have exited
INFO[0000] Stopping containers (forcibly)
INFO[0000] Stopping container test-show-env-1

Screenshots or logs

Actual result

FATA[0000] unknown shorthand flag: 'e' in -e
FATA[0000] exit status 1

Additional context

INFO[0000] Ensuring image busybox INFO[0000] Creating container test-show-env-run-7d8df8b0049e PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin B=2 A=1 TERM=xterm HOME=/root INFO[0000] Stopping containers (forcibly) INFO[0000] Stopping container test-show-env-run-7d8df8b0049e



* This issue is similar to #827  in that both are related to enviromental variable setting.
* We can temporaly avoid this problem by using the `env_file` statement in `compose.yml`

_To help debug the issue as quickly as possible, we recommend generating a support bundle with `finch support-bundle generate` and attaching it to this issue. This packages all Finch-related configs and logs into one file._
[finch-support-20240407232422.zip](https://github.com/runfinch/finch/files/14897562/finch-support-20240407232422.zip)