ansible-github_actions_runner icon indicating copy to clipboard operation
ansible-github_actions_runner copied to clipboard

bug: fail to identify enrolled runners when count > 30

Open dotkrnl opened this issue 5 months ago • 0 comments

Summary

  • By default per_page parameter of actions/runners API is 30.
  • During Check currently registered runners for repo (RUN ONCE), actions/runners API is used.
  • Only the first 30 runners are returned.
  • During Register runner, the runners after 30th are attempted to be registered again.
  • It fails as the runners are already configured.

Potential solution:

  • It provides "link": "<https://api.github.com/organizations/[redacted]/actions/runners?page=2>; rel=\"next\", <https://api.github.com/organizations/[redacted]/actions/runners?page=2>; rel=\"last\"",.
  • This link can be followed to obtain all runners.

Issue Type

Bug Report

Ansible Version

ansible [core 2.16.3]
  config file = /home/dotkrnl/Workspace/ansible-playbooks/ansible.cfg
  configured module search path = ['/home/dotkrnl/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/dotkrnl/.cache/pypoetry/virtualenvs/rapidstream-ansible-playbooks-Mp6hNgc9-py3.10/lib/python3.10/site-packages/ansible
  ansible collection location = /home/dotkrnl/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/dotkrnl/.cache/pypoetry/virtualenvs/rapidstream-ansible-playbooks-Mp6hNgc9-py3.10/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/home/dotkrnl/.cache/pypoetry/virtualenvs/rapidstream-ansible-playbooks-Mp6hNgc9-py3.10/bin/python)
  jinja version = 3.1.3
  libyaml = True

Steps to Reproduce

- name: Install GitHub actions runner
  ansible.builtin.include_role:
    name: monolithprojects.github_actions_runner

Expected Results

skipping: [XXX] => {
    "changed": false,
    "false_condition": "runner_name not in registered_runners.json.runners|map(attribute='name')|list",
    "skip_reason": "Conditional result was False"
}

where XXX is a registered runner ranked after 30th.

Actual Results

fatal: [[redacted]]: FAILED! => {
    "changed": true,
    "cmd": [
        "/opt/actions-runner/./config.sh",
        "--url",
        "https://github.com/[redacted]",
        "--token",
        "[redacted]",
        "--name",
        "[redacted]",
        "--labels",
        "--runnergroup",
        "--unattended"
    ],
    "delta": "[redacted]",
    "end": "[redacted]",
    "invocation": {
        "module_args": {
            "_raw_params": "/opt/actions-runner/./config.sh --url [redacted] --token [redacted] --name [redacted] --labels  --runnergroup  --unattended ",
            "_uses_shell": false,
            "argv": null,
            "chdir": "/opt/actions-runner",
            "creates": null,
            "executable": null,
            "expand_argument_vars": true,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "[redacted]",
    "stderr": "Cannot configure the runner because it is already configured. To reconfigure the runner, run 'config.cmd remove' or './config.sh remove' first.",
    "stderr_lines": [
        "Cannot configure the runner because it is already configured. To reconfigure the runner, run 'config.cmd remove' or './config.sh remove' first."
    ],
    "stdout": "\n--------------------------------------------------------------------------------\n|        ____ _ _   _   _       _          _        _   _                      |\n|       / ___(_) |_| | | |_   _| |__      / \\   ___| |_(_) ___  _ __  ___      |\n|      | |  _| | __| |_| | | | | '_ \\    / _ \\ / __| __| |/ _ \\| '_ \\/ __|     |\n|      | |_| | | |_|  _  | |_| | |_) |  / ___ \\ (__| |_| | (_) | | | \\__ \\     |\n|       \\____|_|\\__|_| |_|\\__,_|_.__/  /_/   \\_\\___|\\__|_|\\___/|_| |_|___/     |\n|                                                                              |\n|                       Self-hosted runner registration                        |\n|                                                                              |\n--------------------------------------------------------------------------------",
    "stdout_lines": [
        "",
        "--------------------------------------------------------------------------------",
        "|        ____ _ _   _   _       _          _        _   _                      |",
        "|       / ___(_) |_| | | |_   _| |__      / \\   ___| |_(_) ___  _ __  ___      |",
        "|      | |  _| | __| |_| | | | | '_ \\    / _ \\ / __| __| |/ _ \\| '_ \\/ __|     |",
        "|      | |_| | | |_|  _  | |_| | |_) |  / ___ \\ (__| |_| | (_) | | | \\__ \\     |",
        "|       \\____|_|\\__|_| |_|\\__,_|_.__/  /_/   \\_\\___|\\__|_|\\___/|_| |_|___/     |",
        "|                                                                              |",
        "|                       Self-hosted runner registration                        |",
        "|                                                                              |",
        "--------------------------------------------------------------------------------"
    ]
}

dotkrnl avatar Mar 13 '24 17:03 dotkrnl