~bigbes/ci-cacher

c22d27ee9830bc6ed3152c1df526b47ef59e5315 — Eugene Blikh a day ago 519ce41
test.yml: collapse cache_garage_image to single 'cacher docker download --pull'

Now that v0.1.1 (with --pull) is the published binary on pages, the
if/else with exists/download/upload can fold into the one-line form.
SilenceUsage in v0.1.1 also removes the cobra-dump-on-miss noise that
required the stderr swallow on the previous `exists` check.
1 files changed, 4 insertions(+), 13 deletions(-)

M .builds/test.yml
M .builds/test.yml => .builds/test.yml +4 -13
@@ 10,10 10,9 @@
#   * The Go tarball, via `cacher download --url` fallback.
#   * ~/go/pkg/mod, keyed on sha256(go.sum) — biggest win, the docker
#     SDK transitives pulled in by testcontainers are heavy.
#   * The Garage docker image, via `cacher docker {exists,download,
#     upload}`. Switch to `cacher docker download --pull` after the
#     next release; the single-command form lives on master but
#     isn't in v0.1.0.
#   * The Garage docker image, via `cacher docker download --pull` —
#     single call that does cache HIT → docker load, or cache MISS →
#     docker pull + seed.
image: ubuntu/noble
packages:
  - curl


@@ 90,16 89,8 @@ tasks:
  - cache_garage_image: |
      # Key derived from the image ref so a version bump invalidates
      # the cache automatically: dxflrs/garage:v2.3.0 → dxflrs-garage-v2.3.0
      # stderr swallowed on `exists` because v0.1.0 still dumps the
      # cobra Usage block on a miss (SilenceUsage lands in the next
      # release).
      KEY="docker/$(echo "$GARAGE_IMAGE" | tr '/:' '-').tar.zst"
      if cacher docker exists "$KEY" >/dev/null 2>&1; then
        cacher docker download "$KEY" "$GARAGE_IMAGE"
      else
        docker pull "$GARAGE_IMAGE"
        cacher docker upload "$KEY" "$GARAGE_IMAGE"
      fi
      cacher docker download "$KEY" "$GARAGE_IMAGE" --pull
      docker images "$GARAGE_IMAGE"
  - test_e2e: |
      cd ci-cacher