Skip to content

add-forge-now: Allow scheduling of cgit task type

With the following adaptation, i'm able to schedule cgit instance [1] which otherwise would fail [2]

Refs. swh/infra/sysadm-environment#4813 (closed)

[1] (patched scheduler on staging)

swhscheduler@scheduler0:~$ swh scheduler --config-file $CONFIG \
>   add-forge-now --preset staging \
>   register-lister $LISTER_NAME \
>       url=$FORGE_URL

Created 1 tasks

Task 33420816
  Next run: tomorrow (2023-03-22T10:59:58.595818+00:00)
  Interval: 1 day, 0:00:00
  Type: list-cgit
  Policy: oneshot
  Args:
  Keyword args:
    enable_origins: False
    max_origins_per_page: 10
    max_pages: 3
    url: 'https://source.codeaurora.org/'

[2]

swhscheduler@scheduler0:~$ swh scheduler --url $SCHEDULER_RPC \
>   add-forge-now --preset staging \
>   register-lister $LISTER_NAME \
>       url=$FORGE_URL
Traceback (most recent call last):
  File "/usr/bin/swh", line 33, in <module>
    sys.exit(load_entry_point('swh.core==2.21.2', 'console_scripts', 'swh')())
  File "/usr/lib/python3/dist-packages/swh/core/cli/__init__.py", line 144, in main
    return swh(auto_envvar_prefix="SWH")
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/swh/scheduler/cli/add_forge_now.py", line 78, in register_lister_cli
    raise ValueError(f"Unknown lister type {lister_name}.")
ValueError: Unknown lister type cgit.

cc @teams/developers @teams/sysadmin @vlorentz

Merge request reports