terraform-aws-github-runner icon indicating copy to clipboard operation
terraform-aws-github-runner copied to clipboard

Windows: Invalid configuration provided for url

Open guicaulada opened this issue 1 year ago • 12 comments

On version 5.6.2, when using Windows runners with the default user data and start runner script the runner is not running any jobs, when investigating I noticed the UserData.log shows:

Configure GH Runner as user ec2-user
.\config.cmd : Invalid configuration provided for url. Terminating unattended configuration.
At line:1 char:1
+ .\config.cmd --unattended --name windows-x64_i-0c96a1237c96979a5 --wo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Invalid configu... configuration.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

The runner shows up on GitHub, but it says it's offline.

guicaulada avatar Jan 24 '24 21:01 guicaulada

Apparently Windows doesn't support JIT config?

Setting enable_jit_config: false solved the issue for me.

guicaulada avatar Jan 30 '24 00:01 guicaulada

Windows should support JIT as well. But I am not sure if the open source start script support this. @GuptaNavdeep1983 Can you make a comment?

npalm avatar Feb 12 '24 13:02 npalm

I believer either the start script is not sending the correct arguments to config.cmd or the issue is on config.cmd itself and this could be moved to https://github.com/actions/runner

guicaulada avatar Feb 12 '24 21:02 guicaulada

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 14 '24 01:03 github-actions[bot]

@guicaulada, JIT is supported on Windows as well. Can you please create a PR to update the default start script to support this?

GuptaNavdeep1983 avatar Mar 14 '24 22:03 GuptaNavdeep1983

@GuptaNavdeep1983 sorry, but I'm not sure what needs to be changed on the default start script for JIT to work correctly, it seems the arguments are passed correctly the same way it would on Linux but results in: .\config.cmd : Invalid configuration provided for url. Terminating unattended configuration.

guicaulada avatar Mar 14 '24 23:03 guicaulada

facing the same issue here. The url seems to be empty in our case:


[2024-03-21 15:06:59Z INFO CommandSettings] Arg 'url': ''

shubhamsinha-sf avatar Mar 21 '24 16:03 shubhamsinha-sf

Here's the help I found on the config.cmd:

.\config.cmd --help

Commands:
 .\config.cmd         Configures the runner
 .\config.cmd remove  Unconfigures the runner
 .\run.cmd            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 )
 --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,Windows,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.cmd --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)
 --runasservice   Run the runner as a service
 --windowslogonaccount string   Account to run the service as. Requires runasservice
 --windowslogonpassword string  Password for the service account. Requires runasservice

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

It would seem that here https://github.com/philips-labs/terraform-aws-github-runner/blob/b2dc794f08c932470dae846dad0e0a5f33a68cc4/modules/runners/templates/start-runner.ps1#L110 there is no --url arg on the command that might be the cause of this error. I believe we need another ssm parameter containing the github URL for our repo/org, read that in, and point the .\config.cmd at it.

rfsmart-bcleary avatar Mar 22 '24 16:03 rfsmart-bcleary

@GuptaNavdeep1983 or @npalm any thoughts on this issue? I forked this, made the changes and our forked version is working. We'd love to see this make it back upstream.

rfsmart-bcleary avatar Apr 09 '24 12:04 rfsmart-bcleary

Can you make a PR based on your fork?

npalm avatar Apr 09 '24 13:04 npalm

@npalm I've created a PR, my fork is a little behind main, do you prefer I commit merge, or rebase?

rfsmart-bcleary avatar Apr 10 '24 12:04 rfsmart-bcleary

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 11 '24 01:05 github-actions[bot]