GitHub/Self-Hosted Runner: Difference between revisions

From Omnia
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 29: Line 29:
runs-on: self-hosted
runs-on: self-hosted
</pre>
</pre>
== Remove Runner ==
# // Remove the runner
./config.sh remove --token XXXXX


== Run as Root ==
== Run as Root ==

Latest revision as of 19:07, 22 July 2024

https://docs.github.com/github/automating-your-workflow-with-github-actions/hosting-your-own-runners

Download: (2.317.0 as of 2024.07.22)

# Create a folder
$ mkdir actions-runner && cd actions-runner
# Download the latest runner package
$ curl -o actions-runner-linux-x64-2.317.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-linux-x64-2.317.0.tar.gz
# Optional: Validate the hash
$ echo "9e883d210df8c6028aff475475a457d380353f9d01877d51cc01a17b2a91161d  actions-runner-linux-x64-2.317.0.tar.gz" | shasum -a 256 -c
# Extract the installer
$ tar xzf ./actions-runner-linux-x64-2.317.0.tar.gz

Configure:

# Create the runner and start the configuration experience
$ ./config.sh --url https://github.com/YOUR-ORG/YOUR-REPO --token XXXXXXX
# Last step, run it!
$ ./run.sh

Run in the background:

./run.sh &

Using your self-hosted runner

# Use this YAML in your workflow file for each job
runs-on: self-hosted

Remove Runner

# // Remove the runner
./config.sh remove --token XXXXX

Run as Root

./config.sh ...
Must not run with sudo

It is bad practice, but if you need, you can force it to allow to run as root:

export RUNNER_ALLOW_RUNASROOT=1