diff --git a/.gitlab/container_build/docker_linux.yml b/.gitlab/container_build/docker_linux.yml index df83b97171cb8..5f5c83c0dce67 100644 --- a/.gitlab/container_build/docker_linux.yml +++ b/.gitlab/container_build/docker_linux.yml @@ -61,7 +61,7 @@ docker_build_agent7: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7 - BUILD_ARG: --target test --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz + BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz single_machine_performance-amd64-a7: extends: .docker_publish_job_definition @@ -87,7 +87,7 @@ docker_build_agent7_arm64: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7 - BUILD_ARG: --target test --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz + BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz # build agent7 jmx image docker_build_agent7_jmx: @@ -101,7 +101,7 @@ docker_build_agent7_jmx: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7-jmx - BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz + BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz docker_build_agent7_jmx_arm64: extends: [.docker_build_job_definition_arm64, .docker_build_artifact] @@ -114,7 +114,7 @@ docker_build_agent7_jmx_arm64: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7-jmx - BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz + BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz # build agent7 UA image docker_build_ot_agent7: @@ -128,7 +128,7 @@ docker_build_ot_agent7: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7-ot-beta - BUILD_ARG: --target test --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-amd64.tar.xz + BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-amd64.tar.xz docker_build_ot_agent7_arm64: extends: [.docker_build_job_definition_arm64, .docker_build_artifact] @@ -141,7 +141,7 @@ docker_build_ot_agent7_arm64: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7-ot-beta - BUILD_ARG: --target test --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-arm64.tar.xz + BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-arm64.tar.xz # build agent7 jmx image docker_build_ot_agent7_jmx: @@ -155,7 +155,7 @@ docker_build_ot_agent7_jmx: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7-ot-beta-jmx - BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-amd64.tar.xz + BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-amd64.tar.xz docker_build_ot_agent7_jmx_arm64: extends: [.docker_build_job_definition_arm64, .docker_build_artifact] @@ -168,7 +168,7 @@ docker_build_ot_agent7_jmx_arm64: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent TAG_SUFFIX: -7-ot-beta-jmx - BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-arm64.tar.xz + BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-arm64.tar.xz # build the cluster-agent image docker_build_cluster_agent_amd64: diff --git a/Dockerfiles/agent/Dockerfile b/Dockerfiles/agent/Dockerfile index 894a29f2d250e..bf99bef8e05a1 100644 --- a/Dockerfiles/agent/Dockerfile +++ b/Dockerfiles/agent/Dockerfile @@ -39,7 +39,6 @@ RUN gcc -pipe -Wall -Wextra -O2 -shared -fPIC -Wl,--version-script=/tmp/nosys.sy FROM baseimage AS extract ARG TARGETARCH ARG WITH_JMX -ARG PYTHON_VERSION ARG DD_AGENT_ARTIFACT=datadog-agent*-$TARGETARCH.tar.xz ARG GENERAL_ARTIFACTS_CACHE_BUCKET_URL @@ -75,25 +74,6 @@ RUN find / -maxdepth 1 -name "${DD_AGENT_ARTIFACT}" -exec tar xvf {} -C . \; \ opt/datadog-agent/embedded/share/man \ # self-test certificates that are detected (false positive) as private keys opt/datadog-agent/embedded/lib/python*/site-packages/future/backports/test \ - && if [ "$PYTHON_VERSION" = "2" ]; then \ - rm -rf \ - opt/datadog-agent/embedded/bin/2to3-3* \ - opt/datadog-agent/embedded/bin/easy_install-3* \ - opt/datadog-agent/embedded/bin/idle* \ - opt/datadog-agent/embedded/bin/pip3* \ - opt/datadog-agent/embedded/bin/pydoc* \ - opt/datadog-agent/embedded/bin/python3* \ - opt/datadog-agent/embedded/bin/pyvenv* \ - opt/datadog-agent/embedded/include/python3* \ - opt/datadog-agent/embedded/lib/*python3* || true ;\ - fi \ - && if [ "$PYTHON_VERSION" = "3" ]; then \ - rm -rf \ - opt/datadog-agent/embedded/bin/pip2* \ - opt/datadog-agent/embedded/bin/python2* \ - opt/datadog-agent/embedded/include/python2* \ - opt/datadog-agent/embedded/lib/*python2* || true ;\ - fi \ && find opt/datadog-agent/ -iname "*.a" -delete \ && if [ -z "$WITH_JMX" ]; then rm -rf opt/datadog-agent/bin/agent/dist/jmx; fi \ && mkdir conf.d checks.d @@ -116,11 +96,9 @@ RUN if [ -n "$WITH_JMX" ]; then cd /opt/bouncycastle-fips && mvn dependency:copy FROM baseimage AS release LABEL maintainer="Datadog " ARG WITH_JMX -ARG PYTHON_VERSION ARG DD_GIT_REPOSITORY_URL ARG DD_GIT_COMMIT_SHA ENV DOCKER_DD_AGENT=true \ - DD_PYTHON_VERSION=$PYTHON_VERSION \ PATH=/opt/datadog-agent/bin/agent/:/opt/datadog-agent/embedded/bin/:$PATH \ CURL_CA_BUNDLE=/opt/datadog-agent/embedded/ssl/certs/cacert.pem \ # Pass envvar variables to agents @@ -202,13 +180,6 @@ RUN tar xzf s6.tgz -C / --exclude="./bin" \ # * https://datadoghq.atlassian.net/wiki/spaces/TS/pages/2615709591/Why+the+containerized+Agent+runs+as+root#Agent-user RUN [ "$(getent passwd dd-agent | cut -d: -f 3)" -eq 100 ] -# Update links to python binaries -RUN if [ -n "$PYTHON_VERSION" ]; then \ - ln -sfn /opt/datadog-agent/embedded/bin/python${PYTHON_VERSION} /opt/datadog-agent/embedded/bin/python \ - && ln -sfn /opt/datadog-agent/embedded/bin/python${PYTHON_VERSION}-config /opt/datadog-agent/embedded/bin/python-config \ - && ln -sfn /opt/datadog-agent/embedded/bin/pip${PYTHON_VERSION} /opt/datadog-agent/embedded/bin/pip ; \ - fi - # Override the exit script by ours to fix --pid=host operations RUN mv /etc/s6/init/init-stage3 /etc/s6/init/init-stage3-original COPY init-stage3 /etc/s6/init/init-stage3 diff --git a/tasks/agent.py b/tasks/agent.py index af988249697a8..3399e4d7c4a58 100644 --- a/tasks/agent.py +++ b/tasks/agent.py @@ -12,7 +12,7 @@ import tempfile from invoke import task -from invoke.exceptions import Exit, ParseError +from invoke.exceptions import Exit from tasks.build_tags import filter_incompatible_tags, get_build_tags, get_default_build_tags from tasks.devcontainer import run_on_devcontainer @@ -359,15 +359,10 @@ def system_tests(_): @task -def image_build(ctx, arch='amd64', base_dir="omnibus", python_version="2", skip_tests=False, tag=None, push=False): +def image_build(ctx, arch='amd64', base_dir="omnibus", skip_tests=False, tag=None, push=False): """ Build the docker image """ - BOTH_VERSIONS = ["both", "2+3"] - VALID_VERSIONS = ["2", "3"] + BOTH_VERSIONS - if python_version not in VALID_VERSIONS: - raise ParseError("provided python_version is invalid") - build_context = "Dockerfiles/agent" base_dir = base_dir or os.environ["OMNIBUS_BASE_DIR"] pkg_dir = os.path.join(base_dir, 'pkg') @@ -386,8 +381,6 @@ def image_build(ctx, arch='amd64', base_dir="omnibus", python_version="2", skip_ tag = AGENT_TAG common_build_opts = f"-t {tag} -f {dockerfile_path}" - if python_version not in BOTH_VERSIONS: - common_build_opts = f"{common_build_opts} --build-arg PYTHON_VERSION={python_version}" # Build with the testing target if not skip_tests: