Commit 0df9bb06 authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: pip 21.1 complains when run as root

Solution: run tests as another user
parent 642e3023
FROM centos as centos-python
RUN yum install -y make gcc openssl-devel libffi-devel sqlite-devel glibc-langpack-en
RUN useradd -ms /bin/bash buildout
USER buildout
ARG PYTHON_VER
ENV LC_ALL C.UTF-8
RUN mkdir buildout
WORKDIR /buildout
COPY Makefile Makefile.configure /buildout/
RUN mkdir /home/buildout/sandbox
WORKDIR /home/buildout/sandbox
COPY Makefile Makefile.configure /home/buildout/sandbox/
RUN make PYTHON_VER=${PYTHON_VER} download_python
RUN make PYTHON_VER=${PYTHON_VER} python
FROM centos-python
ARG PYTHON_VER
COPY doc /buildout/doc
COPY src /buildout/src
COPY zc.recipe.egg_ /buildout/zc.recipe.egg_
COPY setup.* dev.py *.rst *.txt buildout.cfg .coveragerc /buildout/
COPY doc /home/buildout/sandbox/doc
COPY src /home/buildout/sandbox/src
COPY zc.recipe.egg_ /home/buildout/sandbox/zc.recipe.egg_
COPY setup.* dev.py *.rst *.txt buildout.cfg .coveragerc /home/buildout/sandbox/
USER root
RUN chown -R buildout:buildout *
USER buildout
RUN make PYTHON_VER=${PYTHON_VER} build
FROM debian:stable-slim as debian-python
RUN apt-get update
RUN apt-get install -y make gcc openssl libffi-dev curl zlib1g-dev libssl-dev libsqlite3-dev
RUN useradd -ms /bin/bash buildout
USER buildout
ARG PYTHON_VER
ENV LANG C.UTF-8
RUN mkdir buildout
WORKDIR /buildout
COPY Makefile Makefile.configure /buildout/
RUN mkdir /home/buildout/sandbox
WORKDIR /home/buildout/sandbox
COPY Makefile Makefile.configure /home/buildout/sandbox/
RUN make PYTHON_VER=${PYTHON_VER} download_python
RUN make PYTHON_VER=${PYTHON_VER} python
FROM debian-python
ARG PYTHON_VER
COPY doc /buildout/doc
COPY src /buildout/src
COPY zc.recipe.egg_ /buildout/zc.recipe.egg_
COPY setup.* dev.py *.rst *.txt buildout.cfg .coveragerc /buildout/
COPY doc /home/buildout/sandbox/doc
COPY src /home/buildout/sandbox/src
COPY zc.recipe.egg_ /home/buildout/sandbox/zc.recipe.egg_
COPY setup.* dev.py *.rst *.txt buildout.cfg .coveragerc /home/buildout/sandbox/
USER root
RUN chown -R buildout:buildout *
USER buildout
RUN make PYTHON_VER=${PYTHON_VER} build
FROM debian:stable-slim as debian-python
RUN apt-get update
RUN apt-get install -y gcc python3-dev python3-certifi
RUN mkdir buildout
WORKDIR /buildout
RUN useradd -ms /bin/bash buildout
USER buildout
RUN mkdir /home/buildout/sandbox
WORKDIR /home/buildout/sandbox
FROM debian-python
ARG PYTHON_VER
COPY doc /buildout/doc
COPY src /buildout/src
COPY zc.recipe.egg_ /buildout/zc.recipe.egg_
COPY setup.* dev.py *.rst *.txt buildout.cfg .coveragerc /buildout/
COPY doc /home/buildout/sandbox/doc
COPY src /home/buildout/sandbox/src
COPY zc.recipe.egg_ /home/buildout/sandbox/zc.recipe.egg_
COPY setup.* dev.py *.rst *.txt buildout.cfg .coveragerc /home/buildout/sandbox/
USER root
RUN chown -R buildout:buildout *
USER buildout
RUN python3 dev.py
......@@ -131,15 +131,15 @@ all_test:
docker:
docker build -f .github/workflows/Dockerfile --tag centos_buildout:python${PYTHON_VER} --build-arg PYTHON_VER=${PYTHON_VER} .
docker run centos_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /buildout/bin/test -c -vvv -t abi'
docker run centos_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /home/buildout/sandbox/bin/test -c -vvv -t abi'
docker_deb:
docker build -f .github/workflows/Dockerfile-debian --tag debian_buildout:python${PYTHON_VER} --build-arg PYTHON_VER=${PYTHON_VER} .
docker run debian_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /buildout/bin/test -c -vvv -t abi'
docker run debian_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /home/buildout/sandbox/bin/test -c -vvv -t abi'
docker_deb_sys:
docker build -f .github/workflows/Dockerfile-debian-system --tag debian_system_buildout .
docker run debian_system_buildout /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /buildout/bin/test -c -vvv -t abi'
docker run debian_system_buildout /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /home/buildout/sandbox/bin/test -c -vvv -t abi'
clean:
rm -rf $(HERE)/venvs $(PYTHON_BUILD_DIR) $(HERE)/pythons
......@@ -5,4 +5,4 @@ set -e
cd ../..
docker build -f .github/workflows/Dockerfile --tag centos_buildout:python${PYTHON_VER} --build-arg PYTHON_VER=${PYTHON_VER} .
docker run centos_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /buildout/bin/test -c -vvv'
docker run centos_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /home/buildout/sandbox/bin/test -c -vvv'
......@@ -5,4 +5,4 @@ set -e
cd ../..
docker build -f .github/workflows/Dockerfile-debian --tag debian_buildout:python${PYTHON_VER} --build-arg PYTHON_VER=${PYTHON_VER} .
docker run debian_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /buildout/bin/test -c -vvv'
docker run debian_buildout:python${PYTHON_VER} /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /home/buildout/sandbox/bin/test -c -vvv'
......@@ -5,4 +5,4 @@ set -e
cd ../..
docker build -f .github/workflows/Dockerfile-debian-system --tag debian_system_buildout .
docker run debian_system_buildout /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /buildout/bin/test -c -vvv'
docker run debian_system_buildout /bin/bash -c 'RUN_COVERAGE= COVERAGE_REPORT= /home/buildout/sandbox/bin/test -c -vvv'
......@@ -38,6 +38,7 @@ if os.path.isfile(bin_buildout):
if os.path.isdir('build'):
shutil.rmtree('build')
print("Current directory %s" % os.getcwd())
#######################################################################
def install_pip():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment