Skip to content

Commit

Permalink
Remove dependabot, add more tools to renovate (#2448)
Browse files Browse the repository at this point in the history
Problem: dependabot is not very configurable and can't keep track of all
of our dependencies. It also has been missing some updates lately.

Solution: Remove dependabot and use renovate. This also allows us to
remove some dependencies from tools.go and control them directly in the
Makefile.
  • Loading branch information
lucacome authored Aug 22, 2024
1 parent 6e86f7e commit 2db2ef7
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 158 deletions.
30 changes: 0 additions & 30 deletions .github/dependabot.yml

This file was deleted.

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

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ jobs:
- name: Output Variables
id: vars
run: |
K8S_KIND_VERSION=v1.31.0 # renovate: datasource=docker depName=kindest/node
echo "go_path=$(go env GOPATH)" >> $GITHUB_OUTPUT
echo "min_k8s_version=v1.25.16" >> $GITHUB_OUTPUT
echo "k8s_latest=$(grep -m1 'FROM kindest/node' <tests/Dockerfile | awk -F'[:]' '{print $2}')" >> $GITHUB_OUTPUT
echo "k8s_latest=${K8S_KIND_VERSION}" >> $GITHUB_OUTPUT
- name: Check if go.mod and go.sum are up to date
run: go mod tidy && git diff --exit-code -- go.mod go.sum
Expand Down Expand Up @@ -169,7 +170,7 @@ jobs:
- name: Build binary
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: latest
version: v2.2.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser
args: ${{ github.ref_type == 'tag' && 'release' || 'build --snapshot' }} --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Build binary
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: latest
version: v2.2.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser
args: build --single-target --snapshot --clean
env:
TELEMETRY_ENDPOINT: "" # disables sending telemetry
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Build binary
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: latest
version: v2.2.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser
args: build --single-target --snapshot --clean
env:
TELEMETRY_ENDPOINT: otel-collector-opentelemetry-collector.collector.svc.cluster.local:4317
Expand Down Expand Up @@ -102,11 +102,11 @@ jobs:
- name: Install cloud-provider-kind
run: |
curl -fsSL -O https://github.com/kubernetes-sigs/cloud-provider-kind/releases/download/v0.3.0/cloud-provider-kind_0.3.0_linux_amd64.tar.gz
tar -xvf cloud-provider-kind_0.3.0_linux_amd64.tar.gz
CLOUD_PROVIDER_KIND_VERSION=v0.3.0 # renovate: datasource=github-tags depName=kubernetes-sigs/cloud-provider-kind
go install github.com/kubernetes-sigs/cloud-provider-kind@${CLOUD_PROVIDER_KIND_VERSION}
- name: Run cloud-provider-kind
run: ./cloud-provider-kind & > cloud-provider-kind.log 2>&1
run: $(go env GOPATH)/bin/cloud-provider-kind & > cloud-provider-kind.log 2>&1

- name: Deploy Kubernetes
id: k8s
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ jobs:
- name: Install cloud-provider-kind
run: |
curl -fsSL -O https://github.com/kubernetes-sigs/cloud-provider-kind/releases/download/v0.3.0/cloud-provider-kind_0.3.0_linux_amd64.tar.gz
tar -xvf cloud-provider-kind_0.3.0_linux_amd64.tar.gz
CLOUD_PROVIDER_KIND_VERSION=v0.3.0 # renovate: datasource=github-tags depName=kubernetes-sigs/cloud-provider-kind
go install github.com/kubernetes-sigs/cloud-provider-kind@${CLOUD_PROVIDER_KIND_VERSION}
- name: Run cloud-provider-kind
run: ./cloud-provider-kind & > cloud-provider-kind.log 2>&1
run: $(go env GOPATH)/bin/cloud-provider-kind & > cloud-provider-kind.log 2>&1

- name: Deploy Kubernetes
id: k8s
Expand Down Expand Up @@ -130,11 +130,11 @@ jobs:

- name: Install cloud-provider-kind
run: |
curl -fsSL -O https://github.com/kubernetes-sigs/cloud-provider-kind/releases/download/v0.3.0/cloud-provider-kind_0.3.0_linux_amd64.tar.gz
tar -xvf cloud-provider-kind_0.3.0_linux_amd64.tar.gz
CLOUD_PROVIDER_KIND_VERSION=v0.3.0 # renovate: datasource=github-tags depName=kubernetes-sigs/cloud-provider-kind
go install github.com/kubernetes-sigs/cloud-provider-kind@${CLOUD_PROVIDER_KIND_VERSION}
- name: Run cloud-provider-kind
run: ./cloud-provider-kind & > cloud-provider-kind.log 2>&1
run: $(go env GOPATH)/bin/cloud-provider-kind & > cloud-provider-kind.log 2>&1

- name: Deploy Kubernetes
id: k8s
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ jobs:
pull-requests: write
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
10 changes: 4 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
with:
working-directory: ${{ matrix.directory }}
version: v1.60.2 # renovate: datasource=github-tags depName=golangci/golangci-lint

njs-lint:
name: NJS Lint
Expand All @@ -48,11 +49,6 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Get Prettier version
id: prettier-version
run: |
echo "version=$(jq -r .devDependencies.prettier ${{ github.workspace }}/internal/mode/static/nginx/modules/package.json)" >> $GITHUB_OUTPUT
- name: Setup Node.js Environment
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
Expand All @@ -64,7 +60,7 @@ jobs:
with:
config_path: ${{ github.workspace }}/internal/mode/static/nginx/modules/.prettierrc
file_pattern: ${{ github.workspace }}/internal/mode/static/nginx/modules/**/*.js
prettier_version: ${{ steps.prettier-version.outputs.version }}
prettier_version: 3.3.3 # renovate: datasource=npm depName=prettier

- name: Prettier Output
if: failure()
Expand Down Expand Up @@ -117,6 +113,8 @@ jobs:

- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
with:
version: 3.11.0 # renovate: datasource=github-tags depName=helm/chart-testing

- name: Run chart-testing
run: ct lint --print-config --config .ct.yaml
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ repos:
ci:
skip: [golangci-lint-full, prettier, markdownlint-cli2, yamllint]
autofix_prs: false
autoupdate_schedule: quarterly # We use renovate for more frequent updates and there's no way to disable autoupdate
37 changes: 22 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@ TELEMETRY_ENDPOINT=# if empty, NGF will report telemetry in its logs at debug le
TELEMETRY_ENDPOINT_INSECURE = false

ENABLE_EXPERIMENTAL ?= false
NODE_VERSION = $(shell cat .nvmrc)

# go build flags - should not be overridden by the user
GO_LINKER_FlAGS_VARS = -X main.version=${VERSION} -X main.telemetryReportPeriod=${TELEMETRY_REPORT_PERIOD} -X main.telemetryEndpoint=${TELEMETRY_ENDPOINT} -X main.telemetryEndpointInsecure=${TELEMETRY_ENDPOINT_INSECURE}
GO_LINKER_FLAGS_OPTIMIZATIONS = -s -w
GO_LINKER_FLAGS = $(GO_LINKER_FLAGS_OPTIMIZATIONS) $(GO_LINKER_FlAGS_VARS)

# tools versions
GOLANGCI_LINT_VERSION := $(shell awk '/repo:.*golangci-lint/{getline; if ($$1 == "rev:") {sub(/^v/, "", $$2); print $$2}}' $(SELF_DIR).pre-commit-config.yaml)
# renovate: datasource=go depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION = v1.60.2
# renovate: datasource=docker depName=kindest/node
KIND_K8S_VERSION = v1.31.0
# renovate: datasource=go depName=norwoodj/helm-docs
HELM_DOCS_VERSION = v1.14.2
# renovate: datasource=go depName=ahmetb/gen-crd-api-reference-docs
GEN_CRD_API_REFERENCE_DOCS_VERSION = v0.3.0
# renovate: datasource=go depName=sigs.k8s.io/controller-tools
CONTROLLER_TOOLS_VERSION = v0.16.1
# renovate: datasource=docker depName=node
NODE_VERSION = 20
# renovate: datasource=docker depName=quay.io/helmpack/chart-testing
CHART_TESTING_VERSION = v3.11.0

# variables that can be overridden by the user
PREFIX ?= nginx-gateway-fabric## The name of the NGF image. For example, nginx-gateway-fabric
Expand Down Expand Up @@ -108,7 +120,7 @@ generate: ## Run go generate

.PHONY: generate-crds
generate-crds: ## Generate CRDs and Go types using kubebuilder
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd object paths=./apis/... output:crd:artifacts:config=config/crd/bases
go run sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) crd object paths=./apis/... output:crd:artifacts:config=config/crd/bases
kubectl kustomize config/crd >deploy/crds.yaml

