@@ -45,13 +45,6 @@ RUN apt-get update && \
4545 && apt-get clean \
4646 && rm -rf /var/lib/apt/lists/*
4747
48- # Add the CA certificates needed to verify the GOPROXY endpoint used by the go
49- # steps below.
50- COPY --from=registry.ddbuild.io/images/datadog-ca-certs:standard /certs/ /usr/local/share/ca-certificates/
51- # Make the staged certs non-world-writable, then register them in the trust store.
52- RUN chmod -R o-w /usr/local/share/ca-certificates \
53- && update-ca-certificates
54-
5548# Install Windows cross-compilation tools if building for Windows
5649ARG PACKAGE_TYPE
5750RUN if [ "$PACKAGE_TYPE" = "windows" ]; then \
@@ -120,21 +113,28 @@ COPY manifest.yaml /workspace/datadog-agent/comp/otelcol/collector-contrib/impl/
120113# Generate the files and clean up go cache to free space
121114ARG GOPROXY
122115ARG GONOSUMDB
123- RUN GOPROXY=$GOPROXY GONOSUMDB=$GONOSUMDB dda inv collector.generate && \
116+ # The GOPROXY build arg is re-injected into every RUN below as an env var, so
117+ # strip any unreachable entry once here and apply the result explicitly to each
118+ # go step (an explicit assignment overrides the injected arg). Mirrors
119+ # tools/ci/sanitize-goproxy.sh.
120+ RUN printf '%s' "$GOPROXY" | tr '|' '\n' \
121+ | grep -vE '^https?://[^/]*\.fabric\.dog(:[0-9]+)?(/|$)' \
122+ | paste -sd '|' - > /tmp/goproxy.sanitized
123+ RUN GOPROXY="$(cat /tmp/goproxy.sanitized)" GONOSUMDB=$GONOSUMDB dda inv collector.generate && \
124124 go clean -cache -modcache
125125
126126# Build the OTel agent with cleanup
127127RUN if [ "$PACKAGE_TYPE" = "windows" ]; then \
128- GOPROXY=$GOPROXY GONOSUMDB=$GONOSUMDB GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc dda inv otel-agent.build --byoc && \
128+ GOPROXY="$(cat /tmp/goproxy.sanitized)" GONOSUMDB=$GONOSUMDB GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc dda inv otel-agent.build --byoc && \
129129 go clean -cache; \
130130 else \
131- GOPROXY=$GOPROXY GONOSUMDB=$GONOSUMDB dda inv otel-agent.build --byoc && \
131+ GOPROXY="$(cat /tmp/goproxy.sanitized)" GONOSUMDB=$GONOSUMDB dda inv otel-agent.build --byoc && \
132132 go clean -cache; \
133133 fi
134134
135135# Build the build-ddot-byoc tool (required for linux and windows PACKAGE_TYPE)
136136RUN if [ "$PACKAGE_TYPE" = "linux" ] || [ "$PACKAGE_TYPE" = "windows" ]; then \
137- cd /workspace/datadog-agent/tools/build-ddot-byoc && GOPROXY=$GOPROXY GONOSUMDB=$GONOSUMDB GOWORK=off go build -o /usr/local/bin/build-ddot-byoc .; \
137+ cd /workspace/datadog-agent/tools/build-ddot-byoc && GOPROXY="$(cat /tmp/goproxy.sanitized)" GONOSUMDB=$GONOSUMDB GOWORK=off go build -o /usr/local/bin/build-ddot-byoc .; \
138138 fi
139139
140140# Build packages if PACKAGE_TYPE is specified, otherwise just output the binary.
0 commit comments