From 76b9f3032d63ae570bde4a433df0ee6547f37e16 Mon Sep 17 00:00:00 2001 From: Nathan Slaughter <28688390+nslaughter@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:19:18 -0500 Subject: [PATCH 1/4] Auto increment version --- collector/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/collector/Makefile b/collector/Makefile index 97f4a49fc5..50846485a4 100644 --- a/collector/Makefile +++ b/collector/Makefile @@ -4,8 +4,7 @@ BASE_SPACE:=$(shell pwd) BUILD_SPACE:=$(BASE_SPACE)/build BUCKET_NAME:=lambda-artifacts-$(shell dd if=/dev/random bs=8 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n') LAYER_NAME:=otel-collector - -VERSION=$(shell cat VERSION) +VERSION=$(shell curl -s https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector-contrib/main/versions.yaml | grep 'version:' | head -1 | awk '{print $$2}') GIT_SHA=$(shell git rev-parse HEAD) GOARCH ?= amd64 GOBUILD=GO111MODULE=on CGO_ENABLED=0 installsuffix=cgo go build -trimpath @@ -38,6 +37,7 @@ build: clean @echo Building otel collector extension mkdir -p $(BUILD_SPACE)/extensions GOOS=linux GOARCH=$(GOARCH) $(GOBUILD) $(LDFLAGS) -o $(BUILD_SPACE)/extensions . + @$(MAKE) update-collector-version .PHONY: package package: build @@ -56,6 +56,12 @@ publish-layer: package aws lambda publish-layer-version --layer-name $(LAYER_NAME) --zip-file fileb://$(BUILD_SPACE)/opentelemetry-collector-layer-$(GOARCH).zip --compatible-runtimes nodejs14.x nodejs16.x nodejs18.x java11 python3.8 python3.9 python3.10 python3.11 --query 'LayerVersionArn' --output text @echo OpenTelemetry Collector layer published. +.PHONY: update-collector-version +update-collector-version: + @latest_version=$(shell curl -s https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector-contrib/main/versions.yaml | grep 'version:' | head -1 | awk '{print $$2}'); \ + echo $$latest_version > VERSION; \ + echo "Updated to OpenTelemetry Collector version from $(PRIOR_BUIlD_VERSION) $$latest_version" + .PHONY: gotidy gotidy: @$(MAKE) for-all-target TARGET="tidy" From 42dc3151d4977990bec9ab03f66614b200a47ffe Mon Sep 17 00:00:00 2001 From: Nathan Slaughter <28688390+nslaughter@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:59:23 -0500 Subject: [PATCH 2/4] fix(makefile): update versioning mechanism for OpenTelemetry Collector --- collector/Makefile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/collector/Makefile b/collector/Makefile index 50846485a4..f6df93de37 100644 --- a/collector/Makefile +++ b/collector/Makefile @@ -4,13 +4,13 @@ BASE_SPACE:=$(shell pwd) BUILD_SPACE:=$(BASE_SPACE)/build BUCKET_NAME:=lambda-artifacts-$(shell dd if=/dev/random bs=8 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n') LAYER_NAME:=otel-collector -VERSION=$(shell curl -s https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector-contrib/main/versions.yaml | grep 'version:' | head -1 | awk '{print $$2}') +OTELCOL_VERSION="UNSET" # run recipe set-otelcol-version to get this GIT_SHA=$(shell git rev-parse HEAD) GOARCH ?= amd64 GOBUILD=GO111MODULE=on CGO_ENABLED=0 installsuffix=cgo go build -trimpath BUILD_INFO_IMPORT_PATH=main -LDFLAGS=-ldflags "-s -w -X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA) -X $(BUILD_INFO_IMPORT_PATH).Version=$(VERSION) \ +LDFLAGS=-ldflags "-s -w -X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA) -X $(BUILD_INFO_IMPORT_PATH).Version=$(OTELCOL_VERSION) \ -X github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter.collectorDistribution=opentelemetry-collector-lambda" TOOLS_MOD_DIR := ./internal/tools @@ -33,11 +33,10 @@ clean: rm -rf build/ .PHONY: build -build: clean +build: clean set-otelcol-version @echo Building otel collector extension mkdir -p $(BUILD_SPACE)/extensions GOOS=linux GOARCH=$(GOARCH) $(GOBUILD) $(LDFLAGS) -o $(BUILD_SPACE)/extensions . - @$(MAKE) update-collector-version .PHONY: package package: build @@ -56,11 +55,10 @@ publish-layer: package aws lambda publish-layer-version --layer-name $(LAYER_NAME) --zip-file fileb://$(BUILD_SPACE)/opentelemetry-collector-layer-$(GOARCH).zip --compatible-runtimes nodejs14.x nodejs16.x nodejs18.x java11 python3.8 python3.9 python3.10 python3.11 --query 'LayerVersionArn' --output text @echo OpenTelemetry Collector layer published. -.PHONY: update-collector-version -update-collector-version: - @latest_version=$(shell curl -s https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector-contrib/main/versions.yaml | grep 'version:' | head -1 | awk '{print $$2}'); \ - echo $$latest_version > VERSION; \ - echo "Updated to OpenTelemetry Collector version from $(PRIOR_BUIlD_VERSION) $$latest_version" +.PHONY: set-otelcol-version +set-otelcol-version: + @OTELCOL_VERSION=$$(grep "go.opentelemetry.io/collector/otelcol v" go.mod | awk '{print $$2; exit}'); \ + echo $$OTELCOL_VERSION > VERSION; \ .PHONY: gotidy gotidy: From 5f84af71afd8cb0393a0260ea07e5c1fddea985c Mon Sep 17 00:00:00 2001 From: Nathan Slaughter <28688390+nslaughter@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:59:32 -0500 Subject: [PATCH 3/4] fix(makefile): update versioning mechanism for OpenTelemetry Collector Replace the mechanism to fetch VERSION from remote versions.yaml with OTELCOL_VERSION placeholder. Add a new target set-otelcol-version to set the OpenTelemetry Collector version from go.mod. Modify the build target to depend on set-otelcol-version. Remove the update-collector-version target and its usage in the build target. --- collector/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/VERSION b/collector/VERSION index 9e6528fe3e..aee6ab9fa6 100644 --- a/collector/VERSION +++ b/collector/VERSION @@ -1 +1 @@ -v0.91.0 +v0.102.1 From acbc01de86107b5500a78b00a6c947f4a4b69cf4 Mon Sep 17 00:00:00 2001 From: Nathan Slaughter <28688390+nslaughter@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:05:55 -0500 Subject: [PATCH 4/4] chore: remove VERSION file and update gitignore modified: .gitignore deleted: collector/VERSION --- .gitignore | 2 ++ collector/VERSION | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 collector/VERSION diff --git a/.gitignore b/.gitignore index 77105f51dd..71c07fce06 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ __pycache__/* build.toml *.zip + +collector/VERSION diff --git a/collector/VERSION b/collector/VERSION deleted file mode 100644 index aee6ab9fa6..0000000000 --- a/collector/VERSION +++ /dev/null @@ -1 +0,0 @@ -v0.102.1