.PHONY: install-crds
Expand All @@ -128,11 +140,11 @@ generate-manifests: ## Generate manifests using Helm.
./scripts/generate-manifests.sh

generate-api-docs: ## Generate API docs
go run github.com/ahmetb/gen-crd-api-reference-docs -config site/config/api/config.json -template-dir site/config/api -out-file site/content/reference/api.md -api-dir "github.com/nginxinc/nginx-gateway-fabric/apis"
go run github.com/ahmetb/gen-crd-api-reference-docs@$(GEN_CRD_API_REFERENCE_DOCS_VERSION) -config site/config/api/config.json -template-dir site/config/api -out-file site/content/reference/api.md -api-dir "github.com/nginxinc/nginx-gateway-fabric/apis"

.PHONY: generate-helm-docs
generate-helm-docs: ## Generate the Helm chart documentation
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric jnorwood/helm-docs:latest --chart-search-root=charts --template-files _templates.gotmpl --template-files README.md.gotmpl
go run github.com/norwoodj/helm-docs/cmd/helm-docs@$(HELM_DOCS_VERSION) --chart-search-root=charts --template-files _templates.gotmpl --template-files README.md.gotmpl

.PHONY: generate-all
generate-all: generate generate-crds generate-manifests generate-api-docs generate-helm-docs ## Generate all the necessary files
Expand All @@ -151,8 +163,8 @@ deps: ## Add missing and remove unused modules, verify deps and download them to

