gocd/gocd-docker

Could setuser tool run a service like a login user?

Opened this issue · 0 comments

I use gocd agent to build a CI machine demo, and found it uses setuser tool to run CI service with a seperated user, for example 'testci'. My application is a Rails app. The CI server needs a ruby env to run each test. I have installed rvm for user 'testci', and use these commands to check, the ruby env is OK:

(I use docker compose, docker name is 'ci')

docker-compose run ci bash
su - testci
ruby -v

output is 'ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]', ruby does works.

But the problem is when the CI run each test, it always can't found ruby. Because the rvm config is be written in .bash_profile, a logined user can read it correctly so all ok, I guess setuser tool maybe didn't read .bash_profile then ruby not works.

Did I missed or ignored something? and I want to know the setuser tool can run a service like a real logined user?

In fact, my problem is how to add the ruby env in gocd agent correctly?