Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Exporting environment variables in CMD do not persist in next command #696

Open
marschro opened this issue Apr 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@marschro
Copy link

marschro commented Apr 21, 2024

[MANDATORY] Describe the bug [MANDATORY]
I have the following Bastillefile:

ARG ENV_FOO
ARG ENV_BAR

CMD export FOO=${ENV_FOO}
CMD export BAR=${ENV_BAR}

CMD echo $FOO
CMD echo "expected output should be 'Foo' - but is empty. env variable is not set in consecutive commands"
  • Setting environment variables is not possible with this approach.
  • I currently set environment variables with the following workaround:
    CMD env APP_PHX_SERVER=${app_phx_server} env APP_DATABASE_URL=${app_database_url} env APP_SECRET_KEY_BASE=${app_secret_key_base} boot_my_app"

... which is working but is not readable and not well maintainable as along long one-liner (there are much more variables to set in my real project)

[MANDATORY] Bastille and FreeBSD version (paste bastille -v && freebsd-version -kru output)

  • 0.10.20231125
  • 14.0-RELEASE-p6
  • shell is posix compliant (sh)

[MANDATORY] How did you install bastille? (port/pkg/git)

  • pkg

[optional] Steps to reproduce?

  • none

[optional] Expected behavior

  • Environment variables that are exported in a CMD should be accessible in the following CMDs

[optional] Screenshots

  • none

[optional] Additional context

  • I checked multiple things, also sourcing a rendered .env file. These sourced variables also do not persist...
  • I generally do not understand, why that happens.
  • I guess, the process, that "terraforms" the jail is different from those, executing the commands...?
  • It might be, that I completely lack the knowledge and doing sth obviously wrong...
@marschro marschro added the bug Something isn't working label Apr 21, 2024
@michael-o
Copy link

I don't consider this is a bug. Each CMD is completely standalone. That would require a new ENV section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants