Skip to content

Commit da6007d

Browse files
committed
Revert "move ai id to hardcoded variable"
This reverts commit 666c2b0.
1 parent 765d701 commit da6007d

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ CNS_BUILD_DIR = $(BUILD_DIR)/cns
7474
NPM_BUILD_DIR = $(BUILD_DIR)/npm
7575
TOOLS_DIR = $(REPO_ROOT)/build/tools
7676
TOOLS_BIN_DIR = $(TOOLS_DIR)/bin
77+
CNI_AI_ID = 5515a1eb-b2bc-406a-98eb-ba462e6f0411
7778
CNS_AI_ID = ce672799-8f08-4235-8c12-08563dc2acef
7879
NPM_AI_ID = 014c22bd-4107-459e-8475-67909e96edcb
7980
ACN_PACKAGE_PATH = github.com/Azure/azure-container-networking
81+
CNI_AI_PATH=$(ACN_PACKAGE_PATH)/telemetry.aiMetadata
8082
CNS_AI_PATH=$(ACN_PACKAGE_PATH)/cns/logger.aiMetadata
8183
NPM_AI_PATH=$(ACN_PACKAGE_PATH)/npm.aiMetadata
8284

@@ -203,15 +205,15 @@ azure-vnet-ipamv6-binary:
203205

204206
# Build the Azure CNI telemetry binary.
205207
azure-vnet-telemetry-binary:
206-
cd $(CNI_TELEMETRY_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true"
208+
cd $(CNI_TELEMETRY_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION) -X $(CNI_AI_PATH)=$(CNI_AI_ID)" -gcflags="-dwarflocationlists=true"
207209

208210
# Build the Azure CLI network binary.
209211
acncli-binary:
210212
cd $(ACNCLI_DIR) && CGO_ENABLED=0 go build -v -o $(ACNCLI_BUILD_DIR)/acn$(EXE_EXT) -ldflags "-X main.version=$(ACN_VERSION)" -gcflags="-dwarflocationlists=true"
211213

212214
# Build the Azure CNS binary.
213215
azure-cns-binary:
214-
cd $(CNS_DIR) && CGO_ENABLED=0 go build -v -o $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) -ldflags "-X main.version=$(CNS_VERSION) -X $(CNS_AI_PATH)=$(CNS_AI_ID)" -gcflags="-dwarflocationlists=true"
216+
cd $(CNS_DIR) && CGO_ENABLED=0 go build -v -o $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) -ldflags "-X main.version=$(CNS_VERSION) -X $(CNS_AI_PATH)=$(CNS_AI_ID) -X $(CNI_AI_PATH)=$(CNI_AI_ID)" -gcflags="-dwarflocationlists=true"
215217

216218
# Build the Azure NPM binary.
217219
azure-npm-binary:
@@ -434,7 +436,8 @@ cni-image: ## build cni container image.
434436
TARGET=$(OS) \
435437
OS=$(OS) \
436438
ARCH=$(ARCH) \
437-
OS_VERSION=$(OS_VERSION)
439+
OS_VERSION=$(OS_VERSION) \
440+
EXTRA_BUILD_ARGS='--build-arg CNI_AI_PATH=$(CNI_AI_PATH) --build-arg CNI_AI_ID=$(CNI_AI_ID)'
438441

439442
cni-image-push: ## push cni container image.
440443
$(MAKE) container-push \

cni/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core@sha256:a49
1212
FROM go AS azure-vnet
1313
ARG OS
1414
ARG VERSION
15+
ARG CNI_AI_PATH
16+
ARG CNI_AI_ID
1517
WORKDIR /azure-container-networking
1618
COPY . .
1719
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go
18-
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-telemetry -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.go
20+
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-telemetry -trimpath -ldflags "-X main.version="$VERSION" -X "$CNI_AI_PATH"="$CNI_AI_ID"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.go
1921
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go
2022
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-stateless -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/stateless/main.go
2123

cns/service/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ func main() {
672672
}
673673

674674
if telemetryDaemonEnabled {
675-
logger.Printf("CNI Telemetry is enabled")
675+
logger.Printf("CNI Telemtry is enabled")
676676
go startTelemetryService(rootCtx)
677677
}
678678

telemetry/aiwrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import (
99
)
1010

1111
var (
12+
aiMetadata string
1213
th aitelemetry.TelemetryHandle
1314
gDisableTrace bool
1415
gDisableMetric bool
1516
ErrTelemetryDisabled = errors.New("telemetry is disabled")
1617
)
1718

1819
const (
19-
aiMetadata = "5515a1eb-b2bc-406a-98eb-ba462e6f0411"
2020
// Wait time for AI to gracefully close AI telemetry session
2121
waitTimeInSecs = 10
2222
)

0 commit comments

Comments
 (0)