feat(ci): Improve cache hits
This commit is contained in:
committed by
Carlos Álvaro
parent
c556e06e55
commit
4b5ebaa95a
15
.github/workflows/build-and-test.yml
vendored
15
.github/workflows/build-and-test.yml
vendored
@@ -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 }}
|
||||
|
||||
|
||||
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user