Image CI Cache Cleaner #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Image CI Cache Cleaner | |
# Any change in triggers needs to be reflected in the concurrency group. | |
on: | |
workflow_dispatch: | |
schedule: | |
# Run the GC every Monday at 6am | |
- cron: "0 6 * * 1" | |
permissions: read-all | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | |
cancel-in-progress: true | |
jobs: | |
cache-cleaner: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- name: cilium | |
- name: operator-aws | |
- name: operator-azure | |
- name: operator-alibabacloud | |
- name: operator-generic | |
- name: hubble-relay | |
- name: clustermesh-apiserver | |
- name: docker-plugin | |
steps: | |
# Load Golang cache build from GitHub | |
- name: Load ${{ matrix.name }} Golang cache build from GitHub | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
id: cache | |
with: | |
path: /tmp/.cache/${{ matrix.name }} | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ matrix.name }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ matrix.name }}- | |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}- | |
${{ runner.os }}-go- | |
- name: Create ${{ matrix.name }} cache directory | |
if: ${{ steps.cache.outputs.cache-hit != 'true' }} | |
shell: bash | |
run: | | |
mkdir -p /tmp/.cache/${{ matrix.name }} | |
# Clean docker's golang's cache | |
- name: Clean ${{ matrix.name }} Golang cache from GitHub | |
shell: bash | |
run: | | |
rm -f /tmp/.cache/${{ matrix.name }}/go-build-cache.tar.gz | |
rm -f /tmp/.cache/${{ matrix.name }}/go-pkg-cache.tar.gz |