runner configuration without prompt

Hello,

When we configure a runner, he asks for the name of the runner and the workdir forlder.

Is it possible to configure a runner automaticly ?

Example : 

./config.sh --url https://github.com/toto/toto --token ALKSADLKASD:LAKSJDLSKAJLKJDSA --name linux --workdir /opt

Thanks

You can try the following command lines, when you install an self-hosted runner, enter the correct values of the parameters into the command lines.

And then just execute the command lines once, It will automatically complete to download package, extract package, and install runner according to the given parameters.

On Windows:

Invoke-WebRequest -Uri https://githubassets.azureedge.net/runners/2.161.0/actions-runner-win-x64-2.161.0.zip -OutFile actions-runner-win-x64-2.161.0.zip; Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.161.0.zip", "$PWD"); ./config.cmd --url <repo_url> --token <PAT> --agent <runner_name> --work <work_dir> --runasservice

On Linux:

curl -O https://githubassets.azureedge.net/runners/2.161.0/actions-runner-linux-x64-2.161.0.tar.gz; tar xzf ./actions-runner-linux-x64-2.161.0.tar.gz; ./config.sh --url <repo_url> --token <PAT> --agent <runner_name> --work <work_dir> --runasservice

On macOS:

curl -O https://githubassets.azureedge.net/runners/2.161.0/actions-runner-osx-x64-2.161.0.tar.gz; tar xzf ./actions-runner-osx-x64-2.161.0.tar.gz; ./config.sh --url <repo_url> --token <PAT> --agent <runner_name> --work <work_dir> --runasservice
3 Likes

Thanks, it’s very helpful

–agent seems to have been replaced --name

1 Like

If you already have config.sh it takes the argument --help which outputs:

[root@myrunner github-runner]$ ./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

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 myrunner)
 --runnergroup string   Name of the runner group to add this runner to (defaults to the default runner group)
 --labels string        Extra labels in addition to the default: 'self-hosted,Linux,X64'
 --work string          Relative runner work directory (default _work)
 --replace              Replace any existing runner with the same name (default false)

Examples:
 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

Version: 2.273.2

HTH