Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with spryker jenkins-runner running as root user #690

Merged
merged 2 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ function task_jenkins_setup()

# link php where it is expected by cron.conf
ln -s /usr/local/bin/php /usr/bin/php

# setup www-data folders
mkdir /var/www/.jenkins /data
chown www-data:www-data /var/www/.jenkins /data
andytson-inviqa marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
#!/bin/bash

function _trap_jenkins_exit()
{
echo 'Terminating jenkins agent' >&2
local CHILD_PIDS
mapfile -t CHILD_PIDS < <(jobs -p)
kill -TERM "${CHILD_PIDS[@]}"
wait
app jenkins unregister
}

function task_jenkins_start()
{
local -r JENKINS_RUNNER_NAME=$(hostname)

trap _trap_jenkins_exit EXIT

app jenkins:register

java -jar /usr/local/bin/jenkins-cli.jar -s "$JENKINS_URL" offline-node ""
java -jar /usr/local/bin/jenkins-slave.jar -jnlpUrl "$JENKINS_URL/computer/$JENKINS_RUNNER_NAME/slave-agent.jnlp" &

wait
exec su -s /usr/local/bin/jenkins-agent-start.sh www-data
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

function _trap_jenkins_exit()
{
echo 'Terminating jenkins agent' >&2
local CHILD_PIDS
mapfile -t CHILD_PIDS < <(jobs -p)
kill -TERM "${CHILD_PIDS[@]}"
wait
app jenkins unregister
}

function start()
{
local -r JENKINS_RUNNER_NAME=$(hostname)

trap _trap_jenkins_exit EXIT

app jenkins:register

java -jar /usr/local/bin/jenkins-cli.jar -s "$JENKINS_URL" offline-node ""
java -jar /usr/local/bin/jenkins-slave.jar -jnlpUrl "$JENKINS_URL/computer/$JENKINS_RUNNER_NAME/slave-agent.jnlp" &

wait
}

start