From 2789a2935366b7c037d1efa894ca1e1aa4d27572 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 25 Feb 2026 00:34:14 +0000 Subject: [PATCH] GHA cache cinc container image --- .github/workflows/test-kitchen.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index ad5d7ca58..99239de9d 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -210,14 +210,36 @@ jobs: os: ubuntu-2204 fail-fast: false steps: + - name: Check out code + uses: actions/checkout@v6 + - name: Extract cinc image details from .kitchen.yml + id: cinc-image + run: | + CINC_IMAGE=$(grep 'chef_image:' .kitchen.yml | head -1 | awk '{print $2}') + CINC_VERSION=$(grep 'chef_version:' .kitchen.yml | head -1 | awk '{print $2}') + echo "cinc_container_image=${CINC_IMAGE}" >> "$GITHUB_OUTPUT" + echo "cinc_container_version=${CINC_VERSION}" >> "$GITHUB_OUTPUT" + echo "cinc_container_ref=${CINC_IMAGE}:${CINC_VERSION}" >> "$GITHUB_OUTPUT" - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Check out code - uses: actions/checkout@v6 + - name: Cache cinc container image + id: cache-cinc + uses: actions/cache@v5 + with: + path: /tmp/cinc-image.tar + key: docker-cinc-${{ steps.cinc-image.outputs.cinc_container_version }}-${{ runner.arch }} + - name: Pull and save cinc container image + if: steps.cache-cinc.outputs.cache-hit != 'true' + run: | + docker pull "${{ steps.cinc-image.outputs.cinc_container_ref }}" + docker save "${{ steps.cinc-image.outputs.cinc_container_ref }}" -o /tmp/cinc-image.tar + - name: Load cinc container image from cache + if: steps.cache-cinc.outputs.cache-hit == 'true' + run: docker load -i /tmp/cinc-image.tar - name: Setup ruby uses: ruby/setup-ruby@v1 with: -- 2.47.3