I'm trying to setup my Bamboo agents as a systemd service. The service file looks like this:
[Unit]
Description=Atlassian Bamboo Agent
After=syslog.target network.target
[Service]
Type=forking
User=bamboo
Group=bamboo
ExecStart=/opt/bamboo-1/bin/bamboo-agent.sh start
ExecStop=/opt/bamboo-1/bin/bamboo-agent.sh stop
Environment="PATH=/opt/rh/devtoolset-3/root/bin/:/usr/local/bin:/usr/bin"
[Install]
WantedBy=multi-user.target
When I check the process environment, the PATH is correctly set to what I expect, with with the only exception that my PATH is prepended with /bin
.
cat /proc/12345/environ <--- 12345 is my Bamboo PID
...
PATH=/bin:/opt/rh/devtoolset-3/root/bin/:/usr/local/bin:/usr/bin
...
That means my builds will use the wrong gcc
, cmake
, etc.
Is there any way to prevent /bin
to be prepended to the PATH?
I created a test service that just printed out the path after setting
Environment=
with a new path, and found it worked as expected on Ubuntu 16.04 with systemd 229.I conclude that something in your script is pre-pending /bin to your environment.
Nothing in the
systemd.exec
man page suggests that systemd is designed to behave the way you observe.