fix(sync): fixed skipping docker images when they already synced (#1521)

before syncing an image we first check if it's already present in our storage
to do that we get the manifest from remote and compare it with the local one
but in the case of syncing docker images, because the conversion to OCI format is done while
syncing, we get a docker manifest before conversion, so sync detects that local manifest and
remote one are different, so it starts syncing again.

to overcome this, convert remote docker manifests to OCI manifests and then compare.

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2023-06-21 21:05:52 +03:00
committed by GitHub
parent ea84752214
commit 377aff1853
5 changed files with 689 additions and 1 deletions
+18
View File
@@ -129,6 +129,15 @@ function teardown_file() {
run curl http://127.0.0.1:8090/v2/registry/tags/list
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
# make sure image is skipped when synced again
run skopeo --insecure-policy copy --multi-arch=all --src-tls-verify=false \
docker://127.0.0.1:8090/registry \
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
run $("cat /tmp/blackbox.log | grep -q registry:latest.*.skipping image because it's already synced")
[ "$status" -eq 0 ]
}
@test "sync docker image on demand" {
@@ -143,6 +152,15 @@ function teardown_file() {
run curl http://127.0.0.1:8090/v2/archlinux/tags/list
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
# make sure image is skipped when synced again
run skopeo --insecure-policy copy --src-tls-verify=false \
docker://127.0.0.1:8090/archlinux \
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
run $("cat /tmp/blackbox.log | grep -q archlinux:latest.*.skipping image because it's already synced")
[ "$status" -eq 0 ]
}
@test "sync k8s image list on demand" {