feat: switch to latest trivy cli syntax

This commit is contained in:
Stefan Reimer 2022-07-11 11:51:24 +00:00
parent cb5facae6c
commit a47929da1c

View File

@ -4,10 +4,8 @@ TAG ?= $(shell echo $(GTAG) | awk -F '-' '{ print $$1 "-" $$2 }' | sed -e 's/-$$
# EXTRA_TAGS supposed to be set at the caller, eg. $(shell echo $(TAG) | awk -F '.' '{ print $$1 "." $$2 }') # EXTRA_TAGS supposed to be set at the caller, eg. $(shell echo $(TAG) | awk -F '.' '{ print $$1 "." $$2 }')
ifeq ($(TRIVY_REMOTE),) ifneq ($(TRIVY_REMOTE),)
TRIVY_OPTS := image TRIVY_OPTS := --server ${TRIVY_REMOTE}
else
TRIVY_OPTS := client --remote ${TRIVY_REMOTE}
endif endif
.PHONY: build test scan push clean .PHONY: build test scan push clean
@ -26,7 +24,7 @@ test: build rm-test-image
scan: build scan: build
@echo "Scanning $(REGISTRY)/$(IMAGE):$(TAG) using Trivy" @echo "Scanning $(REGISTRY)/$(IMAGE):$(TAG) using Trivy"
@trivy $(TRIVY_OPTS) $(REGISTRY)/$(IMAGE):$(TAG) @trivy image $(TRIVY_OPTS) $(REGISTRY)/$(IMAGE):$(TAG)
push: build push: build
@aws ecr-public get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(REGISTRY) @aws ecr-public get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(REGISTRY)