feat(ci): Improve cache hits

This commit is contained in:
Carlos Álvaro
2022-11-09 16:54:51 +01:00
committed by Carlos Álvaro
parent c556e06e55
commit 4b5ebaa95a
2 changed files with 18 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ on:
env:
IMAGE_NAME: localhost:5000/cdalvaro/docker-salt-master:${{ github.sha }}
REGISTRY_PATH: ${{ github.workspace }}/registry
CACHE_PATH: /tmp/.buildx-cache
CACHE_PATH: ${{ github.workspace }}/.buildx-cache
jobs:
build:
@@ -40,6 +40,7 @@ jobs:
--name registry registry:2
- name: Cache Docker layers
id: cache-docker-layers
uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATH }}
@@ -47,6 +48,17 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Cache hit
continue-on-error: true
env:
CACHE_HIT: ${{ steps.cache-docker-layers.outputs.cache-hit }}
run: |
if [[ "${CACHE_HIT}" != 'true' ]]; then
echo "No cache hit" >&2
exit 1
fi
echo "Cache contents available at: ${CACHE_PATH}"
- name: Build docker-salt-master image
uses: docker/build-push-action@v3.2.0
with:
@@ -57,6 +69,7 @@ jobs:
type=local,src=${{ env.CACHE_PATH }}
ghcr.io/cdalvaro/docker-salt-master:latest
cache-to: type=local,dest=${{ env.CACHE_PATH }}
pull: true
push: true
tags: ${{ env.IMAGE_NAME }}

View File

@@ -4,6 +4,10 @@ This file only reflects the changes that are made in this image.
Please refer to the [Salt 3005.1 Release Notes](https://docs.saltstack.com/en/latest/topics/releases/3005.1.html)
for the list of changes in SaltStack.
**3005.1_2**
- CI: Improve build times.
**3005.1_1**
- If `SALT_LEVEL_LOGFILE` is not defined, then fallback to `SALT_LOG_LEVEL`.