Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

env_variables cannot be used in deployment #32

Description

@nek023

Hi,

This is a issue about ruby25_app_builder rather than this gem.
Sorry if it isn't the right place to ask.

I found that environment variables defined in app.yaml cannot be used in gcloud app deploy.

For example, my Rails app initializes an API client on launch.
So I wrote an initializer that reads API key from environment variable:

config/initializers/sample_initializer.rb

api_key=ENV['SAMPLE_API_KEY']raise'sample_api_key is required'ifapi_key.blank?SampleClient.config.api_key=api_key

Then I deploy this app with gcloud app deploy.
During deploy, ruby25_app_builder automatically runs rails assets:precompile if public/assets does not exists.
But this command fails due to missing env var.

Logs from Cloud Build:

Step #1 - "builder": [2019-12-15 09:59:24 INFO] => Checking for Rails sprockets
Step #1 - "builder": [2019-12-15 09:59:24 INFO] => Running Rails asset precompilation
Step #1 - "builder": [2019-12-15 09:59:24 INFO] ["bundle", "exec", "bin/rails", "assets:precompile"]
Step #1 - "builder": rails aborted!
Step #1 - "builder": sample_api_key is required

This can be avoided by running RAILS_ENV=production rails assets:precompile in advance.
But I think this should be done by ruby25_app_builder.
Are there any plans to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions