Skip to content

Commit ca135e6

Browse files
committed
Address review
1 parent b684f20 commit ca135e6

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

.gitlab/build/bazel/defs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,16 @@
8585
.bazel:runner:macos-amd64:
8686
extends: .bazel:defs:cache:macos
8787
tags: [ "macos:sonoma-amd64", "specific:true" ]
88+
# Drop GOPROXY entries not usable from macOS runners before bazel forwards
89+
# GOPROXY into its repository rules.
90+
before_script:
91+
- !reference [.sanitize_goproxy]
8892

8993
.bazel:runner:macos-arm64:
9094
extends: .bazel:defs:cache:macos
9195
tags: [ "macos:sonoma-arm64", "specific:true" ]
96+
before_script:
97+
- !reference [.sanitize_goproxy]
9298

9399
.bazel:runner:windows-amd64:
94100
extends: [ .bazel:defs:cache:windows, .windows_docker_default ]

.gitlab/build/binary_build/schema_generation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ generate_config_schema-windows:
8181
ARCH: "x64"
8282
script:
8383
- $ErrorActionPreference = "Stop"
84+
- !reference [.sanitize_goproxy_windows]
8485
- >
8586
.\tools\ci\docker-run-with-bazel-cache.ps1
8687
-m 24576M

Dockerfiles/agent-ddot/Dockerfile.agent-otel

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
5649
ARG PACKAGE_TYPE
5750
RUN 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
121114
ARG GOPROXY
122115
ARG 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
127127
RUN 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)
136136
RUN 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

Comments
 (0)