Skip to content

CI: stop rebuilding rserve on every PR run; pin R deps to a CRAN snapshot#849

Merged
brianlball merged 2 commits into
developfrom
ci-rserve-snapshot-cache
Jul 16, 2026
Merged

CI: stop rebuilding rserve on every PR run; pin R deps to a CRAN snapshot#849
brianlball merged 2 commits into
developfrom
ci-rserve-snapshot-cache

Conversation

@brianlball

Copy link
Copy Markdown
Contributor

Follow-up to #847's CI work, prompted by the docker-job failure on #845's re-run (2026-07-16 ~19:03Z): the rserve image rebuild died in Rscript install_packages.R on transient cloud.r-project.org download failures plus mid-day CRAN version drift (ggplot2 3.5.1 found, but >= 3.5.2 is required by 'ggrepel'; gtable 0.3.5 loaded, but >= 0.3.6 required). The same rebuild had passed 2.5h earlier — nothing in the PR was at fault.

Why every run rebuilt rserve

BuildKit (default since Docker 23, runners have 28) does not use pulled images as layer cache, so the docker-compose pull before build — the original caching mechanism under the classic builder — stopped helping. Every docker job replayed the full R install (~10 min) against live CRAN.

Changes

  1. PR runs skip the rserve build entirely unless the PR touches docker/R/** (two-commit tree diff against the fetched base tip, so it works on the shallow merge-ref clone; any fetch/diff failure falls back to building everything). The stack uses the pulled nrel/openstudio-rserve:latest, which docker-upload keeps fresh on develop/master pushes. Push runs still build everything since those images get deployed.
  2. cache_from + BUILDKIT_INLINE_CACHE on all built services, so images pushed from develop carry layer-cache metadata and can seed the builds that do still happen.
  3. R installs resolve from a dated Posit Package Manager snapshot (2026-07-15) instead of live CRAN — install_and_verify pinned its named packages but their dependencies floated, which is exactly what broke. The __linux__/jammy path serves prebuilt binaries for the base image (Ubuntu 22.04 + R 4.4): install_packages.R drops from ~480s to ~100s. Bump the snapshot date deliberately to take newer packages.

Testing

  • Local docker build docker/R with the snapshot: completes, 13/13 packages install and pass their load check, R-install layer 102s (was 482s in CI).
  • This PR touches docker/R/**, so its own docker job exercises the "PR changed docker/R → rebuild" path end-to-end, including the snapshot install in CI.
  • docker compose config validates; build args string-quoted for docker-compose 1.29's schema.

🤖 Generated with Claude Code

brianlball and others added 2 commits July 16, 2026 16:56
install_and_verify pins the packages it names, but their dependencies
resolved from live CRAN. A mid-day CRAN publish on 2026-07-16 (ggrepel
requiring ggplot2 >= 3.5.2/gtable >= 0.3.6) broke rserve image rebuilds
that had passed hours earlier, plus transient cloud.r-project.org
download failures. Resolve everything from the 2026-07-15 snapshot: same
inputs every build until the date is bumped deliberately.

The __linux__/jammy path serves prebuilt binaries for the base image
(Ubuntu 22.04 + R 4.4) - install_packages.R drops from ~480s to ~100s -
with the plain source snapshot as fallback. Verified locally: docker
build of docker/R completes, 13/13 packages install and load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every docker job rebuilt the rserve image from scratch: BuildKit (Docker
28 default) does not use pulled images as layer cache, so the
docker-compose pull that used to make the build a cache no-op under the
classic builder stopped helping. That cost ~10 min per run and exposed
every PR to CRAN availability (see 2026-07-16 failure on #845's run).

- PR runs build only web unless the PR changes docker/R (two-commit tree
  diff against the fetched base tip - works on the shallow merge-ref
  clone; any fetch/diff failure falls back to building everything). The
  pulled nrel/openstudio-rserve:latest, kept fresh by docker-upload on
  develop/master pushes, backs the stack instead
- push runs still build everything (docker-upload deploys those images)
- compose build config gains cache_from + BUILDKIT_INLINE_CACHE so
  images pushed from develop carry layer-cache metadata and can seed
  the builds that do still happen

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@brianlball
brianlball merged commit ba21522 into develop Jul 16, 2026
5 checks passed
@brianlball
brianlball deleted the ci-rserve-snapshot-cache branch July 16, 2026 22:39
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