mirror of
https://github.com/DaoCloud/public-image-mirror.git
synced 2025-08-08 17:42:50 +08:00
Mantain mirror (#795)
This commit is contained in:
25
hack/fmt-image.sh
Executable file
25
hack/fmt-image.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function filter_docker_library() {
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^docker\.io/[^/]*$ ]]; then
|
||||
echo "docker.io/library/${line#docker.io/}"
|
||||
else
|
||||
echo "${line}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function filter_k8s_old() {
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^k8s\.gcr\.io/.*$ ]]; then
|
||||
echo "registry.k8s.io/${line#k8s.gcr.io/}"
|
||||
else
|
||||
echo "${line}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cat $1 |
|
||||
filter_docker_library |
|
||||
filter_k8s_old >$1.tmp && mv $1.tmp $1
|
20
hack/fmt.sh
20
hack/fmt.sh
@@ -2,26 +2,6 @@
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
function filter_docker_library() {
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^docker\.io/[^/]*$ ]]; then
|
||||
echo "docker.io/library/${line#docker.io/}"
|
||||
else
|
||||
echo "${line}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function filter_k8s_old() {
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^k8s\.gcr\.io/.*$ ]]; then
|
||||
echo "registry.k8s.io/${line#k8s.gcr.io/}"
|
||||
else
|
||||
echo "${line}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cat $1 |
|
||||
filter_docker_library |
|
||||
filter_k8s_old |
|
||||
|
33
hack/merge-mirror.sh
Executable file
33
hack/merge-mirror.sh
Executable 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
|
9
hack/verify-fmt-image.sh
Executable file
9
hack/verify-fmt-image.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
cp $1 $1.bak
|
||||
|
||||
$(dirname "${BASH_SOURCE}")/fmt-image.sh $1.bak
|
||||
|
||||
diff -c $1 $1.bak && rm $1.bak
|
Reference in New Issue
Block a user