Skip to content

Commit 7ae0405

Browse files
chore(dependencies): update toools versions (#5252)
* chore(dependencies): update toools versions Signed-off-by: ivan katliarchuk <[email protected]> * chore(dependencies): update toools versions Signed-off-by: ivan katliarchuk <[email protected]> * chore(dependencies): update toools versions Signed-off-by: ivan katliarchuk <[email protected]> * chore(dependencies): update toools versions Signed-off-by: ivan katliarchuk <[email protected]> * chore(dependencies): update toools versions Signed-off-by: ivan katliarchuk <[email protected]> * chore(dependencies): update toools versions Signed-off-by: ivan katliarchuk <[email protected]> * chore(dependencies): update toools versions Signed-off-by: ivan katliarchuk <[email protected]> --------- Signed-off-by: ivan katliarchuk <[email protected]>
1 parent 333cf18 commit 7ae0405

File tree

4 files changed

+116
-14
lines changed

4 files changed

+116
-14
lines changed

.github/renovate-config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ module.exports = {
5252
"depNameTemplate": "kubernetes-sigs/external-dns",
5353
"datasourceTemplate": "github-releases",
5454
"versioningTemplate": "semver"
55-
}
55+
},
56+
{
57+
"customType": "regex",
58+
"fileMatch": [".*"],
59+
"matchStrings": [
60+
"datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s.*?_VERSION=(?<currentValue>.*)\\s"
61+
],
62+
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
63+
},
5664
]
5765
};

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ jobs:
4747
with:
4848
path-to-profile: profile.cov
4949
if: github.actor != 'nektos/act'
50+
continue-on-error: true

Makefile

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,26 @@ cover-html: cover
2424
@go tool cover -html=cover.out
2525

2626
#? controller-gen: download controller-gen if necessary
27-
controller-gen:
27+
controller-gen-install:
28+
@scripts/install-tools.sh --generator
2829
ifeq (, $(shell which controller-gen))
29-
@{ \
30-
set -e ;\
31-
go install sigs.k8s.io/controller-tools/cmd/[email protected] ;\
32-
}
3330
CONTROLLER_GEN=$(GOBIN)/controller-gen
3431
else
3532
CONTROLLER_GEN=$(shell which controller-gen)
3633
endif
3734

38-
#? golangci-lint: Install golangci-lint tool
39-
golangci-lint:
40-
@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
35+
#? controller-gen-install: download controller-gen if necessary
36+
controller-gen-install:
37+
@scripts/install-tools.sh --generator
4138

42-
#? golangci-lint-verify: Verify golangci-lint configuration
43-
golangci-lint-verify: golangci-lint
44-
@golangci-lint config verify
39+
#? golangci-lint-install: Install golangci-lint tool
40+
golangci-lint-install:
41+
@scripts/install-tools.sh --golangci
4542

4643
#? go-lint: Run the golangci-lint tool
4744
.PHONY: go-lint
48-
go-lint: golangci-lint
45+
go-lint: golangci-lint-install
46+
golangci-lint config verify
4947
gofmt -l -s -w .
5048
golangci-lint run --timeout=30m --fix ./...
5149

@@ -71,7 +69,7 @@ lint: licensecheck go-lint oas-lint
7169

7270
#? crd: Generates CRD using controller-gen
7371
.PHONY: crd
74-
crd: controller-gen
72+
crd: controller-gen-install
7573
${CONTROLLER_GEN} crd:crdVersions=v1 paths="./endpoint/..." output:crd:stdout > docs/contributing/crd-source/crd-manifest.yaml
7674

7775
#? test: The verify target runs tasks similar to the CI tasks, but without code coverage

scripts/install-tools.sh

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2025 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools
18+
CONTROLLER_TOOLS_GENERATOR_VERSION=v0.15.0
19+
# renovate: datasource=github-releases depName=golangci/golangci-lint
20+
GOLANG_CI_LINTER_VERSION=v2.0.2
21+
22+
# Execute
23+
# scripts/install-tools.sh
24+
# scripts/install-tools.sh -h
25+
# scripts/install-tools.sh --generator
26+
# scripts/install-tools.sh --golangci
27+
28+
show_help() {
29+
cat << EOF
30+
'external-dns' helm linter helper commands
31+
32+
Usage: $(basename "$0") <options>
33+
-h, --help Display help
34+
--generator Install generator
35+
--golangci Install golangci linter
36+
EOF
37+
}
38+
39+
install_generator() {
40+
# https://github.com/kubernetes-sigs/controller-tools/blob/main/cmd/controller-gen/main.go
41+
local install=false
42+
if [[ -x $(which controller-gen) ]]; then
43+
local version=$(controller-gen --version | sed 's/Version: //')
44+
if [[ "${version}" == "${CONTROLLER_TOOLS_GENERATOR_VERSION}" ]]; then
45+
install=false
46+
else
47+
install=true
48+
fi
49+
else
50+
install=true
51+
fi
52+
if [[ "$install" == true ]]; then
53+
set -ex ;\
54+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_TOOLS_GENERATOR_VERSION} ;
55+
fi
56+
}
57+
58+
install_golangci() {
59+
local install=false
60+
if [[ -x $(which golangci-lint) ]]; then
61+
local version=$(golangci-lint version --short)
62+
if [[ "${version}" == "${GOLANG_CI_LINTER_VERSION#v}" ]]; then
63+
install=false
64+
else
65+
install=true
66+
fi
67+
else
68+
install=true
69+
fi
70+
if [[ "$install" == true ]]; then
71+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/cc3567e3127d8530afb69be1b7bd20ba9ebcc7c1/install.sh \
72+
| sh -s -- -b $(go env GOPATH)/bin "${GOLANG_CI_LINTER_VERSION}"
73+
fi
74+
}
75+
76+
function main() {
77+
case $1 in
78+
--generator)
79+
install_generator
80+
;;
81+
--golangci)
82+
install_golangci
83+
;;
84+
-h|--help)
85+
show_help
86+
;;
87+
*)
88+
echo "unknown sub-command" >&2
89+
show_help
90+
exit 1
91+
;;
92+
esac
93+
}
94+
95+
main "$@"

0 commit comments

Comments
 (0)