Ava Chow 6835e9686c
Merge bitcoin/bitcoin#31545: ci: optionally use local docker build cache
e87429a2d0f23eb59526d335844fa5ff5b50b21f ci: optionally use local docker build cache (0xb10c)

Pull request description:

  By setting `DANGER_DOCKER_BUILD_CACHE_HOST_DIR`, the task-specific docker images built during the CI run can be cached. This allows, for example, ephemeral CI runners to reuse the docker images (or layers of it) from earlier runs, by persisting the image cache before the ephemeral CI runner is shut down. The cache keyed by `CONTAINER_NAME`.

  As `--cache-to` doesn't remove old cache files, the existing cache is removed after a successful `docker build` and the newly cached image is moved to it's location to avoid the cache from growing indefinitely with old, unused layers.

  When `--cache-from` doesn't find the directory, the cached version is a cache-miss, or the cache can't be imported for whatever other reason, it warns and `docker build` continues by building the docker image.

  This feature is opt-in. The documentation for the docker build cache of `type=local` can be found on https://docs.docker.com/build/cache/backends/local/

  This replaces https://github.com/bitcoin/bitcoin/pull/31377 - some of the discussion there might provide more context.

ACKs for top commit:
  maflcko:
    I haven't tested this, and it looks harmless and is easy to revert, if needed. So lgtm ACK e87429a2d0f23eb59526d335844fa5ff5b50b21f
  achow101:
    ACK e87429a2d0f23eb59526d335844fa5ff5b50b21f
  TheCharlatan:
    tACK e87429a2d0f23eb59526d335844fa5ff5b50b21f
  willcl-ark:
    ACK e87429a2d0f23eb59526d335844fa5ff5b50b21f

Tree-SHA512: 0887c395dee2e2020394933246d4c1bfb6dde7165219cbe93eccfe01379e05c75dce8920b6edd7df07364c703fcee7be4fba8fa45fd0e0e89da9e24759f67a71
2025-01-29 16:50:19 -05:00
..
2025-01-17 15:34:11 +01:00
2024-08-16 21:19:13 +01:00