Coder Social home page Coder Social logo

ENV cleanup about bigtuna HOT 9 CLOSED

knoopx avatar knoopx commented on August 20, 2024
ENV cleanup

from bigtuna.

Comments (9)

michalbugno avatar michalbugno commented on August 20, 2024

This part of code requires some attention, bigtuna should use Bundler.with_clear_env there but something didn't work for us when creating bigtuna. I'll take a look into this part and try to fix it -- no params should be set there.

from bigtuna.

knoopx avatar knoopx commented on August 20, 2024

does this mean that bigtuna is a CI for rails-only applications?

from bigtuna.

michalbugno avatar michalbugno commented on August 20, 2024

Nope, it runs arbitrary shell scripts. The env was set up so that it also supports rails apps.

from bigtuna.

knoopx avatar knoopx commented on August 20, 2024

also db:migrate RAILS_ENV=development does not override the default one set by with_clear_env

from bigtuna.

michalbugno avatar michalbugno commented on August 20, 2024

You can try the branch:
https://github.com/appelier/bigtuna/tree/runner_env_fix

And see if it works for you: it uses the Bundler.with_clean_env and doesn't set any env's. If you want to set the env yourself it might be insufficient (although I'm not sure) to use ENV_NAME=env_value script/to/run

You probably want to use 'env' command
env ENV_NAME=env_value script/to/run

Let us know if the solution works for you! :-)

from bigtuna.

wuputah avatar wuputah commented on August 20, 2024

+1. Confirmed this works great for us on a fairly quirky setup - our setup had issues under the default setup (we had to change BigTuna to delete the RAILS_ENV environment variable under the default setup).

from bigtuna.

cldwalker avatar cldwalker commented on August 20, 2024

+1

from bigtuna.

wuputah avatar wuputah commented on August 20, 2024

Recently discovered that we hadn't restarted our workers when we tried this, so we discovered a small problem - not one necessarily for Bigtuna to fix, but some people might run into this. Since bundler captures the ENV when it is loaded in config/boot.rb, the environment variable BUNDLE_GEMFILE is set (Rails sets this in config/boot.rb) even inside Bundler.with_clean_env. This will affect any build scripts trying to use Bundler. The workaround is to use the --gemfile option with bundle install and use BUNDLE_GEMFILE=%build_dir%/Gemfile in your build script. For example:

bundle install --path=%project_dir%/bundle --deployment --gemfile=%build_dir%/Gemfile
BUNDLE_GEMFILE=%build_dir%/Gemfile bundle exec rake

In the future it may be useful for Bigtuna to have an "environment variables" configuration section which will be applied to the entire build process (the above is an example - our build process is more complicated, and we have to set the environment variables on every line).

from bigtuna.

michalbugno avatar michalbugno commented on August 20, 2024

The issue is resolved, branch is merged into dev and regarding wuputah's comment I've created https://github.com/appelier/bigtuna/issues/issue/44

from bigtuna.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.