File tree Expand file tree Collapse file tree 3 files changed +9
-20
lines changed Expand file tree Collapse file tree 3 files changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ ARG AGENT_VERSION
66ARG CMD_PATH
77ARG BUILD_TAGS
88
9- RUN apk add --no-cache git make musl-dev go gcc
9+ RUN apk add --no-cache git make musl-dev gcc
10+ COPY --from=golang:1.19-alpine /usr/local/go/ /usr/lib/go
11+
1012ENV GOROOT /usr/lib/go
1113ENV GOPATH /go
1214ENV PATH /go/bin:$PATH
@@ -28,18 +30,11 @@ WORKDIR /tmp/dd/datadog-agent/"${CMD_PATH}"
2830
2931RUN --mount=type=cache,target=/go/pkg/mod \
3032 --mount=type=cache,target=/root/.cache/go-build \
31- if [ -z "$AGENT_VERSION" ]; then \
32- go build -ldflags="-w \
33+ /usr/lib/go/bin/go build -ldflags="-w \
3334 -X github.com/DataDog/datadog-agent/pkg/serverless/tags.currentExtensionVersion=$EXTENSION_VERSION" \
34- -tags "${BUILD_TAGS}" -o datadog-agent; \
35- else \
36- go build -ldflags="-w \
37- -X github.com/DataDog/datadog-agent/pkg/serverless/tags.currentExtensionVersion=$EXTENSION_VERSION \
38- -X github.com/DataDog/datadog-agent/pkg/version.agentVersionDefault=$AGENT_VERSION" \
39- -tags "${BUILD_TAGS}" -o datadog-agent; \
40- fi
35+ -tags "${BUILD_TAGS}" -o datadog-agent;
4136
42- RUN go tool nm datadog-agent | grep -w 'github.com/DataDog/datadog-agent/pkg/version.agentVersionDefault' || \
37+ RUN /usr/lib/go/bin/ go tool nm datadog-agent | grep -w 'github.com/DataDog/datadog-agent/pkg/version.agentVersionDefault' || \
4338 (echo "agentVersionDefault variable doesn't exist" && exit 1)
4439
4540# zip the extension
Original file line number Diff line number Diff line change 2626fi
2727
2828if [ -z " $BUILD_TAGS " ]; then
29- if [ -z " $CLOUD_RUN " ]; then
30- BUILD_TAGS=" serverless otlp"
31- else
32- BUILD_TAGS=" serverless"
33- fi
29+ BUILD_TAGS=" serverless otlp"
3430fi
3531
3632AGENT_PATH=" ../datadog-agent"
@@ -86,10 +82,8 @@ function docker_build_zip {
8682if [ " $CLOUD_RUN " == " true" ]; then
8783 echo " Building for cloud run (both arch + alpine)"
8884 docker_build_zip amd64
89- docker_build_zip arm64
9085 BUILD_FILE=Dockerfile.alpine.build
9186 docker_build_zip amd64 -alpine
92- docker_build_zip arm64 -alpine
9387elif [ " $ARCHITECTURE " == " amd64" ]; then
9488 echo " Building for amd64 only"
9589 docker_build_zip amd64
Original file line number Diff line number Diff line change 55# This product includes software developed at Datadog (https://www.datadoghq.com/).
66# Copyright 2021 Datadog, Inc.
77
8- # Usage: VERSION=5 ARCHITECTURE=[amd64|arm64] ./scripts/build_cloud_run.sh
8+ # Usage: AGENT_VERSION=7.43.0 VERSION=5 ARCHITECTURE=[amd64|arm64] ./scripts/build_cloud_run.sh
99
1010# Optional environment variables:
1111# VERSION - Use a specific version number
1616SCRIPTS_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
1717cd $SCRIPTS_DIR /..
1818
19- VERSION=$VERSION ARCHITECTURE=$ARCHITECTURE CLOUD_RUN=true ./scripts/build_binary_and_layer_dockerized.sh
19+ AGENT_VERSION= $AGENT_VERSION VERSION=$VERSION ARCHITECTURE=$ARCHITECTURE CLOUD_RUN=true ./scripts/build_binary_and_layer_dockerized.sh
You can’t perform that action at this time.
0 commit comments