Skip to content

Commit b518f83

Browse files
Re-enable the otlp build tag. (#134)
* Revert "Revert "Revert "Revert "Build binaries with otlp enabled. (#114)" (#115)" (#125)" (#128)" This reverts commit d4cdfec. * Include build tag in gh action options. --------- Co-authored-by: AJ Stuyvenberg <[email protected]>
1 parent a7a5a00 commit b518f83

File tree

6 files changed

+21
-4
lines changed

6 files changed

+21
-4
lines changed

.github/workflows/deploy-sandbox.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ on:
2222
options:
2323
- amd64
2424
- arm64
25+
buildTags:
26+
type: choice
27+
description: Build tags
28+
default: 'serverless otlp'
29+
options:
30+
- 'serverless otlp'
31+
- 'serverless'
2532
agentBranch:
2633
type: string
2734
description: Datadog agent branch name (default main)
@@ -80,6 +87,7 @@ jobs:
8087
--context-path "${GITHUB_WORKSPACE}" \
8188
--destination-path "${GITHUB_WORKSPACE}/tmp" \
8289
--docker-path "scripts_v2/Dockerfile.build" \
90+
--build-tags "${{ inputs.buildTags }}" \
8391
--artifact-name "datadog_extension.zip"
8492
- name: Sign the layer
8593
env:

build-tools/bin/build_tools

1.14 MB
Binary file not shown.

build-tools/src/commands/build_command.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pub struct BuildOptions {
2323
artifact_name: String,
2424
#[structopt(long)]
2525
docker_path: String,
26+
#[structopt(long, default_value = "serverless otlp")]
27+
build_tags: String,
2628
}
2729

2830
pub fn build(args: &BuildOptions) -> Result<()> {
@@ -60,6 +62,7 @@ fn build_image(args: &BuildOptions, cmd_path: &str, dockerfile_path: &str) -> Re
6062
let extension_version_build_arg = format!("EXTENSION_VERSION={}", args.version);
6163
let agent_version_build_arg = format!("AGENT_VERSION={}", args.agent_version);
6264
let cmd_path_build_arg = format!("CMD_PATH={}", cmd_path);
65+
let build_tags_build_arg = format!("BUILD_TAGS={}", args.build_tags);
6366

6467
let docker_args = [
6568
"buildx",
@@ -76,6 +79,8 @@ fn build_image(args: &BuildOptions, cmd_path: &str, dockerfile_path: &str) -> Re
7679
agent_version_build_arg.as_str(),
7780
"--build-arg",
7881
cmd_path_build_arg.as_str(),
82+
"--build-arg",
83+
build_tags_build_arg.as_str(),
7984
args.context_path.as_str(),
8085
"--load",
8186
];

scripts/Dockerfile.alpine.build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM alpine:3.16 as builder
44
ARG EXTENSION_VERSION
55
ARG AGENT_VERSION
66
ARG CMD_PATH
7+
ARG BUILD_TAGS
78

89
RUN apk add --no-cache git make musl-dev go gcc
910
ENV GOROOT /usr/lib/go
@@ -30,12 +31,12 @@ RUN --mount=type=cache,target=/go/pkg/mod \
3031
if [ -z "$AGENT_VERSION" ]; then \
3132
go build -ldflags="-w \
3233
-X github.com/DataDog/datadog-agent/pkg/serverless/tags.currentExtensionVersion=$EXTENSION_VERSION" \
33-
-tags serverless -o datadog-agent; \
34+
-tags "${BUILD_TAGS}" -o datadog-agent; \
3435
else \
3536
go build -ldflags="-w \
3637
-X github.com/DataDog/datadog-agent/pkg/serverless/tags.currentExtensionVersion=$EXTENSION_VERSION \
3738
-X github.com/DataDog/datadog-agent/pkg/version.agentVersionDefault=$AGENT_VERSION" \
38-
-tags serverless -o datadog-agent; \
39+
-tags "${BUILD_TAGS}" -o datadog-agent; \
3940
fi
4041

4142
RUN go tool nm datadog-agent | grep -w 'github.com/DataDog/datadog-agent/pkg/version.agentVersionDefault' || \

scripts/build_binary_and_layer_dockerized.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ fi
2121

2222
if [ -z "$CLOUD_RUN" ]; then
2323
CMD_PATH="cmd/serverless"
24+
BUILD_TAGS="serverless otlp"
2425
else
2526
CMD_PATH="cmd/serverless-init"
27+
BUILD_TAGS="serverless"
2628
fi
2729

2830
AGENT_PATH="../datadog-agent"

scripts_v2/Dockerfile.build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM golang:1.19 as builder
44
ARG EXTENSION_VERSION
55
ARG AGENT_VERSION
66
ARG CMD_PATH
7+
ARG BUILD_TAGS
78

89
RUN mkdir -p /tmp/dd
910

@@ -18,12 +19,12 @@ RUN --mount=type=cache,target=/go/pkg/mod \
1819
if [ -z "$AGENT_VERSION" ]; then \
1920
go build -ldflags="-w \
2021
-X github.com/DataDog/datadog-agent/pkg/serverless/tags.currentExtensionVersion=$EXTENSION_VERSION" \
21-
-tags serverless -o datadog-agent; \
22+
-tags "${BUILD_TAGS}" -o datadog-agent; \
2223
else \
2324
go build -ldflags="-w \
2425
-X github.com/DataDog/datadog-agent/pkg/serverless/tags.currentExtensionVersion=$EXTENSION_VERSION \
2526
-X github.com/DataDog/datadog-agent/pkg/version.agentVersionDefault=$AGENT_VERSION" \
26-
-tags serverless -o datadog-agent; \
27+
-tags "${BUILD_TAGS}" -o datadog-agent; \
2728
fi
2829

2930
RUN go tool nm datadog-agent | grep -w 'github.com/DataDog/datadog-agent/pkg/version.agentVersionDefault' || \

0 commit comments

Comments
 (0)