diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index cdfff7a..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: 2 -updates: - - package-ecosystem: github-actions - directory: / - schedule: - interval: daily - - - package-ecosystem: gomod - directories: - - "**/*" - schedule: - interval: daily - groups: - otel: - patterns: - - "go.opentelemetry.io/otel*" - - - package-ecosystem: docker - directory: /tests - schedule: - interval: daily diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 7f79d6c..0000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,28 +0,0 @@ -change: - - head-branch: ["^change/"] - -enhancement: - - head-branch: ["^feature/", "^feat/", "^enhancement/", "^enh/"] - -bug: - - head-branch: ["^fix/", "^bug/"] - -chore: - - head-branch: ["^chore/"] - -tech-debt: - - head-branch: ["^tech-debt/", "^techdebt/", "^debt/"] - -documentation: - - head-branch: ["^docs/", "^doc/"] - - changed-files: - - any-glob-to-any-file: "**/*.md" - -dependencies: - - head-branch: - ["^deps/", "^dep/", "^dependabot/", "pre-commit-ci-update-config"] - - changed-files: - - any-glob-to-any-file: ["go.mod", "go.sum"] - -tests: - - head-branch: ["^tests/", "^test/"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c27b038..b61dbcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,7 +115,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 with: - version: latest + version: v2.2.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index c210108..e56a9a1 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -9,10 +9,18 @@ jobs: triage: permissions: contents: read - pull-requests: write + pull-requests: write # for actions/labeler to add labels runs-on: ubuntu-22.04 steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + sparse-checkout: | + labeler.yml + sparse-checkout-cone-mode: false + repository: nginxinc/k8s-common + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" sync-labels: true + configuration-path: labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6185374..f0597e1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -37,6 +37,7 @@ jobs: uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: working-directory: ${{ matrix.directory }} + version: v1.60.1 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.golangci.yml b/.golangci.yml index b93acfe..cb3bd1c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -48,13 +48,13 @@ linters: - asciicheck - bidichk - contextcheck + - copyloopvar - dupword - durationcheck - errcheck - errchkjson - errname - errorlint - - exportloopref - fatcontext - forcetypeassert - ginkgolinter diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8bca28a..0e150a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: - id: gitleaks - repo: https://github.com/golangci/golangci-lint - rev: v1.60.1 + rev: v1.60.2 hooks: - id: golangci-lint-full name: golangci-lint-root diff --git a/Makefile b/Makefile index 7b24102..42f8171 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# renovate: datasource=docker depName=golangci/golangci-lint +GOLANGCI_LINT_VERSION = v1.60.1 .DEFAULT_GOAL := help .PHONY: help @@ -30,7 +32,7 @@ vet: ## Run go vet against code .PHONY: lint lint: ## Run golangci-lint against code - docker run --pull always --rm -v $(shell pwd):/telemetry-exporter -w /telemetry-exporter -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run + docker run --pull always --rm -v $(shell pwd):/telemetry-exporter -w /telemetry-exporter -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint --color always run .PHONY: dev-all dev-all: deps fmt vet lint unit-test ## Run all the development checks diff --git a/cmd/generator/parser_test.go b/cmd/generator/parser_test.go index 96ea2fa..f363f2c 100644 --- a/cmd/generator/parser_test.go +++ b/cmd/generator/parser_test.go @@ -177,7 +177,6 @@ func TestParseErrors(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() g := NewGomegaWithT(t) diff --git a/tests/Dockerfile b/tests/Dockerfile deleted file mode 100644 index 8b7b60a..0000000 --- a/tests/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -# syntax=docker/dockerfile:1.9 -# this is here so we can grab the latest version of the collector and have dependabot keep it up to date -FROM otel/opentelemetry-collector-contrib:0.107.0 diff --git a/tests/exporter_test.go b/tests/exporter_test.go index 1a8ebd7..75c5f64 100644 --- a/tests/exporter_test.go +++ b/tests/exporter_test.go @@ -1,13 +1,9 @@ package tests import ( - "bufio" "context" - "errors" "fmt" - "io" "log/slog" - "os" "strings" "sync" @@ -68,32 +64,6 @@ func (c *matchingLogConsumer) unmatchedCount() int { return len(c.expectedSubstrings) } -func getCollectorImageFromDockerfile() (string, error) { - dockerFile, err := os.Open("Dockerfile") - if err != nil { - return "", fmt.Errorf("failed to open Dockerfile: %w", err) - } - defer dockerFile.Close() - - reader := bufio.NewReader(dockerFile) - - for { - line, err := reader.ReadString('\n') - if err == io.EOF { - return "", errors.New("FROM not found in Dockerfile") - } - if err != nil { - return "", fmt.Errorf("failed to read Dockerfile: %w", err) - } - - if !strings.HasPrefix(line, "FROM ") { - continue - } - - return strings.TrimSpace(strings.TrimPrefix(line, "FROM ")), nil - } -} - var _ = Describe("Exporter", func() { var ( lc *matchingLogConsumer @@ -106,9 +76,8 @@ var _ = Describe("Exporter", func() { ctx = context.Background() // Run the collector container - - image, err := getCollectorImageFromDockerfile() - Expect(err).ToNot(HaveOccurred()) + // renovate: datasource=docker + image := "otel/opentelemetry-collector-contrib:0.106.1" const collectorCfgName = "collector.yaml" @@ -131,11 +100,12 @@ var _ = Describe("Exporter", func() { Cmd: []string{"--config=/" + collectorCfgName}, } - collector, err = testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ + var errCollector error + collector, errCollector = testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ ContainerRequest: req, Started: true, }) - Expect(err).ToNot(HaveOccurred()) + Expect(errCollector).ToNot(HaveOccurred()) // Create the exporter