GitHub/Actions Runner

From Omnia
Jump to navigation Jump to search

Actions Runner

https://github.com/actions/runner

Releases

https://github.com/actions/runner/releases

Get Latest Version

curl -i https://github.com/actions/runner/releases/latest | grep location:
 location: https://github.com/actions/runner/releases/tag/v2.309.0

get_gha_latest.sh:

LATEST=`curl -s -i https://github.com/actions/runner/releases/latest | grep location:`
LATEST=`echo $LATEST | sed 's#.*tag/v##'`
LATEST=`echo $LATEST | sed 's/\r//'`
curl -L -s "https://github.com/actions/runner/releases/download/v${LATEST}/actions-runner-linux-x64-${LATEST}.tar.gz" -o actions-runner-linux-x64-${LATEST}.tar.gz

---

 https://github.com/actions/runner/releases/latest/download/actions-runner-linux-x64-.tar.gz

ref: https://github.com/orgs/community/discussions/54078

Get Running Version

Preferred option:

$ ./config.sh --version
2.283.1

Also works, but problably shouldn't mess with run.sh:

$ ./run.sh --version
2.283.1


Ref: [1]

Linux

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

Downloads

ref: https://github.com/actions/runner/releases

Windows x64

# Create a folder under the drive root
mkdir \actions-runner ; cd \actions-runner
# Download the latest runner package
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.309.0/actions-runner-win-x64-2.309.0.zip -OutFile actions-runner-win-x64-2.309.0.zip
# Extract the installer
Add-Type -AssemblyName System.IO.Compression.FileSystem ;
[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD\actions-runner-win-x64-2.309.0.zip", "$PWD")

Linux x64

# Create a folder
mkdir actions-runner && cd actions-runner
# Download the latest runner package
curl -O -L https://github.com/actions/runner/releases/download/v2.309.0/actions-runner-linux-x64-2.309.0.tar.gz
# Extract the installer
tar xzf ./actions-runner-linux-x64-2.309.0.tar.gz

Linux arm64

Such as Raspberry Pi using 64bit version of OS

# Create a folder
mkdir actions-runner && cd actions-runner
# Download the latest runner package
curl -O -L https://github.com/actions/runner/releases/download/v2.309.0/actions-runner-linux-arm64-2.309.0.tar.gz
# Extract the installer
tar xzf ./actions-runner-linux-arm64-2.309.0.tar.gz

Linux arm

Such as Raspberry Pi using standard version of OS:

# Create a folder
mkdir actions-runner && cd actions-runner
# Download the latest runner package
curl -O -L https://github.com/actions/runner/releases/download/v2.309.0/actions-runner-linux-arm-2.309.0.tar.gz
# Extract the installer
tar xzf ./actions-runner-linux-arm-2.309.0.tar.gz

Configure

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

Configure Help

# ./config.sh --help

Commands:
 ./config.sh         Configures the runner
 ./config.sh remove  Unconfigures the runner
 ./run.sh            Runs the runner interactively. Does not require any options.

Options:
 --help     Prints the help for each command
 --version  Prints the runner version
 --commit   Prints the runner commit
 --check    Check the runner's network connectivity with GitHub server

Config Options:
 --unattended           Disable interactive prompts for missing arguments. Defaults will be used for missing options
 --url string           Repository to add the runner to. Required if unattended
 --token string         Registration token. Required if unattended
 --name string          Name of the runner to configure (default lmt-store)
 --runnergroup string   Name of the runner group to add this runner to (defaults to the default runner group)
 --labels string        Custom labels that will be added to the runner. This option is mandatory if --no-default-labels is used.
 --no-default-labels    Disables adding the default labels: 'self-hosted,Linux,X64'
 --local                Removes the runner config files from your local machine. Used as an option to the remove command
 --work string          Relative runner work directory (default _work)
 --replace              Replace any existing runner with the same name (default false)
 --pat                  GitHub personal access token with repo scope. Used for checking network connectivity when executing `./run.sh --check`
 --disableupdate        Disable self-hosted runner automatic update to the latest released version`
 --ephemeral            Configure the runner to only take one job and then let the service un-configure the runner after the job finishes (default false)

Examples:
 Check GitHub server network connectivity:
  ./run.sh --check --url <url> --pat <pat>
 Configure a runner non-interactively:
  ./config.sh --unattended --url <url> --token <token>
 Configure a runner non-interactively, replacing any existing runner with the same name:
  ./config.sh --unattended --url <url> --token <token> --replace [--name <name>]
 Configure a runner non-interactively with three extra labels:
  ./config.sh --unattended --url <url> --token <token> --labels L1,L2,L3

Debug

To enable runner diagnostic logging, set the following secret or variable in the repository that contains the workflow: ACTIONS_RUNNER_DEBUG to true

ACTIONS_RUNNER_DEBUG = true

---

To enable step debug logging, set the following secret or variable in the repository that contains the workflow: ACTIONS_STEP_DEBUG to true. If both the secret and variable are set, the value of the secret takes precedence over the variable.

ACTIONS_STEP_DEBUG = true

---

Enabling debug logging - GitHub Docs
https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging

Running as Service

For Linux systems that use systemd, you can use the svc.sh script that is created after successfully adding the runner to install and manage using the application as a service.

To install service:

sudo ./svc.sh install

To install service as a differnt user:

./svc.sh install USERNAME

Start service:

sudo ./svc.sh start

Service status:

sudo ./svc.sh status

Stop service:

sudo ./svc.sh stop

Uninstall service:

sudo ./svc.sh uninstall
Configuring the self-hosted runner application as a service - GitHub Docs
https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service

keywords