diff --git a/Dockerfile b/Dockerfile index 5f22b3b29b..566fd92e28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1014,6 +1014,107 @@ FROM scratch AS noble COPY --from=noble-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-ubuntu-noble.tgz COPY --from=noble-build /google-cloud-ops-agent*.deb / +# ====================================== +# Build Ops Agent for ubuntu-oracular +# ====================================== + +FROM ubuntu:oracular AS oracular-build-base +ARG OPENJDK_MAJOR_VERSION + +RUN set -x; apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install git systemd \ + autoconf libtool libcurl4-openssl-dev libltdl-dev libssl-dev libyajl-dev \ + build-essential cmake bison flex file systemd-dev debhelper libsystemd-dev \ + devscripts cdbs pkg-config openjdk-${OPENJDK_MAJOR_VERSION}-jdk zip + +SHELL ["/bin/bash", "-c"] + +# Install golang +ARG TARGETARCH +ARG GO_VERSION +ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz +RUN set -xe; \ + tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local +ENV PATH="${PATH}:/usr/local/go/bin" + + +FROM oracular-build-base AS oracular-build-otel +WORKDIR /work +# Download golang deps +COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/ +RUN cd submodules/opentelemetry-operations-collector && go mod download + +COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib +# Install gradle. The first invocation of gradlew does this +RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks +COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector +COPY ./builds/otel.sh . +RUN \ + unset OTEL_TRACES_EXPORTER && \ + unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \ + unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \ + ./otel.sh /work/cache/ + +FROM oracular-build-base AS oracular-build-fluent-bit +WORKDIR /work +COPY ./submodules/fluent-bit submodules/fluent-bit +COPY ./builds/fluent_bit.sh . +RUN ./fluent_bit.sh /work/cache/ + + +FROM oracular-build-base AS oracular-build-systemd +WORKDIR /work +COPY ./systemd systemd +COPY ./builds/systemd.sh . +RUN ./systemd.sh /work/cache/ + + +FROM oracular-build-base AS oracular-build-golang-base +WORKDIR /work +COPY go.mod go.sum ./ +# Fetch dependencies +RUN go mod download +COPY confgenerator confgenerator +COPY apps apps +COPY internal internal + + +FROM oracular-build-golang-base AS oracular-build-diagnostics +WORKDIR /work +COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics +COPY ./builds/ops_agent_diagnostics.sh . +RUN ./ops_agent_diagnostics.sh /work/cache/ + + +FROM oracular-build-golang-base AS oracular-build-wrapper +WORKDIR /work +COPY cmd/agent_wrapper cmd/agent_wrapper +COPY ./builds/agent_wrapper.sh . +RUN ./agent_wrapper.sh /work/cache/ + + +FROM oracular-build-golang-base AS oracular-build +WORKDIR /work +COPY . /work + +# Run the build script once to build the ops agent engine to a cache +RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang +WORKDIR /tmp/cache_run/golang +RUN ./pkg/deb/build.sh || true &> /dev/null +WORKDIR /work + +COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml +COPY --from=oracular-build-otel /work/cache /work/cache +COPY --from=oracular-build-fluent-bit /work/cache /work/cache +COPY --from=oracular-build-systemd /work/cache /work/cache +COPY --from=oracular-build-diagnostics /work/cache /work/cache +COPY --from=oracular-build-wrapper /work/cache /work/cache +RUN ./pkg/deb/build.sh + +FROM scratch AS oracular +COPY --from=oracular-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-ubuntu-oracular.tgz +COPY --from=oracular-build /google-cloud-ops-agent*.deb / + FROM scratch COPY --from=centos8 /* / COPY --from=rockylinux9 /* / @@ -1023,4 +1124,5 @@ COPY --from=sles12 /* / COPY --from=sles15 /* / COPY --from=focal /* / COPY --from=jammy /* / -COPY --from=noble /* / \ No newline at end of file +COPY --from=noble /* / +COPY --from=oracular /* / \ No newline at end of file diff --git a/dockerfiles/compile.go b/dockerfiles/compile.go index 4f64acf6a2..0e7ba1c100 100644 --- a/dockerfiles/compile.go +++ b/dockerfiles/compile.go @@ -201,6 +201,18 @@ RUN ln -fs /usr/lib/systemd /lib/systemd` + installJava + installCMake, tar_distro_name: "ubuntu-noble", package_extension: "deb", }, + { + from_image: "ubuntu:oracular", + target_name: "oracular", + install_packages: `RUN set -x; apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install git systemd \ + autoconf libtool libcurl4-openssl-dev libltdl-dev libssl-dev libyajl-dev \ + build-essential cmake bison flex file systemd-dev debhelper libsystemd-dev \ + devscripts cdbs pkg-config openjdk-${OPENJDK_MAJOR_VERSION}-jdk zip`, + package_build: "RUN ./pkg/deb/build.sh", + tar_distro_name: "ubuntu-oracular", + package_extension: "deb", + }, } func getDockerfileFooter() string { diff --git a/kokoro/config/build/presubmit/bullseye_aarch64.gcl b/kokoro/config/build/presubmit/bullseye_aarch64.gcl index cb5e05f6a9..72cd39ae48 100644 --- a/kokoro/config/build/presubmit/bullseye_aarch64.gcl +++ b/kokoro/config/build/presubmit/bullseye_aarch64.gcl @@ -3,7 +3,7 @@ import '../common.gcl' as common config build = common.build { params { environment { - DISTRO = 'bullseye' + DISTRO = 'oracular' PKGFORMAT = 'deb' } } diff --git a/kokoro/config/build/presubmit/bullseye_x86_64.gcl b/kokoro/config/build/presubmit/bullseye_x86_64.gcl index cb5e05f6a9..72cd39ae48 100644 --- a/kokoro/config/build/presubmit/bullseye_x86_64.gcl +++ b/kokoro/config/build/presubmit/bullseye_x86_64.gcl @@ -3,7 +3,7 @@ import '../common.gcl' as common config build = common.build { params { environment { - DISTRO = 'bullseye' + DISTRO = 'oracular' PKGFORMAT = 'deb' } } diff --git a/kokoro/config/test/ops_agent/presubmit/bullseye_aarch64.gcl b/kokoro/config/test/ops_agent/presubmit/bullseye_aarch64.gcl index ddcc738cfc..b9bbb14d32 100644 --- a/kokoro/config/test/ops_agent/presubmit/bullseye_aarch64.gcl +++ b/kokoro/config/test/ops_agent/presubmit/bullseye_aarch64.gcl @@ -3,7 +3,7 @@ import 'common.gcl' as common config build = common.ops_agent_test { params { environment { - TARGET = 'bullseye' + TARGET = 'oracular' ARCH = 'aarch64' } } diff --git a/kokoro/config/test/ops_agent/presubmit/bullseye_x86_64.gcl b/kokoro/config/test/ops_agent/presubmit/bullseye_x86_64.gcl index 98f521efb3..c37a0b662e 100644 --- a/kokoro/config/test/ops_agent/presubmit/bullseye_x86_64.gcl +++ b/kokoro/config/test/ops_agent/presubmit/bullseye_x86_64.gcl @@ -3,7 +3,7 @@ import 'common.gcl' as common config build = common.ops_agent_test { params { environment { - TARGET = 'bullseye' + TARGET = 'oracular' ARCH = 'x86_64' } } diff --git a/kokoro/config/test/third_party_apps/presubmit/bullseye_aarch64.gcl b/kokoro/config/test/third_party_apps/presubmit/bullseye_aarch64.gcl index 74230b5ef5..ab3380d503 100644 --- a/kokoro/config/test/third_party_apps/presubmit/bullseye_aarch64.gcl +++ b/kokoro/config/test/third_party_apps/presubmit/bullseye_aarch64.gcl @@ -3,7 +3,7 @@ import 'common.gcl' as common config build = common.third_party_apps_test { params { environment { - TARGET = 'bullseye' + TARGET = 'oracular' ARCH = 'aarch64' } } diff --git a/kokoro/config/test/third_party_apps/presubmit/bullseye_x86_64.gcl b/kokoro/config/test/third_party_apps/presubmit/bullseye_x86_64.gcl index 251cc5f3d3..e30fd27a6e 100644 --- a/kokoro/config/test/third_party_apps/presubmit/bullseye_x86_64.gcl +++ b/kokoro/config/test/third_party_apps/presubmit/bullseye_x86_64.gcl @@ -3,7 +3,7 @@ import 'common.gcl' as common config build = common.third_party_apps_test { params { environment { - TARGET = 'bullseye' + TARGET = 'oracular' ARCH = 'x86_64' } } diff --git a/project.yaml b/project.yaml index 9de2537e3d..87558cc5e4 100644 --- a/project.yaml +++ b/project.yaml @@ -58,6 +58,22 @@ targets: - ubuntu-os-cloud:ubuntu-2004-lts-arm64 exhaustive: - ubuntu-os-cloud:ubuntu-minimal-2004-lts-arm64 + oracular: + package_extension: + deb + architectures: + x86_64: + test_distros: + representative: + - ubuntu-os-cloud:ubuntu-2410-amd64 + exhaustive: + - ubuntu-os-cloud:ubuntu-minimal-2410-amd64 + aarch64: + test_distros: + representative: + - ubuntu-os-cloud:ubuntu-2410-arm64 + exhaustive: + - ubuntu-os-cloud:ubuntu-minimal-2410-arm64 jammy: package_extension: deb