chore(dependencies): update toools versions (#5252)

* chore(dependencies): update toools versions

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(dependencies): update toools versions

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(dependencies): update toools versions

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(dependencies): update toools versions

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(dependencies): update toools versions

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(dependencies): update toools versions

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(dependencies): update toools versions

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

---------

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
This commit is contained in:
Ivan Ka 2025-04-15 13:37:06 +01:00 committed by GitHub
parent 333cf18fee
commit 7ae0405537
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 116 additions and 14 deletions

View File

@ -52,6 +52,14 @@ module.exports = {
"depNameTemplate": "kubernetes-sigs/external-dns",
"datasourceTemplate": "github-releases",
"versioningTemplate": "semver"
}
},
{
"customType": "regex",
"fileMatch": [".*"],
"matchStrings": [
"datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s.*?_VERSION=(?<currentValue>.*)\\s"
],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
},
]
};

View File

@ -47,3 +47,4 @@ jobs:
with:
path-to-profile: profile.cov
if: github.actor != 'nektos/act'
continue-on-error: true

View File

@ -24,28 +24,26 @@ cover-html: cover
@go tool cover -html=cover.out
#? controller-gen: download controller-gen if necessary
controller-gen:
controller-gen-install:
@scripts/install-tools.sh --generator
ifeq (, $(shell which controller-gen))
@{ \
set -e ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0 ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif
#? golangci-lint: Install golangci-lint tool
golangci-lint:
@command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.0.2
#? controller-gen-install: download controller-gen if necessary
controller-gen-install:
@scripts/install-tools.sh --generator
#? golangci-lint-verify: Verify golangci-lint configuration
golangci-lint-verify: golangci-lint
@golangci-lint config verify
#? golangci-lint-install: Install golangci-lint tool
golangci-lint-install:
@scripts/install-tools.sh --golangci
#? go-lint: Run the golangci-lint tool
.PHONY: go-lint
go-lint: golangci-lint
go-lint: golangci-lint-install
golangci-lint config verify
gofmt -l -s -w .
golangci-lint run --timeout=30m --fix ./...
@ -71,7 +69,7 @@ lint: licensecheck go-lint oas-lint
#? crd: Generates CRD using controller-gen
.PHONY: crd
crd: controller-gen
crd: controller-gen-install
${CONTROLLER_GEN} crd:crdVersions=v1 paths="./endpoint/..." output:crd:stdout > docs/contributing/crd-source/crd-manifest.yaml
#? test: The verify target runs tasks similar to the CI tasks, but without code coverage

95
scripts/install-tools.sh Executable file
View File

@ -0,0 +1,95 @@
#!/usr/bin/env bash
# Copyright 2025 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools
CONTROLLER_TOOLS_GENERATOR_VERSION=v0.15.0
# renovate: datasource=github-releases depName=golangci/golangci-lint
GOLANG_CI_LINTER_VERSION=v2.0.2
# Execute
# scripts/install-tools.sh
# scripts/install-tools.sh -h
# scripts/install-tools.sh --generator
# scripts/install-tools.sh --golangci
show_help() {
cat << EOF
'external-dns' helm linter helper commands
Usage: $(basename "$0") <options>
-h, --help Display help
--generator Install generator
--golangci Install golangci linter
EOF
}
install_generator() {
# https://github.com/kubernetes-sigs/controller-tools/blob/main/cmd/controller-gen/main.go
local install=false
if [[ -x $(which controller-gen) ]]; then
local version=$(controller-gen --version | sed 's/Version: //')
if [[ "${version}" == "${CONTROLLER_TOOLS_GENERATOR_VERSION}" ]]; then
install=false
else
install=true
fi
else
install=true
fi
if [[ "$install" == true ]]; then
set -ex ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_TOOLS_GENERATOR_VERSION} ;
fi
}
install_golangci() {
local install=false
if [[ -x $(which golangci-lint) ]]; then
local version=$(golangci-lint version --short)
if [[ "${version}" == "${GOLANG_CI_LINTER_VERSION#v}" ]]; then
install=false
else
install=true
fi
else
install=true
fi
if [[ "$install" == true ]]; then
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/cc3567e3127d8530afb69be1b7bd20ba9ebcc7c1/install.sh \
| sh -s -- -b $(go env GOPATH)/bin "${GOLANG_CI_LINTER_VERSION}"
fi
}
function main() {
case $1 in
--generator)
install_generator
;;
--golangci)
install_golangci
;;
-h|--help)
show_help
;;
*)
echo "unknown sub-command" >&2
show_help
exit 1
;;
esac
}
main "$@"