From db4a9e59f8c1255549dfd2eaf32904b53cd8c801 Mon Sep 17 00:00:00 2001 From: Steve Flanders Date: Mon, 8 Feb 2021 19:37:05 -0500 Subject: [PATCH] Configure dependabot (#85) * Configure dependabot Also better organize Makefile --- .github/dependabot.yml | 16 +++++++++++++ Makefile | 51 +++++++++++++++++++++++++++++++----------- go.mod | 1 + go.sum | 10 +++++++++ 4 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..33d1ea90f8c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +# File generated by "make gendependabot"; DO NOT EDIT. + +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "gomod" + directory: "/examples/prometheus-federation/prom-counter" + schedule: + interval: "weekly" + - package-ecosystem: "gomod" + directory: "/examples/splunk-hec/logging" + schedule: + interval: "weekly" diff --git a/Makefile b/Makefile index a84514768e2..52d11e9869b 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,14 @@ +### VARIABLES + +ADDLICENSE= addlicense + +# All source code and documents. Used in spell check. +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 | egrep '^./' ) + # All source code excluding any third party code and excluding the testbed. # This is the code that we want to run tests for and lint, staticcheck, etc. ALL_SRC := $(shell find . -name '*.go' \ @@ -8,26 +19,22 @@ ALL_SRC := $(shell find . -name '*.go' \ # ALL_PKGS is the list of all packages where ALL_SRC files reside. ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC)))) -# All source code and documents. Used in spell check. -ALL_DOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \ - -type f | sort) +# BUILD_TYPE should be one of (dev, release). +BUILD_TYPE?=release -GOTEST_OPT?= -v -race -timeout 180s +GIT_SHA=$(shell git rev-parse --short HEAD) GO_ACC=go-acc -GOTEST=go test -GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) -ADDLICENSE= addlicense +GOOS=$(shell go env GOOS) +GOSEC=gosec +GOTEST=go test +GOTEST_OPT?= -v -race -timeout 180s +IMPI=impi +LINT=golangci-lint MISSPELL=misspell -error MISSPELL_CORRECTION=misspell -w -LINT=golangci-lint -IMPI=impi -GOSEC=gosec STATIC_CHECK=staticcheck -# BUILD_TYPE should be one of (dev, release). -BUILD_TYPE?=release -GIT_SHA=$(shell git rev-parse --short HEAD) BUILD_INFO_IMPORT_PATH=github.com/signalfx/splunk-otel-collector/internal/version BUILD_X1=-X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA) ifdef VERSION @@ -36,6 +43,8 @@ endif BUILD_X3=-X $(BUILD_INFO_IMPORT_PATH).BuildType=$(BUILD_TYPE) BUILD_INFO=-ldflags "${BUILD_X1} ${BUILD_X2} ${BUILD_X3}" +### FUNCTIONS + # Function to execute a command. Note the empty line before endef to make sure each command # gets executed separately instead of concatenated with previous one. # Accepts command to execute as first parameter. @@ -44,6 +53,8 @@ $(1) endef +### TARGETS + all-srcs: @echo $(ALL_SRC) | tr ' ' '\n' | sort @@ -83,6 +94,20 @@ checklicense: echo "Check License finished successfully"; \ fi +DEPENDABOT_PATH=./.github/dependabot.yml +.PHONY: gendependabot +gendependabot: + @echo "Recreate dependabot.yml file" + @echo "# File generated by \"make gendependabot\"; DO NOT EDIT.\n" > ${DEPENDABOT_PATH} + @echo "version: 2" >> ${DEPENDABOT_PATH} + @echo "updates:" >> ${DEPENDABOT_PATH} + @echo "Add entry for \"/\"" + @echo " - package-ecosystem: \"gomod\"\n directory: \"/\"\n schedule:\n interval: \"weekly\"" >> ${DEPENDABOT_PATH} + @set -e; for dir in $(ALL_MODULES); do \ + (echo "Add entry for \"$${dir:1}\"" && \ + echo " - package-ecosystem: \"gomod\"\n directory: \"$${dir:1}\"\n schedule:\n interval: \"weekly\"" >> ${DEPENDABOT_PATH} ); \ + done + .PHONY: misspell misspell: $(MISSPELL) $(ALL_DOC) diff --git a/go.mod b/go.mod index 52037af98aa..627ee9c44b1 100644 --- a/go.mod +++ b/go.mod @@ -39,6 +39,7 @@ require ( github.com/sirupsen/logrus v1.6.0 github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.7.0 + github.com/tcnksm/ghr v0.13.0 // indirect go.opentelemetry.io/collector v0.19.1-0.20210127225953-68c5961f7bc2 go.uber.org/zap v1.16.0 golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e diff --git a/go.sum b/go.sum index 48a1bdae190..5c871bdb4a1 100644 --- a/go.sum +++ b/go.sum @@ -169,6 +169,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWso github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/Showmax/go-fqdn v1.0.0 h1:0rG5IbmVliNT5O19Mfuvna9LL7zlHyRfsSvBPZmF9tM= github.com/Showmax/go-fqdn v1.0.0/go.mod h1:SfrFBzmDCtCGrnHhoDjuvFnKsWjEQX/Q9ARZvOrJAko= +github.com/Songmu/retry v0.1.0 h1:hPA5xybQsksLR/ry/+t/7cFajPW+dqjmjhzZhioBILA= +github.com/Songmu/retry v0.1.0/go.mod h1:7sXIW7eseB9fq0FUvigRcQMVLR9tuHI0Scok+rkpAuA= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= @@ -1343,6 +1345,8 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/cli v1.1.1 h1:J64v/xD7Clql+JVKSvkYojLOXu1ibnY9ZjGLwSt/89w= github.com/mitchellh/cli v1.1.1/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -1903,6 +1907,12 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stripe/safesql v0.0.0-20171221195208-cddf355596fe/go.mod h1:q7b2n0JmzM1mVGfcYpanfVb2j23cXZeWFxcILPn3JV4= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tcnksm/ghr v0.13.0 h1:a5ZbaUAfiaiw6rEDJVUEDYA9YreZOkh3XAfXHWn8zu8= +github.com/tcnksm/ghr v0.13.0/go.mod h1:tcp6tzbRYE0LqFSG7ykXP/BVG1/2BkX6aIn9FFV1mIQ= +github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw= +github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE= +github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e h1:IWllFTiDjjLIf2oeKxpIUmtiDV5sn71VgeQgg6vcE7k= +github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e/go.mod h1:d7u6HkTYKSv5m6MCKkOQlHwaShTMl3HjqSGW3XtVhXM= github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ= github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4=