preview sync.sh: overlapping runs leave a directory that stops every later run #15

Closed
opened 2026-10-12 11:28:35 +09:00 by bot-genji1024 · 2 comments
Collaborator

Problem

Running docs/preview/sync.sh by hand while the timer's run was in progress broke every later run:

rm: cannot remove 'data/.incoming/pr-14.zip': Is a directory

The second run's cleanup (rm -f data/.incoming/*) deleted the archive the first run was about to unpack; the first run then started the unpack container with -v .../pr-14.zip:/in.zip, and Docker creates a missing bind-mount source as a directory. From then on the cleanup fails on that directory and set -e stops every run, so no preview updates (PR #14's never appeared).

Plan

  • Take a lock (flock -n on data/.lock): a second run while one is going exits quietly.
  • Mount data/.incoming read-only at /in in the unpack container and pass the archive's name in ZIP, instead of bind-mounting the file, so nothing can create a directory in its place.
  • Clean up with rm -rf data/.incoming and recreate it, so anything odd left there is gone on the next run.
  • README: running ./sync.sh by hand next to the timer is safe.
## Problem Running `docs/preview/sync.sh` by hand while the timer's run was in progress broke every later run: ``` rm: cannot remove 'data/.incoming/pr-14.zip': Is a directory ``` The second run's cleanup (`rm -f data/.incoming/*`) deleted the archive the first run was about to unpack; the first run then started the unpack container with `-v .../pr-14.zip:/in.zip`, and Docker creates a missing bind-mount source as a directory. From then on the cleanup fails on that directory and `set -e` stops every run, so no preview updates (PR #14's never appeared). ## Plan - Take a lock (`flock -n` on `data/.lock`): a second run while one is going exits quietly. - Mount `data/.incoming` read-only at `/in` in the unpack container and pass the archive's name in `ZIP`, instead of bind-mounting the file, so nothing can create a directory in its place. - Clean up with `rm -rf data/.incoming` and recreate it, so anything odd left there is gone on the next run. - README: running `./sync.sh` by hand next to the timer is safe.
Author
Collaborator

Also in #16: the previews shared one Traefik router (Host(a) || Host(b)), so each certificate named every preview and a pull request opening or closing re-issued all of them. They now get one router, and one certificate, each.

Also in #16: the previews shared one Traefik router (`Host(a) || Host(b)`), so each certificate named every preview and a pull request opening or closing re-issued all of them. They now get one router, and one certificate, each.
Author
Collaborator

Also in #16: previews never followed pushes to an open pull request (the runs query filtered on event=pull_request, which Forgejo does not match for runs after a push), so each kept its first build.

Also in #16: previews never followed pushes to an open pull request (the runs query filtered on `event=pull_request`, which Forgejo does not match for runs after a push), so each kept its first build.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
genji1024/koto#15
No description provided.