GoogleCloudPlatform/buildpacks

Ruby runtime force `production` environment

lukasztackowiak opened this issue · 2 comments

Currently Ruby runtime force production environment here and here.

With such configuration it is impossible to precompile assets in staging environment if application is using per-environment Rails credentials and you won't provide a key for production environment (which obviously shouldn't be done on staging environment).

It'll be much better if RAILS_ENV can be provided through build_env_variables and set to production only if the variable will be empty or not set at all.

Additional context
How are you using GCP buildpacks?

  • pack and the gcr.io/buildpacks/builder
  • Cloud Functions
  • Cloud Run
  • Cloud Build
  • App Engine Standard
  • App Engine Flex

What language is your project primarily written in?
Ruby

This is reasonable, but I think we should separate the runtime environment variable from the build environment variable. I suspect (but I am not sure) that it is should already be possible to override the runtime environment variable by providing it in app.yaml. I believe app.yaml should take precedency over LaunchEnvironment.Default which is what we use here.

@matthewrobertson That is correct, the variables set by LaunchEnvironment.Default can be overridden by setting environment variable so this is only a bit misleading (that runtime has a hardcoded production value).

Unfortunately assets precompilation process happens during the building time and have explicitly hardcoded RAILS_ENV=production (here) that cannot be overridden in any way (or at least I have no idea how to do it) so this is the main problem.