Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Go 1.19.10 and handle changes in golang Debian base image #35780

Merged
merged 13 commits into from
Jun 20, 2023
Merged
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19.9
1.19.10
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ linters-settings:

gosimple:
# Select the Go version to target. The default is '1.13'.
go: "1.19.9"
go: "1.19.10"

nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
Expand All @@ -126,19 +126,19 @@ linters-settings:

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.19.9"
go: "1.19.10"
checks: ["all"]

stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.19.9"
go: "1.19.10"
# Disabled:
# ST1005: error strings should not be capitalized
checks: ["all", "-ST1005"]

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.19.9"
go: "1.19.10"

gosec:
excludes:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
==== Breaking changes

*Affecting all Beats*
- Update Go version to 1.19.10 {pull}35751[35751]
- Fix status reporting to Elastic-Agent when output configuration is invalid running under Elastic-Agent {pull}35719[35719]

*Auditbeat*
Expand Down
9 changes: 8 additions & 1 deletion auditbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19.9
FROM golang:1.19.10

RUN \
apt-get update \
Expand All @@ -10,6 +10,13 @@ RUN \
iproute2 \
&& 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
7 changes: 7 additions & 0 deletions dev-tools/mage/pytest.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ func pythonVirtualenvPath() (string, error) {

pythonVirtualenvDir = info.RootDir
}

// If VIRTUAL_ENV is set we are already in a virtual environment.
virtualEnvVar := os.Getenv("VIRTUAL_ENV")
if virtualEnvVar != "" {
return virtualEnvVar, nil
}

pythonVirtualenvDir = filepath.Join(pythonVirtualenvDir, "build/ve")

// Use OS and docker specific virtualenv's because the interpreter in
Expand Down
11 changes: 9 additions & 2 deletions heartbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
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 \
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
RUN pip3 install --upgrade PyYAML==6.0.0

# Setup work environment
ENV HEARTBEAT_PATH /go/src/github.com/elastic/beats/heartbeat
Expand Down
2 changes: 1 addition & 1 deletion libbeat/docs/version.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:stack-version: 8.9.0
:doc-branch: master
:go-version: 1.19.9
:go-version: 1.19.10
:release-state: unreleased
:python: 3.7
:docker: 1.12
Expand Down
5 changes: 2 additions & 3 deletions libbeat/tests/system/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ ordered-set==3.1.1
packaging==20.4
parameterized==0.7.0
pluggy==0.13.1
py==1.10.0
py==1.11.0
pycodestyle==2.6.0
pyparsing==2.4.7
pyrsistent==0.16.0
pytest==7.1.3
Copy link
Member Author

@cmacknz cmacknz Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded along with py to fix pytest-dev/apipkg#30

I removed the pytest-otel dependency since it was pinning us to pytest 7.1.3 and wouldn't let me upgrade. I'm not sure it is strictly necessary anyway.

Apparently we own the pytest-otel package, I think we need to loosen the dependency to require pytest >= 7.1.3 instead of pytest == 7.1.3 if we can. FYI @kuisathaverat

https://github.com/elastic/apm-pipeline-library/blob/cd076539fb75e75ca1a7fe740e5fac0abbf569f8/resources/scripts/pytest_otel/pyproject.toml#L5

dependencies = [
    "opentelemetry-api==1.15.0",
    "opentelemetry-exporter-otlp==1.15.0",
    "opentelemetry-sdk==1.15.0",
    "pytest==7.1.3",
]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the pytest-otel, your team is not using the OpenTelemetry data the plugin reports.

pytest-otel==1.3.0
pytest==7.3.2
pytest-rerunfailures==9.1.1
pytest-timeout==1.4.2
PyYAML==5.4.1
Expand Down
5 changes: 2 additions & 3 deletions libbeat/tests/system/requirements_aix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ ordered-set==3.1.1
packaging==20.4
parameterized==0.7.0
pluggy==0.13.1
py==1.10.0
py==1.11.0
pycodestyle==2.6.0
pyparsing==2.4.7
pyrsistent==0.16.0
pytest==7.1.3
pytest-otel==1.3.0
pytest==7.3.2
pytest-rerunfailures==9.1.1
pytest-timeout==1.4.2
PyYAML==5.4.1
Expand Down
13 changes: 9 additions & 4 deletions metricbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM golang:1.19.9
FROM golang:1.19.10

