Support S3 remote storage and better container cleanup#1600
Merged
aparcar merged 9 commits intoopenwrt:mainfrom Apr 13, 2026
Merged
Support S3 remote storage and better container cleanup#1600aparcar merged 9 commits intoopenwrt:mainfrom
aparcar merged 9 commits intoopenwrt:mainfrom
Conversation
Add [build-system] table so the package is properly installable with uv sync. Add boto3 for S3-compatible storage support.
Add store abstraction layer with LocalStore and S3Store backends. Workers can upload built images to S3-compatible storage (AWS S3, Cloudflare R2, MinIO) instead of requiring a shared filesystem. The /store/ endpoint serves files locally or redirects to the S3 public URL via 302 depending on the configured backend.
d4cf07c to
c297e50
Compare
- Wrap container lifecycle in try/finally to ensure cleanup on all error paths (previously leaked running containers on report_error) - Use container.remove(v=True, force=True) instead of auto_remove to also clean up anonymous volumes
- Replace manual tempfile.mkdtemp with pytest tmp_path fixture to prevent leftover test directories on failures - Force store_backend=local in test fixture - Add unit tests for LocalStore (upload_file, upload_dir, exists, get_url)
Store firmware builds for longer, 7d for builds including package versions, 1d for firmware without specific versions. Signed-off-by: Paul Spooren <mail@aparcar.org>
Move to stats page and add package statistics Signed-off-by: Paul Spooren <mail@aparcar.org>
Workers read S3 credentials from their own .env and upload directly. No shared filesystem required — only needs Redis and Podman socket.
Signed-off-by: Paul Spooren <mail@aparcar.org>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1600 +/- ##
==========================================
+ Coverage 80.75% 90.01% +9.25%
==========================================
Files 15 18 +3
Lines 977 1982 +1005
==========================================
+ Hits 789 1784 +995
- Misses 188 198 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to the build process, storage backend flexibility, and statistics reporting in the project. The main highlights are a switch from bind mounts to in-memory file injection for container builds, the addition of S3-compatible storage support, and new API/statistics endpoints for monitoring usage and package popularity. Several configuration options and TTL defaults have also been updated for better operational control.
Build process improvements:
put_archive, improving portability and security. This affects how repository keys, repositories, and default files are injected for builds (asu/build.py). [1] [2]_cleanup_containerutility to ensure containers are always killed and removed, even on errors, reducing resource leaks (asu/build.py). [1] [2]asu/build.py).Storage backend enhancements:
asu/build.py,asu/config.py,asu/main.py). [1] [2] [3]/store/{path}endpoint now redirects to an S3 URL if S3 is used, or serves files directly if using local storage (asu/main.py).Statistics and API improvements:
/stats/summaryand/top-packagesAPI endpoints to provide build statistics and most requested packages, with optional branch filtering (asu/routers/stats.py). [1] [2]/statsHTML endpoint for a statistics page, and updates how build TTLs are selected based on request type (asu/main.py,asu/routers/api.py). [1] [2]Configuration and defaults:
asu/config.py).Documentation and minor fixes:
README.md(README.md).asu/static/style.css).