ci/cd: add a basic push-pull testing using client tools

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
Ramkumar Chinchani
2022-02-04 17:44:16 +00:00
committed by Ramkumar Chinchani
parent f89925fb27
commit c73e71b018
3 changed files with 76 additions and 4 deletions
+23 -1
View File
@@ -15,7 +15,7 @@ ARCH ?= amd64
BENCH_OUTPUT ?= stdout
.PHONY: all
all: swagger binary binary-minimal binary-debug binary-arch binary-arch-minimal cli cli-arch bench bench-arch exporter-minimal verify-config test test-clean check
all: swagger binary binary-minimal binary-debug binary-arch binary-arch-minimal cli cli-arch bench bench-arch exporter-minimal verify-config test covhtml test-clean check
.PHONY: binary-minimal
binary-minimal: swagger
@@ -79,6 +79,28 @@ run-bench: binary bench
bin/zb -c 10 -n 100 -o $(BENCH_OUTPUT) http://localhost:8080
killall zot
.PHONY: push-pull
push-pull: binary check-skopeo
bin/zot serve examples/config-minimal.json &
sleep 5
# skopeo push/pull
skopeo --debug copy --format=oci --dest-tls-verify=false docker://ghcr.io/project-zot/golang:1.17 docker://localhost:8080/golang:1.17
skopeo --debug copy --src-tls-verify=false docker://localhost:8080/golang:1.17 oci:golang:1.17
# oras artifacts
echo "{\"name\":\"foo\",\"value\":\"bar\"}" > config.json
echo "hello world" > artifact.txt
oras push localhost:8080/hello-artifact:v2 \
--manifest-config config.json:application/vnd.acme.rocket.config.v1+json \
artifact.txt:text/plain -d -v
rm -f artifact.txt # first delete the file
oras pull localhost:8080/hello-artifact:v2 -d -v -a
grep -q "hello world" artifact.txt # should print "hello world"
if [ $? -ne 0 ]; then \
killall zot; \
exit 1; \
fi
killall zot
.PHONY: test-clean
test-clean:
$(shell sudo rm -rf /etc/containers/certs.d/127.0.0.1:8089/)