RUN \
apt update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends \
netcat \
netcat-openbsd \
python3 \
python3-dev \
python3-pip \
Expand All @@ -12,9 +12,16 @@ RUN \
unzip \
&& 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

# Oracle instant client
RUN cd /usr/lib \
Expand All @@ -23,7 +30,5 @@ RUN cd /usr/lib \
&& rm instantclient-basic-linux.zip
ENV LD_LIBRARY_PATH=/usr/lib/instantclient_19_6

ENV PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/oracle/12.2/client64/bin

# Add healthcheck for the docker/healthcheck metricset to check during testing.
HEALTHCHECK CMD exit 0
2 changes: 1 addition & 1 deletion metricbeat/module/aerospike/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG AEROSPIKE_VERSION
FROM aerospike:${AEROSPIKE_VERSION}

RUN apt-get update && apt-get install -y netcat
RUN apt-get update && apt-get install -y netcat-openbsd
HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 3000
2 changes: 1 addition & 1 deletion metricbeat/module/haproxy/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG HAPROXY_VERSION
FROM haproxy:${HAPROXY_VERSION}
RUN apt-get update && apt-get install -y netcat
RUN apt-get update && apt-get install -y netcat-openbsd

HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 14567 && nc -z localhost 14570

Expand Down
6 changes: 3 additions & 3 deletions metricbeat/module/kafka/_meta/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ ENV TERM=linux
# TODO: use newer base
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list \
&& sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list \
&& sed -i '/stretch-updates/d' /etc/apt/sources.list
RUN apt-get update && apt-get install -y curl openjdk-8-jre-headless netcat dnsutils
&& sed -i '/stretch-updates/d' /etc/apt/sources.list

RUN apt-get update && apt-get install -y curl openjdk-8-jre-headless netcat-openbsd dnsutils

RUN mkdir -p ${KAFKA_LOGS_DIR} && mkdir -p ${KAFKA_HOME} && \
curl -J -L -s -f -o - https://github.com/kadwanev/retry/releases/download/1.0.1/retry-1.0.1.tar.gz | tar xfz - -C /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/mongodb/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG MONGODB_VERSION
FROM mongo:${MONGODB_VERSION}
RUN apt update && yes | apt install netcat
RUN apt update && yes | apt install netcat-openbsd
HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 27017
2 changes: 1 addition & 1 deletion metricbeat/module/munin/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y munin-node netcat && \
apt-get install -y munin-node netcat-openbsd && \
apt-get clean && rm rm -rf /var/lib/apt/lists/*

EXPOSE 4949
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/rabbitmq/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG RABBITMQ_VERSION
FROM rabbitmq:${RABBITMQ_VERSION}-management

RUN apt-get update && apt-get install -y netcat && apt-get clean
RUN apt-get update && apt-get install -y netcat-openbsd && apt-get clean
HEALTHCHECK --interval=1s --retries=90 CMD nc -w 1 -v 127.0.0.1 15672 </dev/null
EXPOSE 15672
11 changes: 9 additions & 2 deletions packetbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19.9
FROM golang:1.19.10

RUN \
apt-get update \
Expand All @@ -7,10 +7,17 @@ RUN \
python3-pip \
python3-venv \
librpm-dev \
netcat \
netcat-openbsd \
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
2 changes: 1 addition & 1 deletion testing/environments/docker/kafka/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV KAFKA_VERSION 2.2.2
ENV _JAVA_OPTIONS "-Djava.net.preferIPv4Stack=true"
ENV TERM=linux

RUN apt-get update && apt-get install -y curl openjdk-11-jre-headless netcat
RUN apt-get update && apt-get install -y curl openjdk-11-jre-headless netcat-openbsd

RUN mkdir -p ${KAFKA_LOGS_DIR} && mkdir -p ${KAFKA_HOME} && \
curl -J -L -s -f -o - https://github.com/kadwanev/retry/releases/download/1.0.1/retry-1.0.1.tar.gz | tar xfz - -C /usr/local/bin && \
Expand Down
11 changes: 9 additions & 2 deletions x-pack/functionbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
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 \
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
RUN pip3 install --upgrade PyYAML==6.0.0

# Setup work environment
ENV FUNCTIONBEAT_PATH /go/src/github.com/elastic/beats/x-pack/functionbeat
Expand Down