Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] make update-otel #32038

Merged
merged 10 commits into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ OTEL_VERSION=main
OTEL_STABLE_VERSION=main

VERSION=$(shell git describe --always --match "v[0-9]*" HEAD)
TRIMMED_VERSION=$(shell grep -o 'v[^-]*' <<< "$(VERSION)" | cut -c 2-)
CORE_VERSIONS=$(SRC_PARENT_DIR)/opentelemetry-collector/versions.yaml
GOMOD=$(SRC_ROOT)/go.mod

COMP_REL_PATH=cmd/otelcontribcol/components.go
MOD_NAME=github.com/open-telemetry/opentelemetry-collector-contrib
Expand Down Expand Up @@ -344,13 +347,44 @@ telemetrygen:
cd ./cmd/telemetrygen && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/telemetrygen_$(GOOS)_$(GOARCH)$(EXTENSION) \
-tags $(GO_BUILD_TAGS) .

# helper function to update the core packages in builder-config.yaml
# input parameters are
# $(1) = path/to/versions.yaml (where it greps the relevant packages)
# $(2) = path/to/go.mod (where it greps the package-versions)
# $(3) = path/to/builder-config.yaml (where we want to update the versions)
define updatehelper
if [ ! -f $(1) ] || [ ! -f $(2) ] || [ ! -f $(3) ]; then \
echo "Usage: updatehelper <versions.yaml> <go.mod> <builder-config.yaml>"; \
exit 1; \
fi
grep "go\.opentelemetry\.io" $(1) | sed 's/^\s*-\s*//' | while IFS= read -r line; do \
if grep -qF "$$line" $(2); then \
package=$$(grep -F "$$line" $(2) | head -n 1 | awk '{print $$1}'); \
version=$$(grep -F "$$line" $(2) | head -n 1 | awk '{print $$2}'); \
builder_package=$$(grep -F "$$package" $(3) | awk '{print $$3}'); \
builder_version=$$(grep -F "$$package" $(3) | awk '{print $$4}'); \
if [ "$$builder_package" == "$$package" ]; then \
echo "$$builder_version";\
sed -i -e "s|$$builder_package.*$$builder_version|$$builder_package $$version|" $(3); \
echo "[$(3)]: $$package updated to $$version"; \
fi; \
fi; \
done
endef


.PHONY: update-otel
update-otel:$(MULTIMOD)
$(MULTIMOD) sync -s=true -o ../opentelemetry-collector -m stable --commit-hash $(OTEL_STABLE_VERSION)
git add . && git commit -s -m "[chore] multimod update stable modules"
git add . && git commit -s -m "[chore] multimod update stable modules" ; \
$(MULTIMOD) sync -s=true -o ../opentelemetry-collector -m beta --commit-hash $(OTEL_VERSION)
crobert-1 marked this conversation as resolved.
Show resolved Hide resolved
git add . && git commit -s -m "[chore] multimod update beta modules"
git add . && git commit -s -m "[chore] multimod update beta modules" ; \
$(call updatehelper,$(CORE_VERSIONS),$(GOMOD),./cmd/otelcontribcol/builder-config.yaml)
$(call updatehelper,$(CORE_VERSIONS),$(GOMOD),./cmd/oteltestbedcol/builder-config.yaml)
$(MAKE) gotidy
$(MAKE) genotelcontribcol
$(MAKE) genoteltestbedcol
$(MAKE) oteltestbedcol
crobert-1 marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: otel-from-tree
otel-from-tree:
Expand Down