Skip to content

nightswatcher: rewrite to monitor GitHub instead - #186

Merged
Frenzie merged 6 commits into
koreader:masterfrom
benoit-pierre:pr/nightswatcher_watches_github
Oct 3, 2026
Merged

Frenzie merged 6 commits into
koreader:masterfrom
benoit-pierre:pr/nightswatcher_watches_github

Conversation

@benoit-pierre

@benoit-pierre benoit-pierre commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Through a repository webhook for release events.

NOTE: the new code will create a .sha256 extra file for each asset.


This change is Reviewable

Use Ubuntu version name, rather than confusing codename.
Add missing `packaging` dependency:
```
▸ make nightswatcher/test
2026-10-02 00:45:03+02:00 ▹ m nightswatcher/test
[2026-10-01 22:45:04 +0000] [1] [INFO] Starting gunicorn 26.2.0
[2026-10-01 22:45:04 +0000] [1] [INFO] Listening at: http://0.0.0.0:9742 (1)
[2026-10-01 22:45:04 +0000] [1] [INFO] Using worker: gevent
[2026-10-01 22:45:04 +0000] [7] [INFO] Booting worker with pid: 7
[2026-10-01 22:45:04 +0000] [1] [INFO] Control socket listening at /root/.gunicorn/gunicorn.ctl
[2026-10-01 22:45:04 +0000] [7] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/arbiter.py", line 753, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/workers/ggevent.py", line 143, in init_process
    super().init_process()
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/workers/base.py", line 137, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/workers/base.py", line 149, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/app/base.py", line 66, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/app/wsgiapp.py", line 57, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.10/dist-packages/gunicorn/util.py", line 420, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/nightswatcher/nightswatcher.py", line 495, in <module>
    testing()
  File "/nightswatcher/nightswatcher.py", line 474, in testing
    raise ValueError(f'bad version string: {version}')
ValueError: bad version string: req_body
bad version string: req_body
[2026-10-01 22:45:04 +0000] [7] [INFO] Worker exiting (pid: 7)
2026-10-01 22:45:04,288 root INFO     Fetch build worker waiting for new builds....
[2026-10-01 22:45:04 +0000] [1] [ERROR] Worker (pid:7) exited with code 3.
[2026-10-01 22:45:04 +0000] [1] [ERROR] Shutting down: Master
[2026-10-01 22:45:04 +0000] [1] [ERROR] Reason: Worker failed to boot.
make: *** [nightswatcher/settings.mk:31: nightswatcher/test] Error 3
```
Use gunicorn `--reload` option so changes to `nightswatcher/nightswatcher.py` automatically trigger a reload.
Through a repository webhook for release events.
@Frenzie
Frenzie merged commit 951f4da into koreader:master Oct 3, 2026
5 checks passed
@Frenzie

Frenzie commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Probably not an issue since it's just some GH test payload, but it sounds a bit weird since it's still JSON.

172.25.0.4 - - [03/Oct/2026:19:00:53 +0000] "POST /webhooks/github HTTP/1.0" 500 38 "-" "GitHub-Hookshot/dc31675"
2026-10-03 19:00:53 [FALCON] [ERROR] POST /webhooks/github => Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/falcon/app.py", line 481, in __call__
    responder(req, resp, **params)
  File "/nightswatcher/nightswatcher.py", line 291, in on_post
    data = json.loads(body)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@benoit-pierre

Copy link
Copy Markdown
Member Author

What's the exact payload?

@benoit-pierre
benoit-pierre deleted the pr/nightswatcher_watches_github branch October 3, 2026 19:08
@benoit-pierre

benoit-pierre commented Oct 3, 2026 •

Copy link
Copy Markdown
Member Author

If its the webhook you just added (https://build.koreader.rocks/webhooks/github), Content-Type: application/x-www-form-urlencoded is the issue, no?

@benoit-pierre

Copy link
Copy Markdown
Member Author

By the way, can the Gitlab and CodeCov hooks be removed?

Additionally, on this repository, what about the Docker and Travis hooks?

@Frenzie

Frenzie commented Oct 3, 2026

Copy link
Copy Markdown
Member

If its the webhook you just added (https://build.koreader.rocks/webhooks/github), Content-Type: application/x-www-form-urlencoded is the issue, no?

GitHub apparently decided it needed defaults that are different than other comparable platforms.

By the way, can the Gitlab and CodeCov hooks be removed?

Yes.

Additionally, on this repository, what about the Docker and Travis hooks?

The Docker one was good at the time but I think it stopped working because you need premium (or whatever they call it) for that now.

@Frenzie

Frenzie commented Oct 3, 2026

Copy link
Copy Markdown
Member

And if Travis is still here I simply overlooked it.

@Frenzie

Frenzie commented Oct 4, 2026

Copy link
Copy Markdown
Member

The lack of read permissions issue seems to have returned.

-rw------- 1 32875536 Oct  4 03:27 koreader-remarkable-v2026.07.2-217-gb44e9b7_2026-10-03.tar.xz
-rw-r--r-- 1       77 Oct  4 03:27 koreader-remarkable-v2026.07.2-217-gb44e9b7_2026-10-03.tar.xz.sha256
-rw------- 1 40915263 Oct  4 03:27 koreader-remarkable-v2026.07.2-217-gb44e9b7_2026-10-03.targz
-rw-r--r-- 1       77 Oct  4 03:27 koreader-remarkable-v2026.07.2-217-gb44e9b7_2026-10-03.targz.sha256
-rw------- 1 40394960 Oct  4 03:27 koreader-v2026.07.2-217-gb44e9b7_2026-10-03-aarch64.AppImage
-rw-r--r-- 1       77 Oct  4 03:27 koreader-v2026.07.2-217-gb44e9b7_2026-10-03-aarch64.AppImage.sha256
-rw------- 1 38612616 Oct  4 03:27 koreader-v2026.07.2-217-gb44e9b7_2026-10-03-armhf.AppImage
-rw-r--r-- 1       77 Oct  4 03:27 koreader-v2026.07.2-217-gb44e9b7_2026-10-03-armhf.AppImage.sha256
-rw------- 1 40386872 Oct  4 03:27 koreader-v2026.07.2-217-gb44e9b7_2026-10-03-x86_64.AppImage
-rw-r--r-- 1       77 Oct  4 03:27 koreader-v2026.07.2-217-gb44e9b7_2026-10-03-x86_64.AppImage.sha256
-rw------- 1 29969604 Oct  4 03:27 koreader_2026.07.2-217-gb44e9b7-1_amd64.deb
-rw-r--r-- 1       77 Oct  4 03:27 koreader_2026.07.2-217-gb44e9b7-1_amd64.deb.sha256
-rw------- 1 29106908 Oct  4 03:27 koreader_2026.07.2-217-gb44e9b7-1_arm64.deb
-rw-r--r-- 1       77 Oct  4 03:27 koreader_2026.07.2-217-gb44e9b7-1_arm64.deb.sha256
-rw------- 1 28494708 Oct  4 03:27 koreader_2026.07.2-217-gb44e9b7-1_armhf.deb
-rw-r--r-- 1       77 Oct  4 03:27 koreader_2026.07.2-217-gb44e9b7-1_armhf.deb.sha256

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants