Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions .github/workflows/build-and-test-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ jobs:
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: Run Unit Tests
run: make -j4 gotest
arm-unittest:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ jobs:
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }}
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: Run `govulncheck`
run: make govulncheck

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/tidy-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ jobs:
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: go mod tidy
run: |
make gotidy
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
bin/
dist/
.tools/
/local

# GoLand IDEA
Expand Down Expand Up @@ -37,4 +36,3 @@ go.work*
# npm (used for markdown-link-check)
node_modules/*
package-lock.json

105 changes: 53 additions & 52 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ ALL_DOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \
-type f | sort)

# ALL_MODULES includes ./* dirs (excludes . dir)
ALL_MODULES := $(shell find . -type f -name "go.mod" -exec dirname {} \; | sort | grep -E '^./' )
ALL_MODULES := $(shell find . -mindepth 2 \
-type f \
-name "go.mod" \
-not -path "./internal/tools/*" \
-exec dirname {} \; | sort )

CMD?=

Expand Down Expand Up @@ -61,8 +65,8 @@ gotest-with-junit:
@$(MAKE) for-all-target TARGET="test-with-junit"

.PHONY: goporto
goporto: $(PORTO)
$(PORTO) -w --include-internal --skip-dirs "^cmd/mdatagen/third_party$$" ./
goporto:
$(GO_TOOL) porto -w --include-internal --skip-dirs "^cmd/mdatagen/third_party$$" ./

.PHONY: for-all
for-all:
Expand Down Expand Up @@ -101,8 +105,8 @@ govulncheck:
@$(MAKE) for-all-target TARGET="vulncheck"

.PHONY: addlicense
addlicense: $(ADDLICENSE)
@ADDLICENSEOUT=`$(ADDLICENSE) -s=only -y "" -c "The OpenTelemetry Authors" $(ALL_SRC) 2>&1`; \
addlicense:
@ADDLICENSEOUT=`$(GO_TOOL) addlicense -s=only -y "" -c "The OpenTelemetry Authors" $(ALL_SRC) 2>&1`; \
if [ "$$ADDLICENSEOUT" ]; then \
echo "$(ADDLICENSE) FAILED => add License errors:\n"; \
echo "$$ADDLICENSEOUT\n"; \
Expand All @@ -112,7 +116,7 @@ addlicense: $(ADDLICENSE)
fi

.PHONY: checklicense
checklicense: $(ADDLICENSE)
checklicense:
@licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*') ; do \
awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=3 { found=1; next } END { if (!found) print FILENAME }' $$f; \
awk '/SPDX-License-Identifier: Apache-2.0|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \
Expand All @@ -123,12 +127,12 @@ checklicense: $(ADDLICENSE)
fi

.PHONY: misspell
misspell: $(MISSPELL)
$(MISSPELL) -error $(ALL_DOC)
misspell:
$(GO_TOOL) misspell -error $(ALL_DOC)

.PHONY: misspell-correction
misspell-correction: $(MISSPELL)
$(MISSPELL) -w $(ALL_DOC)
misspell-correction:
$(GO_TOOL) misspell -w $(ALL_DOC)

.PHONY: run
run: otelcorecol
Expand Down Expand Up @@ -159,13 +163,13 @@ otelcorecol:
pushd cmd/otelcorecol && CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/otelcorecol_$(GOOS)_$(GOARCH) -tags "grpcnotrace" ./... && popd

.PHONY: genotelcorecol
genotelcorecol: install-tools
genotelcorecol:
pushd cmd/builder/ && $(GOCMD) run ./ --skip-compilation --config ../otelcorecol/builder-config.yaml --output-path ../otelcorecol && popd
$(MAKE) -C cmd/otelcorecol fmt

.PHONY: actionlint
actionlint: $(ACTIONLINT)
$(ACTIONLINT) -config-file .github/actionlint.yaml -color .github/workflows/*.yml .github/workflows/*.yaml
actionlint:
$(GO_TOOL) actionlint -config-file .github/actionlint.yaml -color .github/workflows/*.yml .github/workflows/*.yaml

.PHONY: ocb
ocb:
Expand Down Expand Up @@ -246,13 +250,10 @@ genproto_sub:
@rm -rf $(OPENTELEMETRY_PROTO_SRC_DIR)/*
@rm -rf $(OPENTELEMETRY_PROTO_SRC_DIR)/.* > /dev/null 2>&1 || true

remove-pdatagen:
rm -f .tools/pdatagen

# Generate structs, functions and tests for pdata package. Must be used after any changes
# to proto and after running `make genproto`
genpdata: remove-pdatagen $(PDATAGEN)
$(PDATAGEN)
genpdata:
cd internal/cmd/pdatagen && $(GOCMD) run main.go -C $(SRC_ROOT)
$(MAKE) -C pdata fmt

INTERNAL_PROTO_SRC_DIRS := exporter/exporterhelper/internal/queue pdata/xpdata/request/internal
Expand Down Expand Up @@ -321,17 +322,17 @@ certs-dryrun:
@internal/buildscripts/gen-certs.sh -d

.PHONY: checkapi
checkapi: $(CHECKAPI)
$(CHECKAPI) -folder . -config .checkapi.yaml
checkapi:
$(GO_TOOL) checkapi -folder . -config .checkapi.yaml

# Verify existence of READMEs for components specified as default components in the collector.
.PHONY: checkdoc
checkdoc: $(CHECKFILE)
$(CHECKFILE) --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME) --file-name "README.md"
checkdoc:
$(GO_TOOL) checkfile --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME) --file-name "README.md"

# Construct new API state snapshots
.PHONY: apidiff-build
apidiff-build: $(APIDIFF)
apidiff-build:
@$(foreach pkg,$(ALL_PKGS),$(call exec-command,./internal/buildscripts/gen-apidiff.sh -p $(pkg)))

# If we are running in CI, change input directory
Expand All @@ -343,33 +344,33 @@ endif

# Compare API state snapshots
.PHONY: apidiff-compare
apidiff-compare: $(APIDIFF)
apidiff-compare:
@$(foreach pkg,$(ALL_PKGS),$(call exec-command,./internal/buildscripts/compare-apidiff.sh -p $(pkg)))

.PHONY: multimod-verify
multimod-verify: $(MULTIMOD)
multimod-verify:
@echo "Validating versions.yaml"
$(MULTIMOD) verify
$(GO_TOOL) multimod verify

MODSET?=stable
.PHONY: multimod-prerelease
multimod-prerelease: $(MULTIMOD)
$(MULTIMOD) prerelease -s=true -b=false -v ./versions.yaml -m ${MODSET}
multimod-prerelease:
$(GO_TOOL) multimod prerelease -s=true -b=false -v ./versions.yaml -m ${MODSET}
$(MAKE) gotidy

COMMIT?=HEAD
[email protected]:open-telemetry/opentelemetry-collector.git
.PHONY: push-tags
push-tags: $(MULTIMOD)
$(MULTIMOD) verify
set -e; for tag in `$(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} --print-tags | grep -v "Using" `; do \
push-tags:
$(GO_TOOL) multimod verify
set -e; for tag in `$(GO_TOOL) multimod tag -m ${MODSET} -c ${COMMIT} --print-tags | grep -v "Using" `; do \
echo "pushing tag $${tag}"; \
git push ${REMOTE} $${tag}; \
done;

.PHONY: check-changes
check-changes: $(MULTIMOD)
$(MULTIMOD) diff -p $(PREVIOUS_VERSION) -m $(MODSET)
check-changes:
$(GO_TOOL) multimod diff -p $(PREVIOUS_VERSION) -m $(MODSET)

.PHONY: prepare-release
prepare-release:
Expand Down Expand Up @@ -429,29 +430,29 @@ checklinks:
# error message "failed to sync logger: sync /dev/stderr: inappropriate ioctl for device"
# is a known issue but does not affect function.
.PHONY: crosslink
crosslink: $(CROSSLINK)
crosslink:
@echo "Executing crosslink"
$(CROSSLINK) --root=$(shell pwd) --prune
$(GO_TOOL) crosslink --root=$(shell pwd) --prune

FILENAME?=$(shell git branch --show-current)
.PHONY: chlog-new
chlog-new: $(CHLOGGEN)
$(CHLOGGEN) new --config $(CHLOGGEN_CONFIG) --filename $(FILENAME)
chlog-new:
$(GO_TOOL) chloggen new --config $(CHLOGGEN_CONFIG) --filename $(FILENAME)

.PHONY: chlog-validate
chlog-validate: $(CHLOGGEN)
$(CHLOGGEN) validate --config $(CHLOGGEN_CONFIG)
chlog-validate:
$(GO_TOOL) chloggen validate --config $(CHLOGGEN_CONFIG)

.PHONY: chlog-preview
chlog-preview: $(CHLOGGEN)
$(CHLOGGEN) update --config $(CHLOGGEN_CONFIG) --dry
chlog-preview:
$(GO_TOOL) chloggen update --config $(CHLOGGEN_CONFIG) --dry

.PHONY: chlog-update
chlog-update: $(CHLOGGEN)
$(CHLOGGEN) update --config $(CHLOGGEN_CONFIG) --version $(VERSION)
chlog-update:
$(GO_TOOL) chloggen update --config $(CHLOGGEN_CONFIG) --version $(VERSION)

.PHONY: builder-integration-test
builder-integration-test: $(ENVSUBST)
builder-integration-test:
cd ./cmd/builder && ./test/test.sh

.PHONY: mdatagen-test
Expand All @@ -462,20 +463,20 @@ mdatagen-test:
cd cmd/mdatagen && $(GOCMD) test ./...

.PHONY: generate-gh-issue-templates
generate-gh-issue-templates: $(GITHUBGEN)
$(GITHUBGEN) issue-templates
generate-gh-issue-templates:
$(GO_TOOL) githubgen issue-templates

.PHONY: generate-codeowners
generate-codeowners: $(GITHUBGEN)
$(GITHUBGEN) --default-codeowner "open-telemetry/collector-approvers" -skipgithub codeowners
generate-codeowners:
$(GO_TOOL) githubgen --default-codeowner "open-telemetry/collector-approvers" -skipgithub codeowners

.PHONY: gengithub
gengithub: $(GITHUBGEN) generate-codeowners generate-gh-issue-templates
gengithub: generate-codeowners generate-gh-issue-templates

.PHONY: gendistributions
gendistributions: $(GITHUBGEN)
$(GITHUBGEN) distributions
gendistributions:
$(GO_TOOL) githubgen distributions

.PHONY: generate-chloggen-components
generate-chloggen-components: $(GITHUBGEN)
$(GITHUBGEN) chloggen-components
$(GO_TOOL) githubgen chloggen-components
Loading
Loading