Makefile: Use user-mode podman and fix docs-in-docker target

The docs target was broken, which made it difficult to easily update the
documentation and notice missing documentation.

podman is now widespread, and user-mode doesn't need root so switch to
using that. Leave the Makefile target names in place so that CI isn't
confused.

Related: rhbz#1955355
This commit is contained in:
Brian C. Lane 2021-06-29 11:11:32 -07:00
parent d8ea37f267
commit 8930cad4fc
3 changed files with 25 additions and 6 deletions

9
Dockerfile.docs Normal file
View File

@ -0,0 +1,9 @@
FROM centos:8
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
COPY ./test-packages .
RUN dnf -y install $(cat ./test-packages) && touch /.in-container
RUN pip3 install pocketlint Sphinx sphinx-rtd-theme sphinx-argparse
RUN useradd weldr
VOLUME /lorax-ro
VOLUME /test-results
WORKDIR /lorax-ro

View File

@ -1,6 +1,6 @@
PYTHON ?= /usr/bin/python3
DESTDIR ?= /
DOCKER ?= docker
DOCKER ?= podman
BACKEND ?= lorax-composer
PKGNAME = lorax
@ -101,17 +101,27 @@ local:
@rm -rf /var/tmp/$(PKGNAME)-$(VERSION)
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
local-srpm: local $(PKGNAME).spec
rpmbuild -bs \
--define "_sourcedir $(CURDIR)" \
--define "_srcrpmdir $(CURDIR)" \
lorax.spec
test-in-copy:
rsync -aP --exclude=.git /lorax-ro/ /lorax/
make -C /lorax/ ci
cp /lorax/.coverage /test-results/
test-in-docker:
sudo $(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test .
sudo $(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results -v `pwd`:/lorax-ro:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
$(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test .
@mkdir -p `pwd`/.test-results
$(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results -v `pwd`:/lorax-ro:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
docs-in-docker:
sudo $(DOCKER) run -it --rm -v `pwd`/docs/html/:/lorax/docs/html/ --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make docs
$(DOCKER) build -t welder/lorax-docs:$(IMAGE_RELEASE) -f Dockerfile.docs .
$(DOCKER) run -it --rm -v `pwd`:/lorax-ro:ro -v `pwd`/docs/:/lorax-ro/docs/ \
--security-opt label=disable \
welder/lorax-docs:$(IMAGE_RELEASE) make docs
ci: check test

View File

@ -3,8 +3,8 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build-3
SPHINXAPIDOC = sphinx-apidoc-3
SPHINXBUILD ?= sphinx-build
SPHINXAPIDOC ?= sphinx-apidoc
PAPER =
BUILDDIR = .
SOURCEDIR = ../src/pylorax