.PHONY: create-kind-cluster
create-kind-cluster: ## Create a kind cluster
$(eval KIND_IMAGE=$(shell grep -m1 'FROM kindest/node' <$(SELF_DIR)tests/Dockerfile | awk -F'[ ]' '{print $$2}'))
kind create cluster --image $(KIND_IMAGE) --config $(KIND_CONFIG_FILE)
@kind version || (code=$$?; printf "\033[0;31mError\033[0m: there was a problem with kind. Follow the docs to install it https://kind.sigs.k8s.io/docs/user/quick-start/\n"; exit $$code)
kind create cluster --image kindest/node:$(KIND_K8S_VERSION) --config $(KIND_CONFIG_FILE)

.PHONY: delete-kind-cluster
delete-kind-cluster: ## Delete kind cluster
Expand All @@ -173,14 +185,9 @@ njs-fmt: ## Run prettier against the njs httpmatches module
vet: ## Run go vet against code
go vet ./...

.PHONY: check-golangci-lint
check-golangci-lint:
@golangci-lint --version || (code=$$?; printf "\033[0;31mError\033[0m: there was a problem with golangci-lint. Follow the docs to install it https://golangci-lint.run/welcome/install/\n"; exit $$code)
@golangci-lint --version | grep -q $(GOLANGCI_LINT_VERSION) || (printf "\033[0;33mWarning\033[0m: your golangci-lint version is different from the one specified in .pre-commit-config.yaml. The recommended version is $(GOLANGCI_LINT_VERSION)\n")

.PHONY: lint
lint: check-golangci-lint ## Run golangci-lint against code
golangci-lint run --fix
lint: ## Run golangci-lint against code
go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --fix

.PHONY: unit-test
unit-test: ## Run unit tests for the go code
Expand All @@ -199,7 +206,7 @@ njs-unit-test: ## Run unit tests for the njs httpmatches module

.PHONY: lint-helm
lint-helm: ## Run the helm chart linter
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric quay.io/helmpack/chart-testing:latest ct lint --config .ct.yaml
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric quay.io/helmpack/chart-testing:$(CHART_TESTING_VERSION) ct lint --config .ct.yaml

.PHONY: load-images
load-images: ## Load NGF and NGINX images on configured kind cluster.
Expand Down
9 changes: 0 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/nginxinc/nginx-gateway-fabric
go 1.22.0

require (
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0
github.com/go-kit/log v0.2.1
github.com/go-logr/logr v1.4.2
github.com/google/go-cmp v0.6.0
Expand All @@ -25,7 +24,6 @@ require (
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/controller-tools v0.16.1
sigs.k8s.io/gateway-api v1.1.0
)

Expand All @@ -36,7 +34,6 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
Expand All @@ -46,7 +43,6 @@ require (
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gobuffalo/flect v1.0.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
Expand All @@ -61,15 +57,12 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
Expand All @@ -96,8 +89,6 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
k8s.io/klog v0.2.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240423202451-8948a665c108 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
Expand Down
Loading

0 comments on commit 2db2ef7

Please sign in to comment.