forked from philips-labs/terraform-aws-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update ubuntu example to fix /opt/hostedtoolcache (philips-labs#…
…2302) Changing USER_NAME to lower case user_name as that is the variable used by the install_runner.sh script to set the permission for /opt/hostedtoolcache: This also changed the user_name to "ubuntu" to match the `runner_run_as ` as defined in the `runner_run_as` option for the runners module
- Loading branch information
Showing
1 changed file
with
10 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,8 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
build-essential \ | ||
unzip | ||
|
||
USER_NAME=runners | ||
useradd -m -s /bin/bash $USER_NAME | ||
USER_ID=$(id -ru $USER_NAME) | ||
user_name=ubuntu | ||
user_id=$(id -ru $user_name) | ||
|
||
# install and configure cloudwatch logging agent | ||
wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb | ||
|
@@ -44,27 +43,27 @@ WantedBy=default.target | |
EOF | ||
|
||
echo export XDG_RUNTIME_DIR=/run/user/$USER_ID >>/home/$USER_NAME/.profile | ||
echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.profile | ||
|
||
systemctl daemon-reload | ||
systemctl enable [email protected] | ||
systemctl start [email protected] | ||
|
||
curl -fsSL https://get.docker.com/rootless >>/opt/rootless.sh && chmod 755 /opt/rootless.sh | ||
su -l $USER_NAME -c /opt/rootless.sh | ||
echo export DOCKER_HOST=unix:///run/user/$USER_ID/docker.sock >>/home/$USER_NAME/.profile | ||
echo export PATH=/home/$USER_NAME/bin:$PATH >>/home/$USER_NAME/.profile | ||
su -l $user_name -c /opt/rootless.sh | ||
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.profile | ||
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.profile | ||
|
||
# Run docker service by default | ||
loginctl enable-linger $USER_NAME | ||
su -l $USER_NAME -c "systemctl --user enable docker" | ||
loginctl enable-linger $user_name | ||
su -l $user_name -c "systemctl --user enable docker" | ||
|
||
${install_runner} | ||
|
||
# config runner for rootless docker | ||
cd /opt/actions-runner/ | ||
echo DOCKER_HOST=unix:///run/user/$USER_ID/docker.sock >>.env | ||
echo PATH=/home/$USER_NAME/bin:$PATH >>.env | ||
echo DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>.env | ||
echo PATH=/home/$user_name/bin:$PATH >>.env | ||
|
||
${post_install} | ||
|
||
|