deis / builder

Git server and application builder for Deis Workflow
https://deis.com
MIT License
40 stars 44 forks source link

Don't set env vars during compile phase #444

Closed dblackdblack closed 7 years ago

dblackdblack commented 7 years ago

During the compile phase, heroku does not set user-specified environment variables/settings. Docs here: https://devcenter.heroku.com/articles/buildpack-api#bin-compile

In contrast, it appears that deis builder does set these variables. This is causing problems because we set PYTHONHOME and PYTHONPATH, which is causing builds to fail.

You should adhere to the heroku methodology of exposing settings in an envdir, but not actually setting them during the compile phase.

bacongobbler commented 7 years ago

If you have an application or some steps with an example application that we can use to reproduce and test the fix for this issue, that would be very appreciated.

dpretty commented 7 years ago

This affected us too while we've been updating from workflow 2.1 to 2.7. The issue was caused by the introduction of PYTHONPATH in the slugbuilder Dockerfile:

https://github.com/deis/slugbuilder/blob/e05a2c780dbff77f79cd6393d6f0fe79038a11cd/rootfs/Dockerfile#L33

Some of our projects had PYTHONPATH set via deis config, which overrides the value set in the Dockerfile, making the builds fail with:

-----> Discovering process types
Traceback (most recent call last):
  File "/bin/read_procfile_keys", line 4, in <module>
    import procfile
ImportError: No module named 'procfile'

The workaround for us is just to append :/usr/local/lib/python3/site-packages to the PYTHONPATH we set via deis config.

felixbuenemann commented 7 years ago

This actually breaks builds with custom buildpacks from private git repos or for example ruby builds that need to clone from private repos, because the SSH_KEY environment variable is no longer present in the build environment. I had to downgrade the builder to v2.5.5 to get builds working again.