Skip to content

Commit baea927

Browse files
Merge branch 'main' into release
2 parents b04f961 + 77e33ff commit baea927

File tree

8 files changed

+277
-403
lines changed

8 files changed

+277
-403
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/setup-go@v2
13+
- uses: actions/setup-go@v3
1414
with:
15-
go-version: ">=1.17.0"
16-
- uses: actions/checkout@v2
15+
go-version: ">=1.21.0"
16+
- uses: actions/checkout@v4
1717
- name: Build
1818
run: make
1919
# Run static/code-quality checks
2020
check:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/setup-go@v2
23+
- uses: actions/setup-go@v3
2424
with:
25-
go-version: ">=1.17.0"
26-
- uses: actions/checkout@v2
25+
go-version: ">=1.21.0"
26+
- uses: actions/checkout@v4
2727
- name: Install build tools
2828
run: make build-tools
2929
- name: Run checks
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: ubuntu-latest
3333
if: github.event_name == 'pull_request'
3434
steps:
35-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3636
with:
3737
fetch-depth: 0
3838
ref: ${{ github.event.pull_request.head.sha }}
@@ -46,7 +46,7 @@ jobs:
4646
# image build step, so no need to do it twice.
4747
if: github.event_name == 'pull_request'
4848
steps:
49-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v4
5050
- name: Install fuse-overlayfs
5151
run: sudo apt-get -y install fuse-overlayfs
5252
- name: Setup podman config
@@ -74,7 +74,7 @@ jobs:
7474
# image build step, so no need to do it twice.
7575
if: github.event_name == 'pull_request'
7676
steps:
77-
- uses: actions/checkout@v2
77+
- uses: actions/checkout@v4
7878
- name: build container image
7979
# note: forcing use of podman here since we are
8080
# using podman explicitly for the push job
@@ -85,7 +85,7 @@ jobs:
8585
runs-on: ubuntu-latest
8686
if: github.event_name == 'push'
8787
steps:
88-
- uses: actions/checkout@v2
88+
- uses: actions/checkout@v4
8989
- name: log in to quay.io
9090
# using docker for now, since podman has an issue with space
9191
# consumption: image build fails with no space left on device...

.golangci.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ linters:
55
disable-all: true
66
enable:
77
- asciicheck
8-
- deadcode
8+
# - deadcode
99
- depguard
1010
- dupl
1111
- errcheck
@@ -30,16 +30,24 @@ linters:
3030
# - nolintlint
3131
- revive
3232
- staticcheck
33-
- structcheck
33+
# - structcheck
3434
# - tagliatelle
3535
# - testpackage
3636
- typecheck
3737
- unconvert
3838
# - unparam
3939
- unused
40-
- varcheck
40+
# - varcheck
4141
- whitespace
4242
linters-settings:
43+
depguard:
44+
rules:
45+
main:
46+
list-mode: lax
47+
# using explicit 'deny' entry only to suppress linter warnings.
48+
deny:
49+
- pkg: "github.com/sirupsen/logrus"
50+
desc: not allowed
4351
funlen:
4452
lines: 188
4553
statements: 60

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build smbmetrics
2-
FROM docker.io/golang:1.18 as builder
2+
FROM docker.io/golang:1.21 as builder
33
ARG GIT_VERSION="(unset)"
44
ARG COMMIT_ID="(unset)"
55
ARG ARCH=""

cmd/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,17 @@ func main() {
3131
vers, _ := metrics.ResolveVersions(nil)
3232
log.Info("Versions", "Versions", vers)
3333

34-
log.Info("Self", "PodID", metrics.GetSelfPodID())
34+
podid := metrics.GetSelfPodID()
35+
if len(podid.Name) > 0 {
36+
log.Info("Self", "PodID", podid)
37+
}
3538

36-
loc, err := metrics.LocateSmbStatus()
39+
loc, err := metrics.LocateSMBStatus()
3740
if err != nil {
3841
log.Error(err, "Failed to locate smbstatus")
3942
os.Exit(1)
4043
}
41-
ver, err := metrics.RunSmbStatusVersion()
44+
ver, err := metrics.RunSMBStatusVersion()
4245
if err != nil {
4346
log.Error(err, "Failed to run smbstatus")
4447
os.Exit(1)

hack/install-tools.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,27 @@ _install_tool() {
3434
}
3535

3636
_install_kustomize() {
37-
_install_tool sigs.k8s.io/kustomize/kustomize/[email protected]
37+
_install_tool sigs.k8s.io/kustomize/kustomize/[email protected]
3838
}
3939

4040
_install_controller_gen() {
41-
_install_tool sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
41+
_install_tool sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
4242
}
4343

4444
_install_revive() {
45-
_install_tool github.com/mgechev/revive@v1.2.3
45+
_install_tool github.com/mgechev/revive@v1.3.7
4646
}
4747

4848
_install_golangci_lint() {
49-
_install_tool github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
49+
_install_tool github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
5050
}
5151

5252
_install_yq() {
5353
_install_tool github.com/mikefarah/yq/[email protected]
5454
}
5555

5656
_install_gosec() {
57-
_install_tool github.com/securego/gosec/v2/cmd/gosec@v2.13.1
57+
_install_tool github.com/securego/gosec/v2/cmd/gosec@v2.19.0
5858
}
5959

6060
_install_gitlint() {

internal/metrics/collectors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ type smbSharesCollector struct {
8585

8686
func (col *smbSharesCollector) Collect(ch chan<- prometheus.Metric) {
8787
sharesTotal := 0
88-
sharesMap, _ := SmbStatusSharesByMachine()
88+
sharesMap, _ := SMBStatusSharesByMachine()
8989
for machine, share := range sharesMap {
9090
sharesCount := len(share)
9191
ch <- prometheus.MustNewConstMetric(col.dsc[0],
@@ -119,7 +119,7 @@ type smbLocksCollector struct {
119119
}
120120

121121
func (col *smbLocksCollector) Collect(ch chan<- prometheus.Metric) {
122-
locks, _ := RunSmbStatusLocks()
122+
locks, _ := RunSMBStatusLocks()
123123
ch <- prometheus.MustNewConstMetric(col.dsc[0],
124124
prometheus.GaugeValue, float64(len(locks)))
125125
}

0 commit comments

Comments
 (0)