Skip to content

Commit

Permalink
Update calls to script
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Feb 9, 2024
1 parent 0187d09 commit a7f8234
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions runner_manager/bin/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a7f8234

Please sign in to comment.