Skip to content

feat: add GitLab metadata processor#152

Merged
nodiscc merged 10 commits into
nodiscc:masterfrom
Rabenherz112:feat-gitlab-metadata
Mar 22, 2026
Merged

feat: add GitLab metadata processor#152
nodiscc merged 10 commits into
nodiscc:masterfrom
Rabenherz112:feat-gitlab-metadata

Conversation

@Rabenherz112

@Rabenherz112 Rabenherz112 commented Jan 8, 2026

Copy link
Copy Markdown
Contributor
  • Refactors github_metadata.py into software_metadata.py with support for GitHub and GitLab metadata providers
  • Updates documentation and tests
  • Fixes issue where invalid GitHub URLs were not being reported
    • This can cause errors for GitLab projects, which use a sub-groups and don't point to a repository
  • Fixes issue where GitHub repos that were forks did not get updated

Fixes #48
Fixes #148


Finally finished the second iteration after feedback from a friend that the first version was spaghetti code, which hopefully is now at least a bit better (also the reason why it took so long to fix this one issue, but at least I found another bug)...

The new invalid URL detection causes issues for GitLab projects using sub-groups.
GitHub URLs follow a strict org/repo format, so filtering out non-repository URLs is straightforward. GitLab supports sub-groups (org/subgroup/repo), making validation ambiguous.

I currently see two options:

  • Throw an error: Cause false positives for URLs pointing to sub-groups instead of repositories (basically meaning we can't allow such URLs)
  • Skip silently: Causes us to miss changes to repositories, leading to false data

I see only the first option as viable. This means the currently only invalid GitLab project nirvati-ug/nirvati needs to be updated to either a real repo or just point to the org before using this new version.

Output with Error catching (30 batch)
hecat --config .\tests\.hecat.update_metadata.yml                  
INFO:main.py: running step update_software_metadata
INFO:software_metadata.py: updating software data from GitHub and GitLab APIs
INFO:software_metadata.py: processing 1085 GitHub projects
INFO:software_metadata.py: processing GitHub batch 1/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 2/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 3/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 4/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
WARNING:software_metadata.py: GraphQL request failed with exception ChunkedEncodingError (attempt 2/3), waiting 10s
INFO:software_metadata.py: splitting batch into 2 smaller chunks (attempt 2)
INFO:software_metadata.py: processing GitHub batch 4a/37 (size: 15)
INFO:software_metadata.py: processing GitHub batch 4b/37 (size: 15)
INFO:software_metadata.py: processing GitHub batch 5/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 6/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 7/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 8/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 9/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 504 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 10/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 11/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 12/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 13/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 14/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 15/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 2/3), waiting 10s
INFO:software_metadata.py: splitting batch into 2 smaller chunks (attempt 2)
INFO:software_metadata.py: processing GitHub batch 15a/37 (size: 15)
INFO:software_metadata.py: processing GitHub batch 15b/37 (size: 15)
INFO:software_metadata.py: processing GitHub batch 16/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 17/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 18/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 2/3), waiting 10s
INFO:software_metadata.py: splitting batch into 2 smaller chunks (attempt 2)
INFO:software_metadata.py: processing GitHub batch 18a/37 (size: 15)
INFO:software_metadata.py: processing GitHub batch 18b/37 (size: 15)
INFO:software_metadata.py: processing GitHub batch 19/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 20/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 21/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 22/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 23/37 (size: 30)
ERROR:software_metadata.py: repository not found in search results: https://github.com/AirenSoft/OvenMediaEngine
INFO:software_metadata.py: processing GitHub batch 24/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 25/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 26/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 27/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 28/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 29/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 30/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 31/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 32/37 (size: 30)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
INFO:software_metadata.py: processing GitHub batch 33/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 34/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 35/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 36/37 (size: 30)
INFO:software_metadata.py: processing GitHub batch 37/37 (size: 5)
INFO:software_metadata.py: processing 28 GitLab projects
INFO:software_metadata.py: processing GitLab batch 1/3 (size: 10)
INFO:software_metadata.py: processing GitLab batch 2/3 (size: 10)
ERROR:software_metadata.py: repository not found in search results: https://gitlab.com/nirvati-ug/nirvati
INFO:software_metadata.py: processing GitLab batch 3/3 (size: 8)
ERROR:software_metadata.py: errors occurred during processing
repository not found in search results: https://github.com/AirenSoft/OvenMediaEngine
repository not found in search results: https://gitlab.com/nirvati-ug/nirvati
Output (25 batch)
INFO:main.py: running step update_software_metadata
INFO:software_metadata.py: updating software data from GitHub and GitLab APIs
INFO:software_metadata.py: processing 1085 GitHub projects
INFO:software_metadata.py: processing GitHub batch 1/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 2/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 3/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 4/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 5/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 6/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 7/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 8/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 9/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 10/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 11/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 12/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 13/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 14/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 15/44 (size: 25)
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 1/3), waiting 5s
WARNING:software_metadata.py: GraphQL request failed with status 502 (attempt 2/3), waiting 10s
INFO:software_metadata.py: splitting batch into 2 smaller chunks (attempt 2)
INFO:software_metadata.py: processing GitHub batch 15a/44 (size: 12)
INFO:software_metadata.py: processing GitHub batch 15b/44 (size: 13)
INFO:software_metadata.py: processing GitHub batch 16/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 17/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 18/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 19/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 20/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 21/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 22/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 23/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 24/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 25/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 26/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 27/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 28/44 (size: 25)
ERROR:software_metadata.py: repository not found in search results: https://github.com/AirenSoft/OvenMediaEngine
INFO:software_metadata.py: processing GitHub batch 29/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 30/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 31/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 32/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 33/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 34/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 35/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 36/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 37/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 38/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 39/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 40/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 41/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 42/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 43/44 (size: 25)
INFO:software_metadata.py: processing GitHub batch 44/44 (size: 10)
INFO:software_metadata.py: processing 28 GitLab projects
INFO:software_metadata.py: processing GitLab batch 1/3 (size: 10)
INFO:software_metadata.py: processing GitLab batch 2/3 (size: 10)
ERROR:software_metadata.py: repository not found in search results: https://gitlab.com/nirvati-ug/nirvati
INFO:software_metadata.py: processing GitLab batch 3/3 (size: 8)
ERROR:software_metadata.py: errors occurred during processing
repository not found in search results: https://github.com/AirenSoft/OvenMediaEngine
repository not found in search results: https://gitlab.com/nirvati-ug/nirvati

