From 84e64e22b18ef6da90292caa86e00f7a393f363c Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 29 Jun 2023 07:02:19 +0200 Subject: [PATCH] Update Docker images that are not included in the automation (#35940) So, we don't have security reports from Snyk. --- filebeat/Dockerfile | 12 +++++++++--- filebeat/magefile.go | 3 +++ libbeat/Dockerfile | 12 ++++++++---- x-pack/filebeat/magefile.go | 3 +++ x-pack/libbeat/Dockerfile | 12 ++++++++---- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/filebeat/Dockerfile b/filebeat/Dockerfile index d048ad97af9..e28f8567272 100644 --- a/filebeat/Dockerfile +++ b/filebeat/Dockerfile @@ -1,10 +1,10 @@ -FROM golang:1.19.9 +FROM golang:1.19.10 RUN \ apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ libsystemd-dev \ - netcat \ + netcat-openbsd \ rsync \ python3 \ python3-pip \ @@ -12,6 +12,12 @@ RUN \ libpcap-dev \ && rm -rf /var/lib/apt/lists/* +# Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts +# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +ENV VIRTUAL_ENV=/opt/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + RUN pip3 install --upgrade pip==20.1.1 -RUN pip3 install --upgrade setuptools==47.3.2 RUN pip3 install --upgrade docker-compose==1.23.2 +RUN pip3 install --upgrade PyYAML==6.0.0 diff --git a/filebeat/magefile.go b/filebeat/magefile.go index 4938fa76786..16ae678e594 100644 --- a/filebeat/magefile.go +++ b/filebeat/magefile.go @@ -214,6 +214,9 @@ func PythonIntegTest(ctx context.Context) error { mg.Deps(devtools.BuildSystemTestBinary) args := devtools.DefaultPythonTestIntegrationArgs() args.Env["MODULES_PATH"] = devtools.CWD("module") + // Always create a fresh virtual environment when running tests in a container, until we get + // get the requirements installed as part of the container build. + args.ForceCreateVenv = true return devtools.PythonTest(args) }) } diff --git a/libbeat/Dockerfile b/libbeat/Dockerfile index a3078d590d0..822ffa970df 100644 --- a/libbeat/Dockerfile +++ b/libbeat/Dockerfile @@ -1,18 +1,22 @@ -FROM golang:1.19.9 +FROM golang:1.19.10 RUN \ apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - netcat \ + netcat-openbsd \ libpcap-dev \ python3 \ python3-pip \ python3-venv \ && rm -rf /var/lib/apt/lists/* +# Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts +# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +ENV VIRTUAL_ENV=/opt/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + RUN pip3 install --upgrade pip==20.1.1 -RUN pip3 install --upgrade setuptools==47.3.2 -RUN pip3 install --upgrade docker-compose==1.23.2 # Libbeat specific RUN mkdir -p /etc/pki/tls/certs diff --git a/x-pack/filebeat/magefile.go b/x-pack/filebeat/magefile.go index e6941c3c998..bb0908af571 100644 --- a/x-pack/filebeat/magefile.go +++ b/x-pack/filebeat/magefile.go @@ -183,6 +183,9 @@ func PythonIntegTest(ctx context.Context) error { mg.Deps(devtools.BuildSystemTestBinary) args := devtools.DefaultPythonTestIntegrationArgs() args.Env["MODULES_PATH"] = devtools.CWD("module") + // Always create a fresh virtual environment when running tests in a container, until we get + // get the requirements installed as part of the container build. + args.ForceCreateVenv = true return devtools.PythonTest(args) }) } diff --git a/x-pack/libbeat/Dockerfile b/x-pack/libbeat/Dockerfile index 28acaba8b74..daaf5073a2c 100644 --- a/x-pack/libbeat/Dockerfile +++ b/x-pack/libbeat/Dockerfile @@ -1,18 +1,22 @@ -FROM golang:1.19.5 +FROM golang:1.19.10 RUN \ apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - netcat \ + netcat-openbsd \ rsync \ python3 \ python3-pip \ python3-venv \ && rm -rf /var/lib/apt/lists/* +# Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts +# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +ENV VIRTUAL_ENV=/opt/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + RUN pip3 install --upgrade pip==20.1.1 -RUN pip3 install --upgrade setuptools==47.3.2 -RUN pip3 install --upgrade docker-compose==1.23.2 # Setup work environment ENV LIBBEAT_PATH /go/src/github.com/elastic/beats/x-pack/libbeat