From a576aa38dd450af39ea171fc7bd2ee53344a7c5a Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 27 Nov 2023 17:21:33 -0500 Subject: [PATCH] Fix bom test failures (#564) * test: Fix bom tests to account for /stacker re-org Commit 2f284d8f401f0 re-organized the /stacker content layout. Instead of /stacker/tools/static-stacker we have /stacker/bin/stacker. Signed-off-by: Scott Moser * ci: Add alpine:edge image to those cloned and use it in test. The alpine image being used for the sbom test was already being used (and cloned). There is no reason to depend on ghcr.io for it. Signed-off-by: Scott Moser * ci: Un-mark alpine bom test as slow. Run the alpine bom test during normal c-i test. This is a quick test (~10 seconds). Having it run as part of c-i will mean that we sniff test the bom path without adding significant time. Signed-off-by: Scott Moser --------- Signed-off-by: Scott Moser --- Makefile | 9 ++++++--- test/bom.bats | 11 +++++------ test/helpers.bash | 3 +++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index a7ddb80e..cae77a11 100644 --- a/Makefile +++ b/Makefile @@ -19,11 +19,13 @@ build_stacker = go build $1 -tags "$(BUILD_TAGS) $2" -ldflags "-X main.version=$ # See doc/hacking.md for how to use a local oci or docker repository. STACKER_DOCKER_BASE?=docker://ghcr.io/project-stacker/ # They default to their image name in STACKER_DOCKER_BASE -STACKER_BUILD_BASE_IMAGE?=$(STACKER_DOCKER_BASE)alpine:edge +STACKER_BUILD_BASE_IMAGE?=$(STACKER_BUILD_ALPINE_IMAGE) +STACKER_BUILD_ALPINE_IMAGE?=$(STACKER_DOCKER_BASE)alpine:edge STACKER_BUILD_BUSYBOX_IMAGE?=$(STACKER_DOCKER_BASE)busybox:latest STACKER_BUILD_CENTOS_IMAGE?=$(STACKER_DOCKER_BASE)centos:latest STACKER_BUILD_UBUNTU_IMAGE?=$(STACKER_DOCKER_BASE)ubuntu:latest STACKER_BUILD_IMAGES = \ + $(STACKER_BUILD_ALPINE_IMAGE) \ $(STACKER_BUILD_BASE_IMAGE) \ $(STACKER_BUILD_BUSYBOX_IMAGE) \ $(STACKER_BUILD_CENTOS_IMAGE) \ @@ -149,7 +151,7 @@ test: stacker $(REGCLIENT) $(SKOPEO) $(ZOT) sudo -E PATH="$$PATH" \ LXC_BRANCH=$(LXC_BRANCH) \ LXC_CLONE_URL=$(LXC_CLONE_URL) \ - STACKER_BUILD_BASE_IMAGE=$(STACKER_BUILD_BASE_IMAGE) \ + STACKER_BUILD_ALPINE_IMAGE=$(STACKER_BUILD_ALPINE_IMAGE) \ STACKER_BUILD_BUSYBOX_IMAGE=$(STACKER_BUILD_BUSYBOX_IMAGE) \ STACKER_BUILD_CENTOS_IMAGE=$(STACKER_BUILD_CENTOS_IMAGE) \ STACKER_BUILD_UBUNTU_IMAGE=$(STACKER_BUILD_UBUNTU_IMAGE) \ @@ -166,7 +168,8 @@ test-cov: stacker-cov $(REGCLIENT) $(SKOPEO) $(ZOT) -E GOCOVERDIR="$$GOCOVERDIR" \ LXC_BRANCH=$(LXC_BRANCH) \ LXC_CLONE_URL=$(LXC_CLONE_URL) \ - STACKER_BUILD_BASE_IMAGE=$(STACKER_BUILD_BASE_IMAGE) \ + STACKER_BUILD_ALPINE_IMAGE=$(STACKER_BUILD_ALPINE_IMAGE) \ + STACKER_BUILD_BUSYBOX_IMAGE=$(STACKER_BUILD_BUSYBOX_IMAGE) \ STACKER_BUILD_CENTOS_IMAGE=$(STACKER_BUILD_CENTOS_IMAGE) \ STACKER_BUILD_UBUNTU_IMAGE=$(STACKER_BUILD_UBUNTU_IMAGE) \ ./test/main.py \ diff --git a/test/bom.bats b/test/bom.bats index 772e9814..b5358de4 100644 --- a/test/bom.bats +++ b/test/bom.bats @@ -28,7 +28,7 @@ bom-parent: paths: [/pkg2] run: | # discover installed pkgs - /stacker/tools/static-stacker bom discover + /stacker/bin/stacker bom discover # our own custom packages mkdir -p /pkg1 touch /pkg1/file @@ -86,7 +86,7 @@ bom-parent: paths: [/pkg2] run: | # discover installed pkgs - /stacker/tools/static-stacker bom discover + /stacker/bin/stacker bom discover # our own custom packages mkdir -p /pkg1 touch /pkg1/file @@ -156,12 +156,11 @@ EOF } @test "bom for alpine-based image" { - skip_slow_test cat > stacker.yaml <