Skip to content

Commit

Permalink
Merge pull request #224 from whywaita/feat/load-etc-environment
Browse files Browse the repository at this point in the history
Load custom path from /etc/environment in setup script
  • Loading branch information
whywaita authored Jan 15, 2025
2 parents 56a2422 + 579ed4c commit bc59e07
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/starter/scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ echo
echo "Configuring ${runner_name} @ $runner_url"
{{ if eq .RunnerArg "--once" -}}
echo "./config.sh --unattended --url $runner_url --token *** --name $runner_name --labels myshoes"
${sudo_prefix}./config.sh --unattended --url $runner_url --token $RUNNER_TOKEN --name $runner_name --labels myshoes{{.AdditionalLabels}}
${sudo_prefix}bash -c "source /etc/environment; ./config.sh --unattended --url $runner_url --token $RUNNER_TOKEN --name $runner_name --labels myshoes{{.AdditionalLabels}}"
{{ else -}}
echo "./config.sh --unattended --url $runner_url --token *** --name $runner_name --labels myshoes {{.RunnerArg}}"
${sudo_prefix}./config.sh --unattended --url $runner_url --token $RUNNER_TOKEN --name $runner_name --labels myshoes{{.AdditionalLabels}} {{.RunnerArg}}
${sudo_prefix}bash -c "source /etc/environment; ./config.sh --unattended --url $runner_url --token $RUNNER_TOKEN --name $runner_name --labels myshoes{{.AdditionalLabels}} {{.RunnerArg}}"
{{ end }}
Expand Down Expand Up @@ -365,10 +365,14 @@ fi
#---------------------------------------
# run!
#---------------------------------------
# GitHub-hosted runner load /etc/environment in /opt/runner/provisioner/provisioner.
# So, we need to load /etc/environment for job on self-hosted runner.
{{ if eq .RunnerArg "--once" -}}
echo "./bin/runsvc.sh {{.RunnerArg}}"
${sudo_prefix}./bin/runsvc.sh {{.RunnerArg}}
echo 'bash -c "source /etc/environment; ./bin/runsvc.sh {{.RunnerArg}}"'
${sudo_prefix}bash -c "source /etc/environment; ./bin/runsvc.sh {{.RunnerArg}}"
{{ else -}}
echo "./bin/runsvc.sh"
${sudo_prefix}./bin/runsvc.sh
echo 'bash -c "source /etc/environment; ./bin/runsvc.sh"'
${sudo_prefix}bash -c "source /etc/environment; ./bin/runsvc.sh"
{{ end }}`

0 comments on commit bc59e07

Please sign in to comment.