mirror of
https://github.com/anchore/syft.git
synced 2026-04-05 14:20:34 +02:00
BUILDPLATFORM is automatically set to the host's platform in new Docker, so having it defined as an arg results in it being overridden by this automatic value. Since it was always assigned to a literal string in the test files, just use that string. Additionally, image platform is better pulled from the manifest, not the image config, in containerd store, so try that first. Additionally, python3 is on PATH on new macs by default, but not python. Signed-off-by: Will Murphy <willmurphyscode@users.noreply.github.com>
49 lines
1.7 KiB
Makefile
49 lines
1.7 KiB
Makefile
BIN=./bin
|
|
TOOL_IMAGE=localhost/syft-bin-build-tools:latest
|
|
VERIFY_FILE=actual_verify
|
|
FINGERPRINT_FILE=$(BIN).fingerprint
|
|
|
|
ifndef BIN
|
|
$(error BIN is not set)
|
|
endif
|
|
|
|
.DEFAULT_GOAL := fixtures
|
|
|
|
# requirement 1: 'fixtures' goal to generate any and all test fixtures
|
|
fixtures: build verify
|
|
|
|
# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted
|
|
fingerprint: $(FINGERPRINT_FILE)
|
|
|
|
tools-check:
|
|
@sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1)
|
|
|
|
# for selfrando...
|
|
# docker buildx build --platform linux/amd64 -t $(TOOL_IMAGE) .
|
|
|
|
tools:
|
|
@(docker image inspect $(TOOL_IMAGE) > /dev/null 2>&1 && make tools-check) || (docker build -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256)
|
|
|
|
build: tools
|
|
mkdir -p $(BIN)
|
|
docker run -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make
|
|
|
|
verify: tools
|
|
@rm -f $(VERIFY_FILE)
|
|
docker run -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make verify > $(VERIFY_FILE)
|
|
@python3 ./differ expected_verify $(VERIFY_FILE)
|
|
|
|
debug:
|
|
docker run -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash
|
|
|
|
# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint
|
|
.PHONY: $(FINGERPRINT_FILE)
|
|
$(FINGERPRINT_FILE):
|
|
@find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE)
|
|
@#cat $(FINGERPRINT_FILE) | sha256sum | awk '{print $$1}'
|
|
|
|
# requirement 4: 'clean' goal to remove all generated test fixtures
|
|
clean:
|
|
rm -rf $(BIN) Dockerfile.sha256 $(VERIFY_FILE) $(FINGERPRINT_FILE)
|
|
|
|
.PHONY: tools tools-check build verify debug clean |