diff --git a/runner_manager/bin/startup.sh b/runner_manager/bin/startup.sh index 67593fb2..3b182d16 100755 --- a/runner_manager/bin/startup.sh +++ b/runner_manager/bin/startup.sh @@ -18,10 +18,22 @@ SSH_KEYS=${SSH_KEYS:-""} SCRIPT_FILE=$(readlink -f "$0") function setup_runner_hook { + mkdir -p /opt/runner + # setup the content of the function job_started in the file /opt/runner/started + echo "#!/usr/bin/env bash +${SCRIPT_FILE} --job-started" | sudo tee /opt/runner/started + chmod +x /opt/runner/started + # same for job_completed + echo "#!/usr/bin/env bash +${SCRIPT_FILE} --job-completed" | sudo tee /opt/runner/completed + chmod +x /opt/runner/completed + # Ensure the user actions can execute the hooks + sudo chown -R actions:actions /opt/runner touch /home/actions/actions-runner/.env - echo "ACTIONS_RUNNER_HOOK_JOB_STARTED=${SCRIPT_FILE} --job-started" >>/home/actions/actions-runner/.env - echo "ACTIONS_RUNNER_HOOK_JOB_COMPLETED=${SCRIPT_FILE} --job-completed" >>/home/actions/actions-runner/.env + echo "ACTIONS_RUNNER_HOOK_JOB_STARTED=/opt/runner/started" >>/home/actions/actions-runner/.env + echo "ACTIONS_RUNNER_HOOK_JOB_COMPLETED=/opt/runner/completed" >>/home/actions/actions-runner/.env chown actions:actions /home/actions/actions-runner/.env + } function job_started {