Skip to content

Commit

Permalink
Remove dependabot and add more dependencies to renovate (#205)
Browse files Browse the repository at this point in the history
Removes the configuration files for dependabot and uses the labeler.yml config in nginxinc/k8s-common.
Also adds more dependencies for renovate and fixes linter errors
  • Loading branch information
lucacome authored Aug 22, 2024
1 parent dc5be61 commit ae8a908
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 115 deletions.
21 changes: 0 additions & 21 deletions .github/dependabot.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/labeler.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/dependabot-auto-merge.yml

This file was deleted.

10 changes: 9 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ linters:
- asciicheck
- bidichk
- contextcheck
- copyloopvar
- dupword
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exportloopref
- fatcontext
- forcetypeassert
- ginkgolinter
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ repos:

ci:
skip: [golangci-lint-full]
autoupdate_schedule: quarterly # We use renovate for more frequent updates and there's no way to disable autoupdate
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# renovate: datasource=docker depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION = v1.60.1
.DEFAULT_GOAL := help

.PHONY: help
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cmd/generator/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions tests/Dockerfile

This file was deleted.

40 changes: 5 additions & 35 deletions tests/exporter_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package tests

import (
"bufio"
"context"
"errors"
"fmt"
"io"
"log/slog"
"os"
"strings"
"sync"

Expand Down Expand Up @@ -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
Expand All @@ -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"

Expand All @@ -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

Expand Down

0 comments on commit ae8a908

Please sign in to comment.