mirror of
https://github.com/anchore/syft.git
synced 2026-11-05 00:46:38 +01:00
Upgrade binary test fixtures management (#2444)
* test: strip fixtures of any execution permissions Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * chore: add lint check for large files Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * add helper script to capture binary snippets Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * chore: update scripts and add new dir output for snippets Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: update erlang test to new generated format Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: update memcached to new generator pattern Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: update openjdk to named version Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: move openjdk lts to versioned folder Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: rename unversioned java to versioned folders Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: migrate bash fixture to new snippet workflow Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: update script to size 600 bytes Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: update go classifier to new snippet workflow Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: move haproxy new new snippet Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: add flatter haproxy example Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: update tests to new pattern Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * test: final version of snippet script Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * [wip] download bin helpers Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add manager for binary cataloger test fixtures Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add remaining binary cataloger patterns and snippets Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * adjust gitignore to be more permissive to snippets Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add rust darwin snippets Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * skip tests that are missing full binaries Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * address PR feedback Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add tests for binary test fixture manager Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * highlight rows that do not have binaries or snippets Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * bump fixture limit to 1K (found exceptions when adding snippets) Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add redis and postgres snippets Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * improve formating of fixture listing Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex Goodman
parent
a16a4ad6c9
commit
7182f5b519
@@ -1,110 +1,29 @@
|
||||
.PHONY: all
|
||||
all: \
|
||||
classifiers/dynamic/python-binary-shared-lib-3.11 \
|
||||
classifiers/dynamic/python-binary-shared-lib-redhat-3.9 \
|
||||
classifiers/dynamic/python-binary-with-version-3.9 \
|
||||
classifiers/dynamic/python-binary-3.4-alpine \
|
||||
classifiers/dynamic/ruby-library-3.2.1 \
|
||||
classifiers/dynamic/ruby-library-2.7.7 \
|
||||
classifiers/dynamic/ruby-library-2.6.10 \
|
||||
classifiers/dynamic/helm-3.11.1 \
|
||||
classifiers/dynamic/helm-3.10.3 \
|
||||
classifiers/dynamic/consul-1.15.2
|
||||
.PHONY: default list download download-all cache.fingerprint
|
||||
|
||||
.DEFAULT_GOAL := default
|
||||
|
||||
default: download
|
||||
|
||||
classifiers/dynamic/python-binary-shared-lib-3.11:
|
||||
$(eval $@_image := "python:3.11-slim@sha256:0b106e1d2bf485c2a41474bc9cd5103e9eea4e179f40f10741b53b127059221e")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/bin/python3.11 \
|
||||
$@/python3
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libpython3.11.so.1.0 \
|
||||
$@/libpython3.11.so.1.0
|
||||
list: ## list all managed binaries and snippets
|
||||
go run ./manager list
|
||||
|
||||
classifiers/dynamic/python-binary-shared-lib-redhat-3.9:
|
||||
$(eval $@_image := "registry.access.redhat.com/ubi8/python-39@sha256:f3cf958b96ce016b63e3e163e488f52e42891304dafef5a0811563f22e3cbad0")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/bin/python3.9 \
|
||||
$@/python3.9
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/lib64/libpython3.9.so.1.0 \
|
||||
$@/libpython3.9.so.1.0
|
||||
download: ## download only binaries that are not covered by a snippet
|
||||
go run ./manager download $(name) --skip-if-covered-by-snippet
|
||||
|
||||
classifiers/dynamic/python-binary-with-version-3.9:
|
||||
$(eval $@_image := "python:3.9.16-bullseye@sha256:93fb93c461a2e47a2176706fad1f39eaacd5dd40e19c0b018699a28c03eb2e2a")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/bin/python3.9 \
|
||||
$@/python3.9
|
||||
download-all: ## download all managed binaries
|
||||
go run ./manager download
|
||||
|
||||
classifiers/dynamic/python-binary-3.4-alpine:
|
||||
$(eval $@_image := "python:3.4-alpine@sha256:c210b660e2ea553a7afa23b41a6ed112f85dbce25cbcb567c75dfe05342a4c4b")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/bin/python3.4 \
|
||||
$@/python3.4
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libpython3.4m.so.1.0 \
|
||||
$@/libpython3.4m.so.1.0
|
||||
add-snippet: ## add a new snippet from an existing binary
|
||||
go run ./manager add-snippet
|
||||
|
||||
classifiers/dynamic/ruby-library-3.2.1:
|
||||
$(eval $@_image := "ruby:3.2.1-bullseye@sha256:b4a140656b0c5d26c0a80559b228b4d343f3fdbf56682fcbe88f6db1fa9afa6b")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/bin/ruby \
|
||||
$@/ruby
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libruby.so.3.2.1 \
|
||||
$@/libruby.so.3.2.1
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libruby.so.3.2 \
|
||||
$@/libruby.so.3.2
|
||||
cache.fingerprint: ## prints the sha256sum of the any input to the download command (to determine if there is a cache miss)
|
||||
@cat ./config.yaml | sha256sum | awk '{print $$1}' | tee cache.fingerprint
|
||||
|
||||
classifiers/dynamic/ruby-library-2.7.7:
|
||||
$(eval $@_image := "ruby:2.7.7-bullseye@sha256:055191740a063f33fef1f09423e5ed8f91143aae62a3772a90910118464c5120")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/bin/ruby \
|
||||
$@/ruby
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libruby.so.2.7.7 \
|
||||
$@/libruby.so.2.7.7
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libruby.so.2.7 \
|
||||
$@/libruby.so.2.7
|
||||
clean: ## clean up all downloaded binaries
|
||||
rm -rf ./classifiers/bin
|
||||
|
||||
classifiers/dynamic/ruby-library-2.6.10:
|
||||
$(eval $@_image := "ruby:2.6.10@sha256:771a810704167e55da8a19970c5dfa6eb795dfee32547adffa29ea72703f7243")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/bin/ruby \
|
||||
$@/ruby
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libruby.so.2.6.10 \
|
||||
$@/libruby.so.2.6.10
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/lib/libruby.so.2.6 \
|
||||
$@/libruby.so.2.6
|
||||
## Halp! #################################
|
||||
|
||||
classifiers/dynamic/helm-3.11.1:
|
||||
$(eval $@_image := "alpine/helm:3.11.1@sha256:8628e3695fb743a8b9de89626f1b7a221280c2152c0e288c2504e59b68233e8b")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/bin/helm \
|
||||
$@/helm
|
||||
|
||||
classifiers/dynamic/helm-3.10.3:
|
||||
$(eval $@_image := "argoproj/argocd:v2.6.4@sha256:61fcbba187ff53c00696cb580edf70cada59c45cf399d8477631acf43cf522ee")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/usr/local/bin/helm \
|
||||
$@/helm
|
||||
|
||||
classifiers/dynamic/consul-1.15.2:
|
||||
$(eval $@_image := "hashicorp/consul:1.15.2@sha256:c2169f3bb18dd947ae8eb5f6766896695c71fb439f050a3343e0007d895615b8")
|
||||
./get-image-file.sh $($@_image) \
|
||||
/bin/consul \
|
||||
$@/consul
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf classifiers/dynamic
|
||||
|
||||
.PHONY: cache.fingerprint
|
||||
cache.fingerprint: # for CI
|
||||
$(title,Install test fixture fingerprint)
|
||||
@find ./classifiers/dynamic/* -type f -exec md5sum {} + | awk '{print $1}' | sort | tee /dev/stderr | md5sum | tee cache.fingerprint >> cache.fingerprint
|
||||
.PHONY: help
|
||||
help:
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(BOLD)$(CYAN)%-25s$(RESET)%s\n", $$1, $$2}'
|
||||
Reference in New Issue
Block a user