Buildkite and user's env variables

One of our pipelines is logging in as a user named “cicd”. When we log in to the VM manually as that user, we can see our ENV is ok. However, running commands in the pipeline, as that same user, doesn’t get the ENV/PATH/etc. We have to source ~/.bash_profile to find things like rvm for example.

Is there a feature we’re missing so that anytime buildkite runs, it uses the user’s ENV?

Hi Nathan!

The buildkite-agent doesn’t source your ~/.bash_profile when it runs jobs, unlike an interactive login does. We don’t do it by default, because it’s bad practice and can break a bunch of other things, so we can’t do it by default. But that does make rvm/rbenv/chruby setups harder to use sorry.

You can add an agent environment hook, or a repo pre-command hook, which does the source automatically for every job?

Cool, thanks for confirming!

1 Like