Skip to content

Commit

Permalink
ci: Ensure crc_ci user can access systemctl user session
Browse files Browse the repository at this point in the history
This requires using `loginctl enable-linger` to make sure
/run/user/$UID/ exists (which contains some needed bus/systemd runtime
files/sockets), and then setting XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS
to enable communication with the systemd user instance.
  • Loading branch information
cfergeau authored and praveenkumar committed Aug 5, 2021
1 parent 61eafaf commit 1d81fb8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions centos_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ function prepare_ci_user() {
chown -R crc_ci:crc_ci /home/crc_ci/payload
# Copy the jenkins-env into crc_ci home dir
cp ~/.jenkins-env /home/crc_ci/jenkins-env

loginctl enable-linger crc_ci
}

function setup_golang() {
Expand Down Expand Up @@ -148,6 +150,8 @@ if [[ "$UID" = 0 ]]; then
runuser -l crc_ci -c "/bin/bash centos_ci.sh"
else
source ~/jenkins-env # Source environment variables for minishift_ci user
export XDG_RUNTIME_DIR="/run/user/$UID"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
export TERM=xterm-256color
get_bundle
setup_golang
Expand Down

0 comments on commit 1d81fb8

Please sign in to comment.