Blame SOURCES/0037-improvement-check-container-use-docker-build.patch

66253d
From e5cf566becc7ffa01e0339e95b20469993af8d2b Mon Sep 17 00:00:00 2001
66253d
From: Eric Garver <eric@garver.life>
66253d
Date: Mon, 3 Feb 2020 08:38:57 -0500
66253d
Subject: [PATCH 37/39] improvement: check-container: use docker build
66253d
66253d
This is so we can have intermediate images and make use of the cache.
66253d
Avoids rebuilding the container every time.
66253d
66253d
(cherry picked from commit a7fead65d6920c26df5f2a12e53bb8eb5a752ee6)
66253d
(cherry picked from commit b79b8a58ffc8ab24d8c0a8e61598452b3407b80f)
66253d
---
66253d
 src/tests/Makefile.am | 65 ++++++++++++++++++++++---------------------
66253d
 1 file changed, 33 insertions(+), 32 deletions(-)
66253d
66253d
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
66253d
index bf028c7c5389..c01ee682c0b2 100644
66253d
--- a/src/tests/Makefile.am
66253d
+++ b/src/tests/Makefile.am
66253d
@@ -46,47 +46,48 @@ $(TESTSUITE) $(TESTSUITE_INTEGRATION): $(TESTSUITE_FILES) $(srcdir)/package.m4
66253d
 	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
66253d
 	mv $@.tmp $@
66253d
 
66253d
-check-container-debian-sid:
66253d
-	(cd $(abs_top_srcdir) && tar -c . ) | \
66253d
-	$(PODMAN) run -i --rm --privileged debian:sid bash -c \
66253d
-	"mkdir -p /tmp/firewalld && cd /tmp/firewalld && tar -x && \
66253d
-	apt-get update && \
66253d
-	apt-get install -y autoconf automake pkg-config intltool libglib2.0-dev \
66253d
-	                   xsltproc docbook-xsl docbook-xml iptables ipset ebtables \
66253d
-	                   nftables libxml2-utils libdbus-1-dev libgirepository1.0-dev \
66253d
-	                   python3-dbus python3-gi python3-slip-dbus python3-nftables \
66253d
-	                   procps network-manager gir1.2-nm-1.0 && \
66253d
-	apt-get install -y libnftables-dev && \
66253d
-	./autogen.sh && \
66253d
-	./configure PYTHON=/usr/bin/python3 && \
66253d
-	make && \
66253d
-	make -C src/tests check-local TESTSUITEFLAGS=\"$(TESTSUITEFLAGS)\" && \
66253d
-	make -C src/tests check-integration TESTSUITEFLAGS=\"$(TESTSUITEFLAGS) -j1\" "
66253d
+CONTAINER_TARGETS = check-container-debian-sid check-container-fedora-rawhide
66253d
+
66253d
+check-container-debian-sid-image: check-container-%-image:
66253d
+	(cd $(abs_top_srcdir) && { \
66253d
+	echo "FROM debian:sid" && \
66253d
+	echo "RUN apt-get update" && \
66253d
+	echo "RUN apt-get install -y autoconf automake pkg-config intltool libglib2.0-dev \
66253d
+	                             xsltproc docbook-xsl docbook-xml iptables ipset ebtables \
66253d
+	                             nftables libxml2-utils libdbus-1-dev libgirepository1.0-dev \
66253d
+	                             python3-dbus python3-gi python3-slip-dbus python3-nftables \
66253d
+	                             procps network-manager gir1.2-nm-1.0" && \
66253d
+	echo "COPY . /tmp/firewalld"; \
66253d
+	} | $(PODMAN) build -t firewalld-testsuite-$* -f - . )
66253d
+
66253d
+check-container-fedora-rawhide-image: check-container-%-image:
66253d
+	(cd $(abs_top_srcdir) && { \
66253d
+	echo "FROM fedora:rawhide" && \
66253d
+	echo "RUN dnf -y makecache" && \
66253d
+	echo "RUN dnf -y install autoconf automake conntrack-tools desktop-file-utils \
66253d
+	                 docbook-style-xsl file gettext glib2-devel intltool ipset \
66253d
+	                 iptables iptables-nft libtool libxml2 libxslt make nftables \
66253d
+	                 python3-nftables python3-slip-dbus python3-gobject-base \
66253d
+	                 diffutils procps-ng iproute which dbus-daemon \
66253d
+	                 NetworkManager" && \
66253d
+	echo "RUN alternatives --set ebtables /usr/sbin/ebtables-nft" && \
66253d
+	echo "COPY . /tmp/firewalld"; \
66253d
+	} | $(PODMAN) build -t firewalld-testsuite-$* -f - . )
66253d
 
66253d
-check-container-fedora-rawhide:
66253d
-	(cd $(abs_top_srcdir) && tar -c . ) | \
66253d
-	$(PODMAN) run -i --rm --privileged fedora:rawhide bash -c \
66253d
-	"mkdir -p /tmp/firewalld && cd /tmp/firewalld && tar -x && \
66253d
-	dnf -y makecache && \
66253d
-	dnf -y install autoconf automake conntrack-tools desktop-file-utils \
66253d
-	               docbook-style-xsl file gettext glib2-devel intltool ipset \
66253d
-	               iptables iptables-nft libtool libxml2 libxslt make nftables \
66253d
-	               python3-nftables python3-slip-dbus python3-gobject-base \
66253d
-	               diffutils procps-ng iproute which dbus-daemon \
66253d
-	               NetworkManager && \
66253d
-	alternatives --set ebtables /usr/sbin/ebtables-nft && \
66253d
+$(CONTAINER_TARGETS): check-container-%: check-container-%-image
66253d
+	$(PODMAN) run -i --rm --privileged firewalld-testsuite-$* bash -c " \
66253d
+	cd /tmp/firewalld && \
66253d
 	./autogen.sh && \
66253d
 	./configure PYTHON=/usr/bin/python3 && \
66253d
 	make && \
66253d
 	make -C src/tests check-local TESTSUITEFLAGS=\"$(TESTSUITEFLAGS)\" && \
66253d
 	make -C src/tests check-integration TESTSUITEFLAGS=\"$(TESTSUITEFLAGS) -j1\" "
66253d
+	$(PODMAN) rmi firewalld-testsuite-$*
66253d
 
66253d
-check-container: check-container-debian-sid
66253d
-check-container: check-container-fedora-rawhide
66253d
+check-container: $(CONTAINER_TARGETS)
66253d
 
66253d
 .PHONY: check-container
66253d
-.PHONY: check-container-debian-sid
66253d
-.PHONY: check-container-fedora-rawhide
66253d
+.PHONY: $(CONTAINER_TARGETS) $(foreach container,$(CONTAINER_TARGETS),$(container)-image)
66253d
 
66253d
 check-integration: atconfig atlocal $(TESTSUITE_INTEGRATION)
66253d
 	$(SHELL) '$(TESTSUITE_INTEGRATION)' $(TESTSUITEFLAGS) \
66253d
-- 
66253d
2.23.0
66253d