Skip to content

ci: weekly scheduled container rebuild for fresh base layers#1374

Open
pjordanandrsn wants to merge 1 commit intomatter-js:mainfrom
pjordanandrsn:weekly-rebuild-container
Open

ci: weekly scheduled container rebuild for fresh base layers#1374
pjordanandrsn wants to merge 1 commit intomatter-js:mainfrom
pjordanandrsn:weekly-rebuild-container

Conversation

@pjordanandrsn
Copy link
Copy Markdown

Motivation

The ghcr.io/home-assistant-libs/python-matter-server container is built and published only on release: published (via release.yml's build-and-push-container-image job). Between releases, the python:3.12-slim-bookworm base accumulates security fixes that aren't picked up — the :stable tag drifts behind on OS-package CVEs.

Latest published image scanned with trivy on 2026-05-02:

Severity Count
CRITICAL 6
HIGH 23

All findings are in OS packages (libssl/libxml2/etc) shipped by the slim-bookworm base. Rebuilding the existing Dockerfile against current python:3.12-slim-bookworm reduces these to 0 HIGH/CRITICAL without any source change.

Change

Adds a new workflow .github/workflows/rebuild-container.yml that:

  1. Triggers weekly (Sun 04:00 UTC) and on workflow_dispatch
  2. Looks up the latest published python-matter-server version from PyPI (matches what release.yml does, just from a different signal)
  3. Rebuilds with pull: true (forces fresh base) using the existing Dockerfile
  4. Re-tags :stable (and :major.minor.patch / :minor / :major) — exactly the same set of tags release.yml produces

The new workflow is independent of release.yml — it never touches PyPI publishing or the version-validation logic. Tagged release publishes still work exactly as before.

Why a separate workflow

Adding schedule: directly to release.yml would also trigger the build-and-publish-pypi job, which has tag-format validation that would fail on a non-release-context run. A separate workflow avoids re-engineering that logic.

Verified locally

docker build --pull --build-arg PYTHON_MATTER_SERVER=8.1.2 -t local/matter-server:rebuilt . against current python:3.12-slim-bookworm0 HIGH/CRITICAL OS CVEs. Container starts clean, Matter Server successfully initialized.

Adjustments welcome

  • Cron cadence (currently weekly Sunday 04:00 UTC)
  • Tag set (could trim to :stable only if preferred)
  • Skipping pre-releases (currently the workflow doesn't distinguish — PyPI's latest is always a stable release per your existing release flow)

The python-matter-server container builds only on release: published,
so the :stable tag drifts behind on python:3.12-slim-bookworm
OS-package fixes between PyPI releases. A trivy scan on 2026-05-02 found
6 CRITICAL + 23 HIGH OS CVEs in :stable, all in slim-bookworm base
packages.

This adds a separate workflow that rebuilds weekly using the latest
PyPI-published python-matter-server version. Independent of release.yml
— never touches PyPI publishing or the version-validation logic. Existing
release flow continues to work unchanged.
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