mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
ci: add a ML model artifact test case (#2332)
Both as a test and an example. Inspired by: https://github.com/kubeflow/model-registry/blob/main/docs/logical_model.md Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
parent
8b4abc6ef6
commit
4105f120ef
1 changed files with 22 additions and 0 deletions
|
@ -173,3 +173,25 @@ EOF
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "ML artifacts" {
|
||||||
|
# download model data
|
||||||
|
curl -v -L0 https://github.com/tarilabs/demo20231212/raw/main/v1.nb20231206162408/mnist.onnx -o ${BATS_FILE_TMPDIR}/mnist.onnx
|
||||||
|
sha256_in=$(sha256sum ${BATS_FILE_TMPDIR}/mnist.onnx | awk '{print $1}')
|
||||||
|
|
||||||
|
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
|
||||||
|
|
||||||
|
# upload artifact with required annotations and version
|
||||||
|
regctl artifact put --annotation description="used for demo purposes" --annotation model_format_name="onnx" --annotation model_format_version="1" --artifact-type "application/vnd.model.type" localhost:${zot_port}/models/my-model-from-gh:v1 -f ${BATS_FILE_TMPDIR}/mnist.onnx
|
||||||
|
|
||||||
|
# list artifacts
|
||||||
|
regctl artifact list localhost:${zot_port}/models/my-model-from-gh:v1 --format '{{jsonPretty .}}'
|
||||||
|
|
||||||
|
# list artifacts of type
|
||||||
|
regctl artifact list --filter-artifact-type "application/vnd.model.type" localhost:${zot_port}/models/my-model-from-gh:v1 --format '{{jsonPretty .}}'
|
||||||
|
|
||||||
|
# get artifact
|
||||||
|
regctl artifact get localhost:${zot_port}/models/my-model-from-gh:v1 > ${BATS_FILE_TMPDIR}/mnist.onnx.check
|
||||||
|
sha256_out=$(sha256sum ${BATS_FILE_TMPDIR}/mnist.onnx.check | awk '{print $1}')
|
||||||
|
[ "$sha256_in" = "$sha256_out" ]
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue