Skip to content

fix: remove job start hook with senstive information #3986

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

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
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
30 changes: 0 additions & 30 deletions modules/runners/templates/start-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,38 +80,8 @@ cleanup() {
fi
}

set_job_hook() {
local job_hook_script="$1"
local job_hook_var_name="$2"

if [[ -f "$job_hook_script" ]]; then
echo "$job_hook_script exists - $job_hook_script"
echo "$job_hook_var_name=$job_hook_script" | tee -a /opt/actions-runner/.env
else
echo "$job_hook_script does not exist - $job_hook_script"
fi
}

create_job_start_hook_script() {
cat <<EOF > /opt/actions-runner/job_pre_start_hook.sh
#!/bin/bash
echo "Running job pre start hook"
env
echo ------
ls -la /opt/actions-runner/_work/_temp/_github_workflow
cat /opt/actions-runner/_work/_temp/_github_workflow/event.json

EOF
chmod +x /opt/actions-runner/job_pre_start_hook.sh
}

trap 'cleanup $? $LINENO $BASH_LINENO' EXIT

create_job_start_hook_script
JOB_PRE_HOOK_SCRIPT=/opt/actions-runner/job_pre_start_hook.sh
set_job_hook $JOB_PRE_HOOK_SCRIPT ACTIONS_RUNNER_HOOK_JOB_STARTED


echo "Retrieving TOKEN from AWS API"
token=$(curl -f -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 180" || true)
if [ -z "$token" ]; then
Expand Down