Skip to content

Commit eff6ddc

Browse files
adodon2goandaaron
authored andcommitted
Install notation as prerequisite for test Makefile target
Signed-off-by: Alexei Dodon <adodon@cisco.com>
1 parent ac3801e commit eff6ddc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Makefile

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TOOLSDIR := hack/tools
99
PATH := bin:$(TOOLSDIR)/bin:$(PATH)
1010
STACKER := $(shell which stacker)
1111
GOLINTER := $(TOOLSDIR)/bin/golangci-lint
12+
NOTATION := $(TOOLSDIR)/bin/notation
1213
OS ?= linux
1314
ARCH ?= amd64
1415

@@ -40,9 +41,9 @@ exporter-minimal: swagger
4041
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-exporter -tags minimal,containers_image_openpgp -v -trimpath ./cmd/exporter
4142

4243
.PHONY: test
43-
test:
44+
test: check-skopeo $(NOTATION)
4445
$(shell mkdir -p test/data; cd test/data; ../scripts/gen_certs.sh; cd ${TOP_LEVEL}; sudo skopeo --insecure-policy copy -q docker://public.ecr.aws/t0x7q1g8/centos:7 oci:${TOP_LEVEL}/test/data/zot-test:0.0.1;sudo skopeo --insecure-policy copy -q docker://public.ecr.aws/t0x7q1g8/centos:8 oci:${TOP_LEVEL}/test/data/zot-cve-test:0.0.1)
45-
$(shell sudo mkdir -p /etc/containers/certs.d/127.0.0.1:8089/; sudo cp test/data/client.* /etc/containers/certs.d/127.0.0.1:8089/; sudo cp test/data/ca.* /etc/containers/certs.d/127.0.0.1:8089/;)
46+
$(shell sudo mkdir -p /etc/containers/certs.d/127.0.0.1:8089/; sudo cp test/data/client.* test/data/ca.* /etc/containers/certs.d/127.0.0.1:8089/;)
4647
$(shell sudo chmod a=rwx /etc/containers/certs.d/127.0.0.1:8089/*.key)
4748
go test -tags extended,containers_image_openpgp -v -trimpath -race -timeout 15m -cover -coverpkg ./... -coverprofile=coverage-extended.txt -covermode=atomic ./...
4849
go test -tags minimal,containers_image_openpgp -v -trimpath -race -cover -coverpkg ./... -coverprofile=coverage-minimal.txt -covermode=atomic ./...
@@ -51,6 +52,16 @@ test:
5152
test-clean:
5253
$(shell sudo rm -rf /etc/containers/certs.d/127.0.0.1:8089/)
5354

55+
.PHONY: check-skopeo
56+
check-skopeo:
57+
skopeo -v || (echo "You need skopeo to be installed in order to run tests"; exit 1)
58+
59+
$(NOTATION):
60+
mkdir -p $(TOOLSDIR)/bin
61+
curl -Lo notation.tar.gz https://github.com/notaryproject/notation/releases/download/v0.7.1-alpha.1/notation_0.7.1-alpha.1_linux_amd64.tar.gz
62+
tar xvzf notation.tar.gz -C $(TOOLSDIR)/bin notation
63+
rm notation.tar.gz
64+
5465
.PHONY: covhtml
5566
covhtml:
5667
tail -n +2 coverage-minimal.txt > tmp.txt && mv tmp.txt coverage-minimal.txt

0 commit comments

Comments
 (0)