While running several tests, I noticed that reducing the batch size by just 5 repos produced much more stable output. This change also allowed me to decrease the wait time significantly; down to 5 seconds on my system. It would be interesting to see how this performs on other machines, as there appears to be a network-related factor at play.

- Refactor github_metadata.py to software_metadata.py with GitHub and GitLab support
    - Breaking: gh_metadata_only_missing module option is renamed to metadata_only_missing
    - GitLab does not support commit history (see nodiscc#48)
    - processor can now be relatively easily extended to support other GrahQL API based services
- Updated documentations where applicable
- Updated relevant tests

Fixes nodiscc#48
@nodiscc nodiscc self-requested a review January 8, 2026 20:34
@nodiscc nodiscc added the enhancement New feature or request label Jan 8, 2026
@nodiscc nodiscc added this to the 1.6.0 milestone Jan 8, 2026
@nodiscc nodiscc self-assigned this Jan 8, 2026
@Rabenherz112

This comment was marked as outdated.

@Rabenherz112 Rabenherz112 marked this pull request as draft January 13, 2026 16:09
@nodiscc nodiscc removed their request for review January 13, 2026 19:21
@nodiscc nodiscc removed their assignment Jan 13, 2026
- Fixes logic for missing repositories either not being found in search results or not being found in the API
- Fixes issue that repositories, which are forks, where not being processed by the API
- Clean up code in `software_metadata.py` to make it more readable and maintainable
- Updates default values for `batch_size_github` to `25` and `sleep_time` to `5`
Comment thread hecat/processors/software_metadata.py Outdated
Comment thread hecat/processors/software_metadata.py Outdated
- Removes `execpt Exception` for more specific exceptions
- Logs exception details for write software entry errors
- Replaces Datetime Arithmetic Operations with `calendar.monthrange`
@nodiscc nodiscc self-requested a review January 24, 2026 14:03
nodiscc added a commit to awesome-selfhosted/awesome-selfhosted-data that referenced this pull request Mar 11, 2026
Point to the backend repository URL instead of the gitlab project subgroup

- ref. nodiscc/hecat#152
@nodiscc

nodiscc commented Mar 11, 2026

Copy link
Copy Markdown
Owner

I updated the Nirvati source code URL awesome-selfhosted/awesome-selfhosted-data#2138

I still need to review the main change in this PR, will do.

Comment thread hecat/processors/software_metadata.py
Comment thread Makefile Outdated
Co-authored-by: nodiscc <nodiscc@gmail.com>

@nodiscc nodiscc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.
One thing to consider, who will provide the GITLAB_TOKEN for CI jobs that run on https://github.com/awesome-selfhosted/awesome-selfhosted-data?

Currently this is not a problem for the Github token, since Github actions issues an automatic token to all CI jobs, with minimal permissions and not tied to any user account. However for Gitlab I think one of us needs to provide an access token.

There is an old https://gitlab.com/awesome-selfhosted group (Github organization equivalent on Gitlab) which I had created a while ago. I'll check if it is possible to issue an access token on behalf of the group (with minimal access in case it is accidentally leaked by github actions)

@Rabenherz112

Copy link
Copy Markdown
Contributor Author

I'll check if it is possible to issue an access token on behalf of the group

This would be the best, otherwise I would say a dummy account would probably make the most sense.
Since the token would be added as action secret, any person with R/W perms on the repo can see this token (technically)

@nodiscc

nodiscc commented Mar 22, 2026

Copy link
Copy Markdown
Owner

Using a service account + access token in the gitlab group appears to work perfectly

export GITHUB_TOKEN=****
export GITLAB_TOKEN=****
$ make test_update_software_metadata
...
...
INFO:software_metadata.py: processing GitHub batch 6/6 (size: 10)
DEBUG:software_metadata.py: batch contents: ['wordpress/wordpress', 'josephernest/writing', 'yacy/yacy_search_server', 'totonyus/ydl_api_ng', 'nbr23/youtube-dl-server', 'zammad/zammad', 'zerok-rts/zero-k', 'zim-desktop-wiki/zim-desktop-wiki', 'znc/znc', 'pikvm/ustreamer']
DEBUG:connectionpool.py: Starting new HTTPS connection (1): api.github.com:443
DEBUG:connectionpool.py: https://api.github.com:443 "POST /graphql HTTP/1.1" 200 None
DEBUG:software_metadata.py: Rate limit (Limit/Remain/Used/Reset): 5000/4994/6/1774208075
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/wordpress.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/zammad.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/yacy.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/zim.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/znc.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/µstreamer.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/writing.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/zero-k.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/youtubedl-server.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/ydl_api_ng.yml
INFO:software_metadata.py: processing 27 GitLab projects
INFO:software_metadata.py: processing GitLab batch 1/3 (size: 10)
DEBUG:software_metadata.py: batch contents: ['baserow/baserow', 'famedly/conduit', 'crafty-controller/crafty-4', 'davical-project/davical', 'elixire/elixire', 'dacid99/eonvelope', 'fdroid/fdroidserver', 'fmd-foss/fmd-server', 'gitlab-org/gitlab-foss', 'glitchtip/glitchtip']
DEBUG:connectionpool.py: Starting new HTTPS connection (1): gitlab.com:443
DEBUG:connectionpool.py: https://gitlab.com:443 "POST /api/graphql HTTP/1.1" 200 None
DEBUG:software_metadata.py: Rate limit (Limit/Remain/Used/Reset): 2000/1999/1/1774204560
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/baserow.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/conduit.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/crafty-controller.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/davical.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/elixire.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/eonvelope.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/f-droid.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/fmd-server.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/gitlab.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/glitchtip.yml
DEBUG:software_metadata.py: sleeping 5s between batches
INFO:software_metadata.py: processing GitLab batch 2/3 (size: 10)
DEBUG:software_metadata.py: batch contents: ['nickbusey/homelabos', 'hook0/hook0', 'mailman/hyperkitty', 'jirafeau/jirafeau', 'lazylibrarian/lazylibrarian', 'ogarcia/lesma', 'mayan-edms/mayan-edms', 'cyber5k/mistborn', 'noosfero/noosfero', 'mailman/postorius']
DEBUG:connectionpool.py: Starting new HTTPS connection (1): gitlab.com:443
DEBUG:connectionpool.py: https://gitlab.com:443 "POST /api/graphql HTTP/1.1" 200 None
DEBUG:software_metadata.py: Rate limit (Limit/Remain/Used/Reset): 2000/1998/2/1774204560
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/homelabos.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/hook0.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/hyperkitty.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/jirafeau.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/lazylibrarian.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/lesma.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/mayan-edms.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/mistborn.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/noosfero.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/postorius.yml
DEBUG:software_metadata.py: sleeping 5s between batches
INFO:software_metadata.py: processing GitLab batch 3/3 (size: 7)
DEBUG:software_metadata.py: batch contents: ['francoisjacquet/rosariosis', 'timvisee/send', 'simple-nixos-mailserver/nixos-mailserver', 'biolds1/sosse', 'tikiwiki/tiki', 'veloren/veloren', 'web-db/app']
DEBUG:connectionpool.py: Starting new HTTPS connection (1): gitlab.com:443
DEBUG:connectionpool.py: https://gitlab.com:443 "POST /api/graphql HTTP/1.1" 200 None
DEBUG:software_metadata.py: Rate limit (Limit/Remain/Used/Reset): 2000/1997/3/1774204560
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/rosariosis.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/send.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/simple-nixos-mailserver.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/sosse.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/tiki.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/veloren.yml
DEBUG:software_metadata.py: Writing file tests/awesome-selfhosted-data/software/webdb.yml
INFO:main.py: all steps completed
# $ cat tests/awesome-selfhosted-data/software/jirafeau.yml
name: Jirafeau
website_url: https://gitlab.com/jirafeau/Jirafeau
source_code_url: https://gitlab.com/jirafeau/Jirafeau
description: One-click-fileshare project. Select your file, upload, and share a link. That's it.
licenses:
  - AGPL-3.0
platforms:
  - PHP
  - Docker
tags:
  - File Transfer - Single-click & Drag-n-drop Upload
stargazers_count: 29
updated_at: '2026-01-25'
archived: false

Added to awesome-selfhosted-data environment secrets:

I will now merge this and create a new release + bump the hecat version in awesome-selfhosted-data

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

processors/github_metadata: sometimes fails with ChunkedEncodingError processors/github_metadata: add support for gitlab metadata/API queries

2 participants