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

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