mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
refactor(artifact): remove oci artifact support (#1359)
* refactor(artifact): remove oci artifact support - add header to referrers call to indicated applied artifact type filters Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com> * feat(gc): simplify gc logic to increase coverage Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com> --------- Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
@@ -145,7 +145,7 @@ function teardown_file() {
|
||||
}
|
||||
EOF
|
||||
|
||||
run notation sign --key "notation-sign-test" --plain-http localhost:8080/annotations:latest
|
||||
run notation sign --signature-manifest image --key "notation-sign-test" --plain-http localhost:8080/annotations:latest
|
||||
[ "$status" -eq 0 ]
|
||||
run notation verify --plain-http localhost:8080/annotations:latest
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -37,7 +37,6 @@ function setup() {
|
||||
"cacheTablename": "BlobTable",
|
||||
"repoMetaTablename": "RepoMetadataTable",
|
||||
"manifestDataTablename": "ManifestDataTable",
|
||||
"artifactDataTablename": "ArtifactDataTable",
|
||||
"indexDataTablename": "IndexDataTable",
|
||||
"userDataTablename": "UserDataTable",
|
||||
"versionTablename": "Version"
|
||||
|
||||
@@ -120,11 +120,11 @@ function teardown_file() {
|
||||
@test "attach oras artifacts" {
|
||||
# attach signature
|
||||
echo "{\"artifact\": \"\", \"signature\": \"pat hancock\"}" > signature.json
|
||||
run oras attach --plain-http 127.0.0.1:8080/golang:1.20 --artifact-type 'signature/example' ./signature.json:application/json
|
||||
run oras attach --plain-http 127.0.0.1:8080/golang:1.20 --image-spec v1.1-image --artifact-type 'signature/example' ./signature.json:application/json
|
||||
[ "$status" -eq 0 ]
|
||||
# attach sbom
|
||||
echo "{\"version\": \"0.0.0.0\", \"artifact\": \"'127.0.0.1:8080/golang:1.20'\", \"contents\": \"good\"}" > sbom.json
|
||||
run oras attach --plain-http 127.0.0.1:8080/golang:1.20 --artifact-type 'sbom/example' ./sbom.json:application/json
|
||||
run oras attach --plain-http 127.0.0.1:8080/golang:1.20 --image-spec v1.1-image --artifact-type 'sbom/example' ./sbom.json:application/json
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ EOF
|
||||
run regctl artifact list localhost:8080/artifact-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
||||
run regctl artifact put --media-type "application/vnd.oci.artifact.manifest.v1+json" --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:8080/artifact-ref:demo << EOF
|
||||
run regctl artifact put --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:8080/artifact-ref:demo << EOF
|
||||
test reference
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -49,12 +49,6 @@ EOF
|
||||
This artifact is represented as an ispec image manifest, this is the layer inside the manifest.
|
||||
EOF
|
||||
|
||||
ARTIFACT_MANIFEST_REFERRER=${ARTIFACT_BLOBS_DIR}/artifact-manifest-ref-blob
|
||||
touch ${ARTIFACT_MANIFEST_REFERRER}
|
||||
cat >${ARTIFACT_MANIFEST_REFERRER} <<EOF
|
||||
This artifact is represented as an ispec artifact manifest, this is the blob inside the manifest.
|
||||
EOF
|
||||
|
||||
setup_zot_file_level ${ZOT_CONFIG_FILE}
|
||||
wait_zot_reachable "http://127.0.0.1:8080/v2/_catalog"
|
||||
|
||||
@@ -69,9 +63,6 @@ EOF
|
||||
run oras attach --plain-http --image-spec v1.1-image --artifact-type image.type 127.0.0.1:8080/golang:1.20 ${IMAGE_MANIFEST_REFERRER}
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run oras attach --plain-http --image-spec v1.1-artifact --artifact-type artifact.type 127.0.0.1:8080/golang:1.20 ${ARTIFACT_MANIFEST_REFERRER}
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
MANIFEST_DIGEST=$(skopeo inspect --tls-verify=false docker://localhost:8080/golang:1.20 | jq -r '.Digest')
|
||||
echo ${MANIFEST_DIGEST}
|
||||
|
||||
@@ -91,18 +82,9 @@ function teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests[].artifactType') = '"image.type"' ]
|
||||
|
||||
run curl -X GET http://127.0.0.1:8080/v2/golang/referrers/${MANIFEST_DIGEST}?artifactType=artifact.type
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests[].artifactType') = '"artifact.type"' ]
|
||||
|
||||
# Check referrers API using the GQL endpoint
|
||||
REFERRER_QUERY_DATA="{ \"query\": \"{ Referrers(repo:\\\"golang\\\", digest:\\\"${MANIFEST_DIGEST}\\\", type:[\\\"image.type\\\"]) { MediaType ArtifactType Digest Size} }\"}"
|
||||
run curl -X POST -H "Content-Type: application/json" --data "${REFERRER_QUERY_DATA}" http://localhost:8080/v2/_zot/ext/search
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.data.Referrers[].ArtifactType') = '"image.type"' ]
|
||||
|
||||
REFERRER_QUERY_DATA="{ \"query\": \"{ Referrers(repo:\\\"golang\\\", digest:\\\"${MANIFEST_DIGEST}\\\", type:[\\\"artifact.type\\\"]) { MediaType ArtifactType Digest Size} }\"}"
|
||||
run curl -X POST -H "Content-Type: application/json" --data "${REFERRER_QUERY_DATA}" http://localhost:8080/v2/_zot/ext/search
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.data.Referrers[].ArtifactType') = '"artifact.type"' ]
|
||||
}
|
||||
|
||||
@@ -272,9 +272,9 @@ function teardown_file() {
|
||||
}
|
||||
EOF
|
||||
|
||||
run notation sign --key "notation-sign-sync-test" --plain-http localhost:9000/golang:1.20
|
||||
run notation sign --signature-manifest image --key "notation-sign-sync-test" --plain-http localhost:9000/golang:1.20
|
||||
[ "$status" -eq 0 ]
|
||||
run notation verify --plain-http localhost:9000/golang:1.20
|
||||
run notation verify --plain-http localhost:9000/golang:1.20
|
||||
[ "$status" -eq 0 ]
|
||||
run notation list --plain-http localhost:9000/golang:1.20
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -381,7 +381,7 @@ EOF
|
||||
}
|
||||
|
||||
@test "push OCI artifact (oci artifact mediatype) with regclient" {
|
||||
run regctl artifact put --media-type "application/vnd.oci.artifact.manifest.v1+json" --artifact-type "application/vnd.example.icecream.v1" localhost:9000/newartifact:demo <<EOF
|
||||
run regctl artifact put --artifact-type "application/vnd.example.icecream.v1" localhost:9000/newartifact:demo <<EOF
|
||||
this is an oci artifact
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -425,7 +425,7 @@ EOF
|
||||
run regctl artifact list localhost:9000/artifact-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
||||
run regctl artifact put --media-type "application/vnd.oci.artifact.manifest.v1+json" --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:9000/artifact-ref:demo << EOF
|
||||
run regctl artifact put --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:9000/artifact-ref:demo << EOF
|
||||
test reference
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
Reference in New Issue
Block a user