Skip to content

Support S3 remote storage and better container cleanup#1600

Merged
aparcar merged 9 commits intoopenwrt:mainfrom
aparcar:s3-v2
Apr 13, 2026
Merged

Support S3 remote storage and better container cleanup#1600
aparcar merged 9 commits intoopenwrt:mainfrom
aparcar:s3-v2

Conversation

@aparcar
Copy link
Copy Markdown
Member

@aparcar aparcar commented Apr 5, 2026

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:

  • Replaces bind mounts with direct file injection into containers using in-memory tar archives via put_archive, improving portability and security. This affects how repository keys, repositories, and default files are injected for builds (asu/build.py). [1] [2]
  • Adds a _cleanup_container utility to ensure containers are always killed and removed, even on errors, reducing resource leaks (asu/build.py). [1] [2]
  • Refines build command construction and ensures correct handling of custom rootfs size and defaults (asu/build.py).

Storage backend enhancements:

  • Introduces support for S3-compatible storage backends, configurable via new settings. The build output is uploaded to the configured backend, and local build artifacts are cleaned up if not using local storage (asu/build.py, asu/config.py, asu/main.py). [1] [2] [3]
  • The /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:

  • Adds /stats/summary and /top-packages API endpoints to provide build statistics and most requested packages, with optional branch filtering (asu/routers/stats.py). [1] [2]
  • Adds a /stats HTML 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:

  • Updates several TTL and retention defaults for builds, failures, and unversioned builds for improved cache management (asu/config.py).

Documentation and minor fixes:

  • Adds instructions for running Redis via Podman in the README.md (README.md).
  • Minor CSS selector fix for header logo (asu/static/style.css).

aparcar added 2 commits March 29, 2026 23:09
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.
@aparcar aparcar force-pushed the s3-v2 branch 3 times, most recently from d4cf07c to c297e50 Compare April 7, 2026 00:15
aparcar added 6 commits April 8, 2026 11:18
- 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>
@aparcar aparcar changed the title S3 v2 Support S3 remote storage and better container cleanup Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 76.94611% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.01%. Comparing base (5e65dec) to head (709480c).
⚠️ Report is 359 commits behind head on main.

Files with missing lines Patch % Lines
asu/store.py 57.81% 27 Missing ⚠️
asu/routers/stats.py 16.66% 25 Missing ⚠️
asu/build.py 77.66% 23 Missing ⚠️
asu/main.py 83.33% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aparcar aparcar merged commit fd58efc into openwrt:main Apr 13, 2026
4 of 5 checks passed
@aparcar aparcar deleted the s3-v2 branch April 13, 2026 10:02
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.

1 participant