Skip to content

Commit f96a4bd

Browse files
matej-gAneurysm9
andauthored
Add registry link check target to Makefile (#446)
* Add registry link check target to Makefile Signed-off-by: Matej Gera <[email protected]> * Apply suggestions - Do not exit, return warning only - Put detectors in a separate type * Update CHANGELOG.md Co-authored-by: Anthony Mirabella <[email protected]>
1 parent c1c564f commit f96a4bd

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
88

99
## [Unreleased]
1010

11+
### Added
12+
13+
- Add registry link check to `Makefile` and pre-release script. (#446)
14+
1115
## [0.15.0] - 2020-12-11
1216

1317
### Added

Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
66
ALL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort))
77
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort)
88

9+
# URLs to check if all contrib entries exist in the registry.
10+
REGISTRY_BASE_URL = https://raw.githubusercontent.com/open-telemetry/opentelemetry.io/master/content/en/registry
11+
CONTRIB_REPO_URL = https://github.com/open-telemetry/opentelemetry-go-contrib/tree/master
912

1013
# Mac OS Catalina 10.5.x doesn't support 386. Hence skip 386 test
1114
SKIP_386_TEST = false
@@ -159,6 +162,29 @@ license-check:
159162
exit 1; \
160163
fi
161164

165+
.PHONY: registry-links-check
166+
registry-links-check:
167+
@checkRes=$$( \
168+
for f in $$( find ./instrumentation ./exporters ./detectors ! -path './instrumentation/net/*' -type f -name 'go.mod' -exec dirname {} \; | egrep -v '/example|/utils' | sort ) \
169+
./instrumentation/net/http; do \
170+
TYPE="instrumentation"; \
171+
if $$(echo "$$f" | grep -q "exporters"); then \
172+
TYPE="exporter"; \
173+
fi; \
174+
if $$(echo "$$f" | grep -q "detectors"); then \
175+
TYPE="detector"; \
176+
fi; \
177+
NAME=$$(echo "$$f" | sed -e 's/.*\///' -e 's/.*otel//'); \
178+
LINK=$(CONTRIB_REPO_URL)/$$(echo "$$f" | sed -e 's/..//' -e 's/\/otel.*$$//'); \
179+
if ! $$(curl -s $(REGISTRY_BASE_URL)/$${TYPE}-go-$${NAME}.md | grep -q "$${LINK}"); then \
180+
echo "$$f"; \
181+
fi \
182+
done; \
183+
); \
184+
if [ -n "$$checkRes" ]; then \
185+
echo "WARNING: registry link check failed for the following packages:"; echo "$${checkRes}"; \
186+
fi
187+
162188
.PHONY: dependabot-check
163189
dependabot-check:
164190
@result=$$( \

pre_release.sh

+3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ make lint
144144
# Add changes and commit.
145145
git add .
146146
make ci
147+
# Check whether registry links are up to date
148+
make registry-links-check
149+
147150
declare COMMIT_MSG=""
148151
if [ -n "${OTEL_TAG}" ]; then
149152
COMMIT_MSG+="Bumping otel version to ${OTEL_TAG}"

0 commit comments

Comments
 (0)