Mantain mirror (#795)

This commit is contained in:
Shiming Zhang
2023-11-10 17:44:41 +08:00
committed by GitHub
parent 45aee54e98
commit b20b9daf42
5 changed files with 77 additions and 21 deletions

33
hack/merge-mirror.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
base_list="${1}"
used_list="${2}"
used_top="${3:-100}"
function used_top() {
cat "${used_list}" | head -n "${used_top}"
}
function intersection_used() {
sort "${base_list}" "${used_list}" | uniq -d
}
function fixed_docker() {
grep "^docker\.io/library/" "${base_list}"
grep "^docker\.io/library/" "${used_list}"
}
function fixed_k8s() {
grep "^registry\.k8s\.io/" "${base_list}"
grep "^registry\.k8s\.io/" "${used_list}"
}
function fixed_istio() {
grep "^docker\.io/istio/" "${base_list}"
grep "^docker\.io/istio/" "${used_list}"
}
cat <(used_top) \
<(intersection_used) \
<(fixed_docker) \
<(fixed_k8s) | sort | uniq -u