Skip to content

Commit

Permalink
[chore] use multimod diff
Browse files Browse the repository at this point in the history
The logic from check-changes was moved to multimod diff.

Signed-off-by: Alex Boten <aboten@lightstep.com>
  • Loading branch information
Alex Boten committed Jul 6, 2023
1 parent 9375d95 commit 4f681f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 41 deletions.
40 changes: 2 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -432,44 +432,8 @@ push-tags: $(MULTIMOD)
done;

.PHONY: check-changes
check-changes: $(YQ)
ifndef MODSET
@echo "MODSET not defined"
@echo "usage: make check-changes PREVIOUS_VERSION=<version eg 0.52.0> MODSET=beta"
exit 1
endif
ifndef PREVIOUS_VERSION
@echo "PREVIOUS_VERSION not defined"
@echo "usage: make check-changes PREVIOUS_VERSION=<version eg 0.52.0> MODSET=beta"
exit 1
else
ifeq (, $(findstring v,$(PREVIOUS_VERSION)))
NORMALIZED_PREVIOUS_VERSION="v$(PREVIOUS_VERSION)"
else
NORMALIZED_PREVIOUS_VERSION="$(PREVIOUS_VERSION)"
endif
endif
@all_submods=$$($(YQ) e '.module-sets.*.modules[] | select(. != "go.opentelemetry.io/collector")' versions.yaml | sed 's/^go\.opentelemetry\.io\/collector\///'); \
mods=$$($(YQ) e '.module-sets.$(MODSET).modules[]' versions.yaml | sed 's/^go\.opentelemetry\.io\/collector\///'); \
changed_files=""; \
for mod in $${mods}; do \
if [ "$${mod}" == "go.opentelemetry.io/collector" ]; then \
changed_files+=$$(git diff --name-only $(NORMALIZED_PREVIOUS_VERSION) -- $$(printf '%s\n' $${all_submods[@]} | sed 's/^/:!/' | paste -sd' ' -) | grep -E '.+\.go$$'); \
elif ! git rev-parse --quiet --verify $${mod}/$(NORMALIZED_PREVIOUS_VERSION) >/dev/null; then \
echo "Module $${mod} does not have a $(NORMALIZED_PREVIOUS_VERSION) tag"; \
echo "$(MODSET) release is required."; \
exit 0; \
else \
changed_files+=$$(git diff --name-only $${mod}/$(NORMALIZED_PREVIOUS_VERSION) -- $${mod} | grep -E '.+\.go$$'); \
fi; \
done; \
if [ -n "$${changed_files}" ]; then \
echo "The following files changed in $(MODSET) modules since $(NORMALIZED_PREVIOUS_VERSION): $${changed_files}"; \
else \
echo "No $(MODSET) modules have changed since $(NORMALIZED_PREVIOUS_VERSION)"; \
echo "No need to release $(MODSET)."; \
exit 1; \
fi
check-changes: $(MULTIMOD)
$(MULTIMOD) diff -p $(PREVIOUS_VERSION) -m $(MODSET)

.PHONY: prepare-release
prepare-release:
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
go.opentelemetry.io/build-tools/checkdoc v0.8.0
go.opentelemetry.io/build-tools/chloggen v0.8.0
go.opentelemetry.io/build-tools/crosslink v0.8.0
go.opentelemetry.io/build-tools/multimod v0.8.0
go.opentelemetry.io/build-tools/multimod v0.8.1-0.20230706213918-d079ff92449b
go.opentelemetry.io/build-tools/semconvgen v0.8.0
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
golang.org/x/tools v0.10.0
Expand Down
4 changes: 2 additions & 2 deletions internal/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ go.opentelemetry.io/build-tools/chloggen v0.8.0 h1:vIKxmrbOzUDwCB8xmeej6Wc7u9dgY
go.opentelemetry.io/build-tools/chloggen v0.8.0/go.mod h1:zuYbAo3TkrHo3C7lCrM5dHWSS50BDr0UfRYtyBFv2dQ=
go.opentelemetry.io/build-tools/crosslink v0.8.0 h1:rYpcYwNX4//WbSvwHCiCPCczh9u+lYHLezrl9865nFA=
go.opentelemetry.io/build-tools/crosslink v0.8.0/go.mod h1:rWAN3EQ4rJn5ewknqw/0CkfkU4t7toCAtkl5q7VZP/M=
go.opentelemetry.io/build-tools/multimod v0.8.0 h1:6MARVCyZa5Tdn8KvRbSZzS7ypxB1gTrvLdeimCiBZSo=
go.opentelemetry.io/build-tools/multimod v0.8.0/go.mod h1:aPgW8qbcE6IoLge1LUKO5yo4XmnxsPIA+cdFjn93QrI=
go.opentelemetry.io/build-tools/multimod v0.8.1-0.20230706213918-d079ff92449b h1:Rk0wtQyi/7K3RRxUpOozW/KWcxNRCXf3rXxjS49cO9c=
go.opentelemetry.io/build-tools/multimod v0.8.1-0.20230706213918-d079ff92449b/go.mod h1:Vs8mTh7dDxNjkICTUA6BnMuZXV8tySt42BeveqgHiqM=
go.opentelemetry.io/build-tools/semconvgen v0.8.0 h1:vRAmN8CxZk9gQuzftkfmud1qLdWoCfeX0JG7zAc/LzI=
go.opentelemetry.io/build-tools/semconvgen v0.8.0/go.mod h1:h0FPWeTZw4sfjNhfFdN3mMdbJfzI0XCaD+wTWe1r0xc=
go.tmz.dev/musttag v0.7.0 h1:QfytzjTWGXZmChoX0L++7uQN+yRCPfyFm+whsM+lfGc=
Expand Down

0 comments on commit 4f681f2

Please sign in to comment.