diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f89f21ad..ad984e50 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -218,7 +218,7 @@ trigger_build_kernels: - git clone -b $AGENT_TESTING_BRANCH https://github.com/DataDog/datadog-agent /go/src/github.com/DataDog/datadog-agent - cd /go/src/github.com/DataDog/datadog-agent - VERSION="nightly" - - source /root/.bashrc && conda activate ddpy3 + - source /root/.bashrc - inv -e deps script: - inv -e agent.omnibus-build --release-version "$VERSION" --major-version "6" --python-runtimes "2,3" --base-dir /.omnibus --skip-deps diff --git a/deb-arm/Dockerfile b/deb-arm/Dockerfile index 824fa548..5ead63ce 100644 --- a/deb-arm/Dockerfile +++ b/deb-arm/Dockerfile @@ -16,7 +16,7 @@ RUN echo "${CURL_AARCH64_SHA256} curl-aarch64" | sha256sum --check FROM ${BASE_IMAGE} # Build Args -ARG GIMME_GO_VERSION=1.19.9 +ARG GO_VERSION=1.19.9 ARG CMAKE_VERSION=3.23.0 ARG CMAKE_SHA256="9f8d42ef0b33d1bea47afe15875435dac58503d6a3b58842b473fd811e6df172" ARG CLANG_VERSION=8.0.0 @@ -78,22 +78,23 @@ RUN if [ "$DD_TARGET_ARCH" = "aarch64" ] ; then \ /bin/bash -l -c "rvm install --with-openssl-dir=${CONDA_PATH} --with-arch='armv7-a' -C '--build' -C 'arm-linux-gnueabihf' 2.7 && rvm cleanup all" ; \ fi RUN /bin/bash -l -c "gem install bundler --no-document" +RUN echo 'source /usr/local/rvm/scripts/rvm' >> /root/.bashrc -# Gimme -RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/v1.5.4/gimme -RUN echo "03b295636d4e22870b6f6e9bc06a71d65311ae90d3d48cbc7071f82dd5837fbc /bin/gimme" | sha256sum --check -RUN chmod +x /bin/gimme - -# GIMME_ARCH = GOARCH, so must be a valid entry from `goarchlist` here: -# https://github.com/golang/go/blob/master/src/go/build/syslist.go -# Also see https://github.com/travis-ci/gimme/blob/master/gimme#L880 +# Go RUN if [ "$DD_TARGET_ARCH" = "aarch64" ] ; then \ - GIMME_ARCH=arm64 gimme $GIMME_GO_VERSION ; \ - else \ - GIMME_ARCH=arm gimme $GIMME_GO_VERSION ; \ - fi + curl -sL -o /tmp/golang.tar.gz https://go.dev/dl/go$GO_VERSION.linux-arm64.tar.gz \ + && echo "b947e457be9d7b52a082c68e42b6939f9cc151f1ad5b3d8fd646ca3352f6f2f1 /tmp/golang.tar.gz" | sha256sum --check \ + && tar -C /usr/local -xzf /tmp/golang.tar.gz \ + && rm -f /tmp/golang.tar.gz ; fi + +RUN if [ "$DD_TARGET_ARCH" = "armhf" ] ; then \ + curl -sL -o /tmp/golang.tar.gz https://go.dev/dl/go$GO_VERSION.linux-armv6l.tar.gz \ + && echo "4a613b3c9d74975470096c5323e54db0f5f0f56dd0471fc1a7ee04e559032dc4 /tmp/golang.tar.gz" | sha256sum --check \ + && tar -C /usr/local -xzf /tmp/golang.tar.gz \ + && rm -f /tmp/golang.tar.gz ; fi -COPY ./gobin.sh /etc/profile.d/ +ENV PATH="/usr/local/go/bin:${PATH}" +ENV PATH="${GOPATH}/bin:${PATH}" # CMake RUN if [ "$DD_TARGET_ARCH" = "aarch64" ] ; then set -ex \ @@ -119,14 +120,5 @@ RUN if [ "$DD_TARGET_ARCH" = "aarch64" ] ; then set -ex \ && /build-gcc.sh \ && rm /build-gcc.sh ; fi -# Entrypoint -COPY ./entrypoint.sh / -RUN chmod +x /entrypoint.sh - -# create the agent build folder within $GOPATH -RUN mkdir -p /go/src/github.com/DataDog/datadog-agent - # Force umask to 0022 RUN echo "umask 0022" >> /root/.bashrc - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/deb-x64/Dockerfile b/deb-x64/Dockerfile index b6b499a1..df175389 100644 --- a/deb-x64/Dockerfile +++ b/deb-x64/Dockerfile @@ -127,6 +127,7 @@ RUN curl -sSL -o get-rvm.sh https://raw.githubusercontent.com/rvm/rvm/1.29.12/bi RUN /bin/bash -l -c "rvm requirements" RUN /bin/bash -l -c "rvm install 2.7 --with-openssl-dir=${CONDA_PATH} && rvm cleanup all" RUN /bin/bash -l -c "gem install bundler --no-document" +RUN echo 'source /usr/local/rvm/scripts/rvm' >> /root/.bashrc # CMake RUN set -ex \ @@ -158,7 +159,9 @@ RUN curl -Sl -O https://dd-agent-omnibus.s3.amazonaws.com/kernel-4.9-headers-deb # TODO: investigate if we could use gvm to do this for us. COPY ./setup_go.sh /setup_go.sh RUN ./setup_go.sh -COPY ./gobin.sh /etc/profile.d/ + +ENV PATH="/goroot/bin:$PATH" +ENV PATH="/go/bin:$PATH" # Download and install golangci-lint RUN curl -sSfL -o golangci-lint-install.sh https://raw.githubusercontent.com/golangci/golangci-lint/v1.44.2/install.sh \ @@ -195,14 +198,8 @@ RUN chmod +x /build-gcc.sh \ && /build-gcc.sh \ && rm /build-gcc.sh -# Entrypoint -COPY ./entrypoint.sh / -RUN chmod +x /entrypoint.sh - # create the agent build folder within $GOPATH RUN mkdir -p /go/src/github.com/DataDog/datadog-agent # Force umask to 0022 RUN echo "umask 0022" >> /root/.bashrc - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/rpm-arm64/Dockerfile b/rpm-arm64/Dockerfile index b74719df..3740fd46 100644 --- a/rpm-arm64/Dockerfile +++ b/rpm-arm64/Dockerfile @@ -10,7 +10,7 @@ RUN echo "${CACERT_BUNDLE_SHA256} /cacert.pem" | sha256sum --check FROM ${BASE_IMAGE} # Build Args -ARG GIMME_GO_VERSION=1.19.9 +ARG GO_VERSION=1.19.9 ARG CMAKE_VERSION=3.23.0 ARG CMAKE_SHA256="9f8d42ef0b33d1bea47afe15875435dac58503d6a3b58842b473fd811e6df172" ARG CLANG_VERSION=8.0.0 @@ -21,7 +21,7 @@ ARG GCC_SHA256=ab1974017834430de27fd803ade4389602a7d6ca1362496c57bef384b2a4cb07 # Environment ENV GOPATH /go -ENV GIMME_GO_VERSION $GIMME_GO_VERSION +ENV GO_VERSION $GO_VERSION ENV CMAKE_VERSION $CMAKE_VERSION ENV CMAKE_SHA256 $CMAKE_SHA256 ENV CLANG_VERSION $CLANG_VERSION @@ -80,13 +80,15 @@ RUN curl -sSL -o get-rvm.sh https://raw.githubusercontent.com/rvm/rvm/1.29.12/bi RUN /bin/bash -l -c "rvm requirements" RUN /bin/bash -l -c "rvm install 2.7 --with-openssl-dir=${CONDA_PATH} && rvm cleanup all" RUN /bin/bash -l -c "gem install bundler --no-document" +RUN echo 'source /usr/local/rvm/scripts/rvm' >> /root/.bashrc -# Gimme -RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/v1.5.4/gimme -RUN echo "03b295636d4e22870b6f6e9bc06a71d65311ae90d3d48cbc7071f82dd5837fbc /bin/gimme" | sha256sum --check -RUN chmod +x /bin/gimme -RUN gimme $GIMME_GO_VERSION -COPY ./gobin.sh /etc/profile.d/ +# Go +RUN curl -sL -o /tmp/golang.tar.gz https://go.dev/dl/go$GO_VERSION.linux-arm64.tar.gz \ + && echo "b947e457be9d7b52a082c68e42b6939f9cc151f1ad5b3d8fd646ca3352f6f2f1 /tmp/golang.tar.gz" | sha256sum --check \ + && tar -C /usr/local -xzf /tmp/golang.tar.gz \ + && rm -f /tmp/golang.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" +ENV PATH="${GOPATH}/bin:${PATH}" # CMake RUN set -ex \ @@ -111,14 +113,5 @@ RUN chmod +x /build-gcc.sh \ && /build-gcc.sh \ && rm /build-gcc.sh -# Entrypoint -COPY ./entrypoint.sh / -RUN chmod +x /entrypoint.sh - -# create the agent build folder within $GOPATH -RUN mkdir -p /go/src/github.com/DataDog/datadog-agent - # Force umask to 0022 RUN echo "umask 0022" >> /root/.bashrc - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/rpm-armhf/Dockerfile b/rpm-armhf/Dockerfile index 1908c574..c5997c16 100644 --- a/rpm-armhf/Dockerfile +++ b/rpm-armhf/Dockerfile @@ -10,12 +10,12 @@ RUN echo "${CACERT_BUNDLE_SHA256} /cacert.pem" | sha256sum --check FROM ${BASE_IMAGE} # Build Args -ARG GIMME_GO_VERSION=1.19.9 +ARG GO_VERSION=1.19.9 ARG DD_TARGET_ARCH=armhf # Environment ENV GOPATH /go -ENV GIMME_GO_VERSION $GIMME_GO_VERSION +ENV GO_VERSION $GO_VERSION ENV DD_TARGET_ARCH $DD_TARGET_ARCH # configure yum and rpm for running on non-armv7l architectures @@ -81,6 +81,7 @@ RUN curl -sSL -o get-rvm.sh https://raw.githubusercontent.com/rvm/rvm/1.29.12/bi RUN /bin/bash -l -c "rvm requirements" RUN /bin/bash -l -c "rvm install --with-arch='armv7-a' -C '--build' -C 'arm-linux-gnueabihf' 2.7 && rvm cleanup all" RUN /bin/bash -l -c "gem install bundler --no-document" +RUN echo 'source /usr/local/rvm/scripts/rvm' >> /root/.bashrc # Pip & Invoke COPY ./python-packages-versions.txt /python-packages-versions.txt @@ -88,26 +89,13 @@ COPY ./setup_python.sh /setup_python.sh COPY ./requirements.txt ./requirements-py2.txt / RUN ./setup_python.sh -# Gimme -RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/v1.5.4/gimme -RUN echo "03b295636d4e22870b6f6e9bc06a71d65311ae90d3d48cbc7071f82dd5837fbc /bin/gimme" | sha256sum --check -RUN chmod +x /bin/gimme - -# GIMME_ARCH = GOARCH, so must be a valid entry from `goarchlist` here: -# https://github.com/golang/go/blob/master/src/go/build/syslist.go -# Also see https://github.com/travis-ci/gimme/blob/master/gimme#L880 -RUN GIMME_ARCH=arm gimme $GIMME_GO_VERSION - -COPY ./gobin.sh /etc/profile.d/ - -# Entrypoint -COPY ./entrypoint.sh / -RUN chmod +x /entrypoint.sh - -# create the agent build folder within $GOPATH -RUN mkdir -p /go/src/github.com/DataDog/datadog-agent +# Go +RUN curl -sL -o /tmp/golang.tar.gz https://go.dev/dl/go$GO_VERSION.linux-armv6l.tar.gz \ + && echo "4a613b3c9d74975470096c5323e54db0f5f0f56dd0471fc1a7ee04e559032dc4 /tmp/golang.tar.gz" | sha256sum --check \ + && tar -C /usr/local -xzf /tmp/golang.tar.gz \ + && rm -f /tmp/golang.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" +ENV PATH="${GOPATH}/bin:${PATH}" # Force umask to 0022 RUN echo "umask 0022" >> /root/.bashrc - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/rpm-x64/Dockerfile b/rpm-x64/Dockerfile index 6fcb9db9..75261e2f 100644 --- a/rpm-x64/Dockerfile +++ b/rpm-x64/Dockerfile @@ -13,7 +13,7 @@ ARG BASE_IMAGE # Build Args ARG GIT_VERSION=2.10.1 ARG GIT_SHA256="78553f786f1a66cb68983c170be482558028a3376056c0f2ed366f331b1e35f2" -ARG GIMME_GO_VERSION=1.19.9 +ARG GO_VERSION=1.19.9 ARG IBM_MQ_VERSION=9.2.4.0 ARG IBM_MQ_SHA256="d0d583eba72daf20b3762976f8831c2e23150ace90509520e12f8cda5b5bdb49" ARG CMAKE_VERSION=3.23.0 @@ -37,7 +37,7 @@ ARG GCC_SHA256=ab1974017834430de27fd803ade4389602a7d6ca1362496c57bef384b2a4cb07 ENV GOPATH /go ENV GIT_VERSION $GIT_VERSION ENV GIT_SHA256 $GIT_SHA256 -ENV GIMME_GO_VERSION $GIMME_GO_VERSION +ENV GO_VERSION $GO_VERSION ENV IBM_MQ_VERSION $IBM_MQ_VERSION ENV IBM_MQ_SHA256 $IBM_MQ_SHA256 ENV CMAKE_VERSION $CMAKE_VERSION @@ -163,6 +163,7 @@ RUN curl -sSL -o get-rvm.sh https://raw.githubusercontent.com/rvm/rvm/1.29.12/bi RUN /bin/bash -l -c "rvm requirements" RUN /bin/bash -l -c "rvm install 2.6 --with-openssl-dir=${CONDA_PATH} && rvm cleanup all" RUN /bin/bash -l -c "gem install bundler --no-document" +RUN echo 'source /usr/local/rvm/scripts/rvm' >> /root/.bashrc # Upgrade binutils RUN curl -sL -O "https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.gz" \ @@ -177,13 +178,13 @@ RUN curl -sL -O "https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.t # Override updated linker system-wide RUN ln -sf /usr/local/binutils/bin/ld /usr/bin/ld -# Gimme -RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/v1.5.4/gimme -RUN echo "03b295636d4e22870b6f6e9bc06a71d65311ae90d3d48cbc7071f82dd5837fbc /bin/gimme" | sha256sum --check -RUN chmod +x /bin/gimme -RUN gimme $GIMME_GO_VERSION -COPY ./gobin.sh /etc/profile.d/ - +# Go +RUN curl -sL -o /tmp/golang.tar.gz https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz \ + && echo "e858173b489ec1ddbe2374894f52f53e748feed09dde61be5b4b4ba2d73ef34b /tmp/golang.tar.gz" | sha256sum --check \ + && tar -C /usr/local -xzf /tmp/golang.tar.gz \ + && rm -f /tmp/golang.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" +ENV PATH="${GOPATH}/bin:${PATH}" # IBM MQ RUN mkdir -p /opt/mqm \ @@ -280,14 +281,5 @@ RUN chmod +x /build-gcc.sh \ && /build-gcc.sh \ && rm /build-gcc.sh -# Entrypoint -COPY ./entrypoint.sh / -RUN chmod +x /entrypoint.sh - -# create the agent build folder within $GOPATH -RUN mkdir -p /go/src/github.com/DataDog/datadog-agent - # Force umask to 0022 RUN echo "umask 0022" >> /root/.bashrc - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/setup_go.sh b/setup_go.sh index 740ccdfc..4c7a526e 100755 --- a/setup_go.sh +++ b/setup_go.sh @@ -42,9 +42,6 @@ ln -sf /usr/local/binutils/bin/ld /usr/bin/ld ./all.bash -# Update PATH to include the built go binaries -echo 'export PATH="/goroot/bin:$PATH"' >> /root/.bashrc - # Remove gimme rm -rf $HOME/.gimme rm /bin/gimme diff --git a/setup_python.sh b/setup_python.sh index 224a9e63..f682325a 100755 --- a/setup_python.sh +++ b/setup_python.sh @@ -99,3 +99,5 @@ fi # Add python3's invoke to the PATH even when ddpy3 is not active, since we want to use python3 invoke to run python2 tests ln -s ${CONDA_PATH}/envs/ddpy3/bin/inv /usr/local/bin + +echo "conda activate ddpy3" >> /root/.bashrc diff --git a/suse-x64/Dockerfile b/suse-x64/Dockerfile index bb163318..24aefb79 100644 --- a/suse-x64/Dockerfile +++ b/suse-x64/Dockerfile @@ -14,7 +14,7 @@ RUN echo "${CACERT_BUNDLE_SHA256} /cacert.pem" | sha256sum --check FROM opensuse/archive:42.1 # Build Args -ARG GIMME_GO_VERSION=1.19.9 +ARG GO_VERSION=1.19.9 ARG IBM_MQ_VERSION=9.2.4.0 ARG IBM_MQ_SHA256="d0d583eba72daf20b3762976f8831c2e23150ace90509520e12f8cda5b5bdb49" ARG CMAKE_VERSION=3.23.0 @@ -31,7 +31,7 @@ ARG GCC_SHA256=ab1974017834430de27fd803ade4389602a7d6ca1362496c57bef384b2a4cb07 # Environment ENV GOPATH /go -ENV GIMME_GO_VERSION $GIMME_GO_VERSION +ENV GO_VERSION $GO_VERSION ENV IBM_MQ_VERSION $IBM_MQ_VERSION ENV IBM_MQ_SHA256 $IBM_MQ_SHA256 ENV CMAKE_VERSION $CMAKE_VERSION @@ -46,8 +46,6 @@ ENV GCC_VERSION $GCC_VERSION ENV PATH="/opt/datadog/bin:${PATH}" -# Add our profile to the image that adds RVM and Conda to environment -COPY ./suse-x64/ddprofile.sh /etc/profile.d/ # Add /etc/profile to the image (taken from 42.3 image) -- it is missing from 42.1 the image COPY ./suse-x64/profile /etc/profile @@ -84,12 +82,13 @@ COPY --from=CURL_GETTER /cacert.pem /etc/ssl/certs/ca-certificates.crt COPY --from=CURL_GETTER /curl-amd64 /opt/datadog/bin/curl RUN chmod +x /opt/datadog/bin/curl -# Gimme -RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/v1.5.4/gimme -RUN echo "03b295636d4e22870b6f6e9bc06a71d65311ae90d3d48cbc7071f82dd5837fbc /bin/gimme" | sha256sum --check -RUN chmod +x /bin/gimme -RUN gimme $GIMME_GO_VERSION -COPY ./gobin.sh /etc/profile.d/ +# Go +RUN curl -sL -o /tmp/golang.tar.gz https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz \ + && echo "e858173b489ec1ddbe2374894f52f53e748feed09dde61be5b4b4ba2d73ef34b /tmp/golang.tar.gz" | sha256sum --check \ + && tar -C /usr/local -xzf /tmp/golang.tar.gz \ + && rm -f /tmp/golang.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" +ENV PATH="${GOPATH}/bin:${PATH}" # Add systemd headers COPY ./rpm-headers/systemd /usr/include/systemd @@ -121,6 +120,7 @@ RUN curl -sSL -o get-rvm.sh https://raw.githubusercontent.com/rvm/rvm/1.29.12/bi RUN bash -l -c "rvm autolibs disable" # do not try to fetch requirements from system repos RUN bash -l -c "rvm install 2.7 --with-openssl-dir=${CONDA_PATH} && rvm cleanup all" RUN bash -l -c "gem install bundler --no-document" +RUN echo 'source /usr/local/rvm/scripts/rvm' >> /root/.bashrc # CMake RUN set -ex \ @@ -172,14 +172,6 @@ RUN curl -sL -o /tmp/rpm-4.14.3.tar.bz2 http://ftp.rpm.org/releases/rpm-4.14.x/r RUN mkdir -p /usr/local/var/lib/rpm \ && cp /var/lib/rpm/Packages /usr/local/var/lib/rpm/Packages \ && /usr/local/bin/rpm --rebuilddb -# Entrypoint -COPY ./entrypoint.sh / -RUN chmod +x /entrypoint.sh - -# create the agent build folder within $GOPATH -RUN mkdir -p /go/src/github.com/DataDog/datadog-agent # Force umask to 0022 RUN echo "umask 0022" >> /root/.bashrc - -ENTRYPOINT ["/entrypoint.sh"]