This repository was archived by the owner on Apr 26, 2019. It is now read-only.

Description
What I'd like to do:
Run scripts that set environment variables, which become available to my agents.
Steps I've done:
- I've created a Docker image based on this image (
gocd/gocd-agent-docker-dind specifically).
- I've added some scripts I'd like to run in
/etc/profile.d/, for example this one:
$ cat /etc/profile.d/add-python-scripts-to-path.sh
#!/bin/false
export PATH="/home/go/.local/bin:$PATH"
- I've created the
/etc/default/go-agent file, and have it load /etc/profile:
$ cat /etc/default/go-agent
. /etc/profile
- ...and
/etc/profile in turn should load the files in /etc/profile.d:
$ tail -n5 /etc/profile
for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
done
...however when I run jobs using this image, my scripts haven't been run, and the environment variables aren't set.
Questions:
- Am I configuring the right file? (
/etc/default/go-agent)
- Am I running without
service_mode? I suppose I am (?) — and then my guess (judging from /go-agent/agent.sh) is that maybe my file won't be loaded:
$ grep "/etc/default" -B 1 -A 5 /go-agent/agent.sh
if [ "$2" == "service_mode" ]; then
if [ -f /etc/default/${SERVICE_NAME} ]; then
. /etc/default/${SERVICE_NAME}
fi
# no point in not daemonizing the service
DAEMON=Y
fi
- If that's the case, is there another way I should be telling the gocd agent to run my files for setting environment variables etc?