Skip to content

Commit

Permalink
Fixing running sudo within the GHA setup
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Wall <[email protected]>
  • Loading branch information
joakimk and p-wall committed Dec 2, 2024
1 parent 032a7eb commit 669a778
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/controllers/api/cloud_inits_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ def show
},
],
runcmd: [
"while read -r env; do export \"$env\"; done < /etc/environment",
"systemctl stop sshd",
"systemctl disable sshd",
"curl https://maintenance.auctionet.dev/running; true",
"curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh | bash -s #{App.github_actions_runner_scope}",

# The script relies on running sudo but we've disabled root which means it will bring up a prompt to set a password. Running su will run it as the default user that can sudo and also reload the /etc/environment variables.
"su username -c 'curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh | bash -s #{App.github_actions_runner_scope}'",

"curl https://maintenance.auctionet.dev/it-ran; true",
"reboot",
],
Expand Down

0 comments on commit 669a778

Please sign in to comment.