Fetch CI jobs
Find a file
2024-11-07 12:36:48 +00:00
fetcher.py Test protobuf API 2024-11-07 12:26:40 +00:00
messages.proto Test protobuf API 2024-11-07 12:26:40 +00:00
messages_pb2.py Test protobuf API 2024-11-07 12:26:40 +00:00
README.md Update readme 2024-11-07 12:36:48 +00:00

Connect to a Forgejo instance to fetch jobs.

Protobuf file generated with:

protoc --python_out=. messages.proto

Requires: python3-protobuf and python3-requests

Check for tasks

Sometimes you need to check if a task is waiting, without actually pulling it. For example, if an underpowered agent wakes the powerful runner whenever it's needed.

Checking whether any new tasks are ready could be done stateless:

message CheckTaskRequest {
  int64 tasks_version = 1; // Runner use `tasks_version` to compare with Gitea and detemine whether new tasks may exist.
}

message CheckTaskResponse {
  int64 task = 1; // How many tasks are in the queue for this runner. The number doesn't need to be accurate; other compatible runners may pick up the same task before it gets chance to get fetched anyway. The number MUST be at least 1 when there is a nonzero number of waiting tasks.
  int64 tasks_version = 2; // Gitea informs the Runner of the latest version of tasks through `tasks_version`.
}

Copying

Do what you want with this code.