From 24821ee789ca571a5ee6c021deabf27c54338086 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 3 Dec 2019 12:02:54 +0100 Subject: [PATCH 1/2] Make independent python virtualenvs in docker System tests running in docker are using the same virtual environment as the host. If version of python in the virtual environment is not available in the guest, it will use the default in the system, that is so far Python 2. --- auditbeat/Dockerfile | 3 +++ filebeat/Dockerfile | 3 +++ heartbeat/Dockerfile | 4 +++- journalbeat/Dockerfile | 4 +++- libbeat/Dockerfile | 2 +- libbeat/scripts/Makefile | 2 +- libbeat/tests/system/requirements.txt | 1 + metricbeat/Dockerfile | 3 +++ x-pack/functionbeat/Dockerfile | 4 +++- x-pack/libbeat/Dockerfile | 4 +++- 10 files changed, 24 insertions(+), 6 deletions(-) diff --git a/auditbeat/Dockerfile b/auditbeat/Dockerfile index bf87abbc477..9d70d3d7458 100644 --- a/auditbeat/Dockerfile +++ b/auditbeat/Dockerfile @@ -5,9 +5,12 @@ RUN \ && apt-get install -y --no-install-recommends \ python-pip \ virtualenv \ + python3 \ librpm-dev \ && rm -rf /var/lib/apt/lists/* +ENV PYTHON_ENV=/tmp/python-env + RUN pip install --upgrade pip RUN pip install --upgrade setuptools RUN pip install --upgrade docker-compose==1.23.2 diff --git a/filebeat/Dockerfile b/filebeat/Dockerfile index eba3e1b8b16..2e6686a79d9 100644 --- a/filebeat/Dockerfile +++ b/filebeat/Dockerfile @@ -7,9 +7,12 @@ RUN \ python-pip \ rsync \ virtualenv \ + python3 \ libpcap-dev \ && rm -rf /var/lib/apt/lists/* +ENV PYTHON_ENV=/tmp/python-env + RUN pip install --upgrade pip RUN pip install --upgrade setuptools RUN pip install --upgrade docker-compose==1.23.2 diff --git a/heartbeat/Dockerfile b/heartbeat/Dockerfile index 519acf8d140..f89269c82d9 100644 --- a/heartbeat/Dockerfile +++ b/heartbeat/Dockerfile @@ -4,9 +4,11 @@ MAINTAINER Nicolas Ruflin RUN set -x && \ apt-get update && \ apt-get install -y --no-install-recommends \ - netcat python-pip virtualenv && \ + netcat python-pip virtualenv python3 && \ apt-get clean +ENV PYTHON_ENV=/tmp/python-env + RUN pip install --upgrade pip RUN pip install --upgrade setuptools RUN pip install --upgrade docker-compose==1.23.2 diff --git a/journalbeat/Dockerfile b/journalbeat/Dockerfile index a279665fb05..7719962c16f 100644 --- a/journalbeat/Dockerfile +++ b/journalbeat/Dockerfile @@ -4,9 +4,11 @@ MAINTAINER Noémi Ványi RUN set -x && \ apt-get update && \ apt-get install -y --no-install-recommends \ - python-pip virtualenv libsystemd-dev libc6-dev-i386 gcc-arm-linux-gnueabi && \ + python-pip virtualenv python3 libsystemd-dev libc6-dev-i386 gcc-arm-linux-gnueabi && \ apt-get clean +ENV PYTHON_ENV=/tmp/python-env + RUN pip install --upgrade setuptools # Setup work environment diff --git a/libbeat/Dockerfile b/libbeat/Dockerfile index 2388d90a1e2..49c9e076991 100644 --- a/libbeat/Dockerfile +++ b/libbeat/Dockerfile @@ -5,7 +5,7 @@ MAINTAINER Nicolas Ruflin RUN set -x && \ apt-get update && \ apt-get install -y --no-install-recommends \ - netcat python-pip virtualenv libpcap-dev && \ + netcat python-pip virtualenv python3 libpcap-dev && \ apt-get clean ENV PYTHON_ENV=/tmp/python-env diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index fe87b9f9d2a..87d632230d7 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -208,7 +208,7 @@ system-tests: prepare-tests ${BEAT_NAME}.test python-env .PHONY: system-tests-environment system-tests-environment: ## @testing Runs the system tests inside a virtual environment. This can be run on any docker-machine (local, remote) system-tests-environment: prepare-tests build-image - ${DOCKER_COMPOSE} run -e INTEGRATION_TESTS=1 -e TESTING_ENVIRONMENT=${TESTING_ENVIRONMENT} -e DOCKER_COMPOSE_PROJECT_NAME=${DOCKER_COMPOSE_PROJECT_NAME} beat make system-tests + ${DOCKER_COMPOSE} run -e INTEGRATION_TESTS=1 -e TESTING_ENVIRONMENT=${TESTING_ENVIRONMENT} -e DOCKER_COMPOSE_PROJECT_NAME=${DOCKER_COMPOSE_PROJECT_NAME} -e PYTHON_EXE=${PYTHON_EXE} beat make system-tests .PHONY: fast-system-tests fast-system-tests: ## @testing Runs system tests without coverage reports and in parallel diff --git a/libbeat/tests/system/requirements.txt b/libbeat/tests/system/requirements.txt index b8f35144e50..af82a835ee5 100644 --- a/libbeat/tests/system/requirements.txt +++ b/libbeat/tests/system/requirements.txt @@ -20,6 +20,7 @@ nose==1.3.7 nose-timer==0.7.1 pycodestyle==2.4.0 PyYAML==4.2b1 +Pillow==6.2.1 redis==2.10.6 requests==2.20.0 six==1.11.0 diff --git a/metricbeat/Dockerfile b/metricbeat/Dockerfile index ec22de2743c..fe6df44de02 100644 --- a/metricbeat/Dockerfile +++ b/metricbeat/Dockerfile @@ -6,8 +6,11 @@ RUN \ netcat \ python-pip \ virtualenv \ + python3 \ && rm -rf /var/lib/apt/lists/* +ENV PYTHON_ENV=/tmp/python-env + RUN pip install --upgrade pip RUN pip install --upgrade setuptools RUN pip install --upgrade docker-compose==1.23.2 diff --git a/x-pack/functionbeat/Dockerfile b/x-pack/functionbeat/Dockerfile index 5bfafa0a08c..417c46bf537 100644 --- a/x-pack/functionbeat/Dockerfile +++ b/x-pack/functionbeat/Dockerfile @@ -4,9 +4,11 @@ MAINTAINER Pier-Hugues Pellerin RUN set -x && \ apt-get update && \ apt-get install -y --no-install-recommends \ - netcat python-pip rsync virtualenv && \ + netcat python-pip rsync virtualenv python3 && \ apt-get clean +ENV PYTHON_ENV=/tmp/python-env + RUN pip install --upgrade setuptools # Setup work environment diff --git a/x-pack/libbeat/Dockerfile b/x-pack/libbeat/Dockerfile index 9966dd86f16..d1e1ca6844a 100644 --- a/x-pack/libbeat/Dockerfile +++ b/x-pack/libbeat/Dockerfile @@ -3,9 +3,11 @@ FROM golang:1.13.4 RUN set -x && \ apt-get update && \ apt-get install -y --no-install-recommends \ - netcat python-pip rsync virtualenv && \ + netcat python-pip rsync virtualenv python3 && \ apt-get clean +ENV PYTHON_ENV=/tmp/python-env + RUN pip install --upgrade setuptools # Setup work environment From 4e03237e39e9f7dbcb8ddd0f38700231a31c4c72 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 3 Dec 2019 12:37:36 +0100 Subject: [PATCH 2/2] Pillow 6.2.1 is not supported by python version in Travis --- libbeat/tests/system/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbeat/tests/system/requirements.txt b/libbeat/tests/system/requirements.txt index af82a835ee5..470a306f956 100644 --- a/libbeat/tests/system/requirements.txt +++ b/libbeat/tests/system/requirements.txt @@ -20,7 +20,7 @@ nose==1.3.7 nose-timer==0.7.1 pycodestyle==2.4.0 PyYAML==4.2b1 -Pillow==6.2.1 +Pillow==5.4.1 redis==2.10.6 requests==2.20.0 six==1.11.0