forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (55 loc) · 2.04 KB
/
ci-images-cache-cleaner.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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:
name: Clean Image Cache
runs-on: ubuntu-22.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: kvstoremesh
- name: docker-plugin
steps:
# Fetch the source code so that we can get the right cache key
- name: Checkout Source Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
# Load Golang cache build from GitHub
- name: Load ${{ matrix.name }} Golang cache build from GitHub
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
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