diff --git a/builder-support/dockerfiles/Dockerfile.debtest b/builder-support/dockerfiles/Dockerfile.debtest new file mode 100644 index 00000000..7ae3116e --- /dev/null +++ b/builder-support/dockerfiles/Dockerfile.debtest @@ -0,0 +1,15 @@ +# Install the built rpms and test them +FROM dist-base as dist +# If you want to install extra packages or do generic configuration, +# do it before the COPY. Either here, or in the dist-base layer. + +COPY --from=sdist /sdist /sdist +COPY --from=package-builder /dist /dist + +# Install built packages with dependencies +RUN apt install -y /dist/*.deb + +# Installation tests +COPY builder-support/install-tests /wforce/builder-support/install-tests +WORKDIR /wforce +RUN builder-support/install-tests/test-simple-exec.sh diff --git a/builder-support/dockerfiles/Dockerfile.rpmbuild b/builder-support/dockerfiles/Dockerfile.rpmbuild index 24ad7366..fb439648 100644 --- a/builder-support/dockerfiles/Dockerfile.rpmbuild +++ b/builder-support/dockerfiles/Dockerfile.rpmbuild @@ -124,3 +124,5 @@ RUN builder/helpers/build-specs.sh builder-support/specs/wforce.spec # See: https://github.com/moby/moby/issues/33733 #RUN mv /root/rpmbuild/RPMS/* /dist/ RUN cp -R /root/rpmbuild/RPMS/* /dist/ + + diff --git a/builder-support/dockerfiles/Dockerfile.rpmtest b/builder-support/dockerfiles/Dockerfile.rpmtest index b190e57d..6225fc4d 100644 --- a/builder-support/dockerfiles/Dockerfile.rpmtest +++ b/builder-support/dockerfiles/Dockerfile.rpmtest @@ -10,4 +10,6 @@ COPY --from=package-builder /dist /dist RUN yum localinstall -y /dist/*/*.rpm # Installation tests -@INCLUDE Dockerfile.commontest +COPY builder-support/install-tests /wforce/builder-support/install-tests +WORKDIR /wforce +RUN builder-support/install-tests/test-simple-exec.sh diff --git a/builder-support/dockerfiles/Dockerfile.target.centos-7 b/builder-support/dockerfiles/Dockerfile.target.centos-7 index feb041c9..e4bde37a 100644 --- a/builder-support/dockerfiles/Dockerfile.target.centos-7 +++ b/builder-support/dockerfiles/Dockerfile.target.centos-7 @@ -13,4 +13,6 @@ RUN echo "source /opt/rh/llvm-toolset-7.0/enable" >> /etc/bashrc # Do the actual rpm build @INCLUDE Dockerfile.rpmbuild - +# Do a test install and verify +# Can be skipped with skiptests=1 in the environment +@EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest \ No newline at end of file diff --git a/builder-support/dockerfiles/Dockerfile.target.debian-bookworm b/builder-support/dockerfiles/Dockerfile.target.debian-bookworm index 6273d8e1..50875fcf 100644 --- a/builder-support/dockerfiles/Dockerfile.target.debian-bookworm +++ b/builder-support/dockerfiles/Dockerfile.target.debian-bookworm @@ -6,3 +6,7 @@ ARG APT_URL RUN apt-get update && apt-get -y dist-upgrade @INCLUDE Dockerfile.debbuild + +# Do a test install and verify +# Can be skipped with skiptests=1 in the environment +@EXEC [ "$skiptests" = "" ] && include Dockerfile.debtest \ No newline at end of file diff --git a/builder-support/dockerfiles/Dockerfile.target.debian-bullseye b/builder-support/dockerfiles/Dockerfile.target.debian-bullseye index c4f1aed8..291cc607 100644 --- a/builder-support/dockerfiles/Dockerfile.target.debian-bullseye +++ b/builder-support/dockerfiles/Dockerfile.target.debian-bullseye @@ -6,3 +6,7 @@ ARG APT_URL RUN apt-get update && apt-get -y dist-upgrade @INCLUDE Dockerfile.debbuild + +# Do a test install and verify +# Can be skipped with skiptests=1 in the environment +@EXEC [ "$skiptests" = "" ] && include Dockerfile.debtest \ No newline at end of file diff --git a/builder-support/dockerfiles/Dockerfile.target.ol-8 b/builder-support/dockerfiles/Dockerfile.target.ol-8 index efd430a8..c5a546c0 100644 --- a/builder-support/dockerfiles/Dockerfile.target.ol-8 +++ b/builder-support/dockerfiles/Dockerfile.target.ol-8 @@ -17,3 +17,6 @@ RUN dnf -y install dnf-plugins-core clang # Do the actual rpm build @INCLUDE Dockerfile.rpmbuild +# Do a test install and verify +# Can be skipped with skiptests=1 in the environment +@EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest \ No newline at end of file diff --git a/builder-support/dockerfiles/Dockerfile.target.ol-9 b/builder-support/dockerfiles/Dockerfile.target.ol-9 index 6a9df095..3237d9d9 100644 --- a/builder-support/dockerfiles/Dockerfile.target.ol-9 +++ b/builder-support/dockerfiles/Dockerfile.target.ol-9 @@ -16,3 +16,6 @@ RUN dnf -y install dnf-plugins-core clang # Do the actual rpm build @INCLUDE Dockerfile.rpmbuild +# Do a test install and verify +# Can be skipped with skiptests=1 in the environment +@EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest diff --git a/builder-support/install-tests/test-simple-exec.sh b/builder-support/install-tests/test-simple-exec.sh new file mode 100755 index 00000000..023b75ec --- /dev/null +++ b/builder-support/install-tests/test-simple-exec.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -ex + +/usr/bin/wforce --help >/dev/null +/usr/bin/trackalert --help >/dev/null + +# isempty() is an extension only present in the OpenResty fork of LuaJIT, +# the import will error in the original LuaJIT and Lua. +/usr/bin/wforce-luajit -e 'local isempty = require "table.isempty" print(isempty({}))' + +# Check Lua modules are loaded +/usr/bin/wforce-luajit -e 'require "elasticsearch" require "lualdap"' + +# Check that our lua-dist is the first libluajit that is found +/sbin/ldconfig --print-cache | grep '/usr/share/wforce-lua-dist/lib/exported/libluajit' +ldd /usr/bin/wforce | grep '/usr/share/wforce-lua-dist/lib/exported/libluajit' \ No newline at end of file