Skip to content

Commit ad9ced9

Browse files
committed
Merge branch 'main' into release
2 parents 6a9c831 + 5aa2c4e commit ad9ced9

25 files changed

+6383
-1530
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,28 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8+
# Allow manually triggering a run in the github ui.
9+
# See: https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow
10+
workflow_dispatch: {}
11+
812
jobs:
913
# Do a build/compile smoke test
1014
build:
1115
runs-on: ubuntu-latest
1216
steps:
13-
- uses: actions/setup-go@v3
17+
- uses: actions/setup-go@v5
1418
with:
15-
go-version: ">=1.21.0"
19+
go-version: "stable"
1620
- uses: actions/checkout@v4
1721
- name: Build
1822
run: make
1923
# Run static/code-quality checks
2024
check:
2125
runs-on: ubuntu-latest
2226
steps:
23-
- uses: actions/setup-go@v3
27+
- uses: actions/setup-go@v5
2428
with:
25-
go-version: ">=1.21.0"
29+
go-version: "stable"
2630
- uses: actions/checkout@v4
2731
- name: Install build tools
2832
run: make build-tools
@@ -40,6 +44,16 @@ jobs:
4044
run: git fetch
4145
- name: Lint git commit messages
4246
run: make check-gitlint
47+
test:
48+
needs: [build, check]
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/setup-go@v5
52+
with:
53+
go-version: "stable"
54+
- uses: actions/checkout@v4
55+
- name: Run tests
56+
run: make test
4357
podmanbuild:
4458
runs-on: ubuntu-latest
4559
# don't run on push, since the "push" job contains the
@@ -81,7 +95,7 @@ jobs:
8195
run: make CONTAINER_CMD=docker image-build
8296
# push the container to quay.io - only for pushes, not PRs
8397
push:
84-
needs: [build, check]
98+
needs: [build, check, test]
8599
runs-on: ubuntu-latest
86100
if: github.event_name == 'push'
87101
steps:
@@ -96,3 +110,15 @@ jobs:
96110
- name: push container image
97111
# note: forcing use of docker here, since we did docker login above
98112
run: make CONTAINER_CMD=docker image-push
113+
- name: build dev container image
114+
# note: forcing use of docker here, since we did docker login above
115+
run: make CONTAINER_CMD=docker BASE_IMG_TAG=devbuilds-centos-amd64 image-build
116+
- name: push dev container image
117+
# note: forcing use of docker here, since we did docker login above
118+
run: make CONTAINER_CMD=docker BASE_IMG_TAG=devbuilds-centos-amd64 image-push
119+
- name: build ceph20 container image
120+
# note: forcing use of docker here, since we did docker login above
121+
run: make CONTAINER_CMD=docker BASE_IMG_TAG=ceph20-centos-amd64 image-build
122+
- name: push ceph20 container image
123+
# note: forcing use of docker here, since we did docker login above
124+
run: make CONTAINER_CMD=docker BASE_IMG_TAG=ceph20-centos-amd64 image-push

.golangci.yaml

Lines changed: 93 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,111 @@
1-
---
2-
run:
3-
timeout: 3m
1+
version: "2"
42
linters:
5-
disable-all: true
3+
default: none
64
enable:
75
- asciicheck
8-
# - deadcode
9-
- depguard
6+
- copyloopvar
107
- dupl
118
- errcheck
129
- exhaustive
13-
- exportloopref
1410
- funlen
15-
# - gci
1611
- goconst
1712
- gocritic
18-
# - godot
19-
# - godox
2013
- goheader
21-
- gofmt
22-
- gosimple
2314
- govet
24-
# - ineffassign
25-
# - ifshort
2615
- lll
27-
- megacheck
2816
- misspell
29-
# - nlreturn
30-
# - nolintlint
3117
- revive
3218
- staticcheck
33-
# - structcheck
34-
# - tagliatelle
35-
# - testpackage
36-
- typecheck
3719
- unconvert
38-
# - unparam
3920
- unused
40-
# - varcheck
4121
- whitespace
42-
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
51-
funlen:
52-
lines: 188
53-
statements: 60
54-
lll:
55-
line-length: 98
56-
revive:
57-
ignore-generated-header: false
58-
severity: error
59-
rules:
60-
- name: blank-imports
61-
- name: context-as-argument
62-
- name: context-keys-type
63-
- name: dot-imports
64-
- name: error-return
65-
- name: error-strings
66-
- name: error-naming
67-
- name: exported
68-
- name: if-return
69-
- name: increment-decrement
70-
- name: var-naming
71-
arguments: [["UID", "GID"]]
72-
- name: var-declaration
73-
- name: package-comments
74-
- name: range
75-
- name: receiver-naming
76-
- name: time-naming
77-
- name: unexported-return
78-
- name: indent-error-flow
79-
- name: errorf
80-
- name: empty-block
81-
- name: superfluous-else
82-
- name: unused-parameter
83-
- name: unreachable-code
84-
- name: redefines-builtin-id
85-
- name: atomic
86-
- name: bool-literal-in-expr
87-
- name: constant-logical-expr
88-
- name: unnecessary-stmt
89-
- name: unused-receiver
90-
- name: get-return
91-
- name: flag-parameter
92-
- name: confusing-results
93-
- name: confusing-naming
94-
- name: modifies-parameter
95-
- name: modifies-value-receiver
96-
- name: import-shadowing
97-
- name: range-val-in-closure
98-
- name: waitgroup-by-value
99-
- name: call-to-gc
100-
- name: duplicated-imports
101-
- name: argument-limit
102-
arguments: [7]
103-
- name: function-result-limit
104-
arguments: [3]
105-
- name: unhandled-error
106-
arguments: ["fmt.Printf", "fmt.Println"]
107-
# - name: struct-tag
108-
- name: line-length-limit
109-
arguments: [98]
22+
settings:
23+
funlen:
24+
lines: 188
25+
statements: 60
26+
govet:
27+
disable:
28+
- fieldalignment
29+
- shadow
30+
enable-all: true
31+
lll:
32+
line-length: 98
33+
revive:
34+
severity: error
35+
rules:
36+
- name: blank-imports
37+
- name: context-as-argument
38+
- name: context-keys-type
39+
- name: dot-imports
40+
- name: error-return
41+
- name: error-strings
42+
- name: error-naming
43+
- name: exported
44+
- name: if-return
45+
- name: increment-decrement
46+
- name: var-naming
47+
arguments:
48+
- - UID
49+
- GID
50+
- name: var-declaration
51+
- name: package-comments
52+
- name: range
53+
- name: receiver-naming
54+
- name: time-naming
55+
- name: unexported-return
56+
- name: indent-error-flow
57+
- name: errorf
58+
- name: empty-block
59+
- name: superfluous-else
60+
- name: unused-parameter
61+
- name: unreachable-code
62+
- name: redefines-builtin-id
63+
- name: atomic
64+
- name: bool-literal-in-expr
65+
- name: constant-logical-expr
66+
- name: unnecessary-stmt
67+
- name: unused-receiver
68+
- name: get-return
69+
- name: flag-parameter
70+
- name: confusing-results
71+
- name: confusing-naming
72+
- name: modifies-parameter
73+
- name: modifies-value-receiver
74+
- name: import-shadowing
75+
- name: range-val-in-closure
76+
- name: waitgroup-by-value
77+
- name: call-to-gc
78+
- name: duplicated-imports
79+
- name: argument-limit
80+
arguments:
81+
- 7
82+
- name: function-result-limit
83+
arguments:
84+
- 3
85+
- name: unhandled-error
86+
arguments:
87+
- fmt.Printf
88+
- fmt.Println
89+
- name: line-length-limit
90+
arguments:
91+
- 98
92+
exclusions:
93+
generated: lax
94+
presets:
95+
- comments
96+
- common-false-positives
97+
- legacy
98+
- std-error-handling
99+
paths:
100+
- third_party$
101+
- builtin$
102+
- examples$
103+
formatters:
104+
enable:
105+
- gofmt
106+
exclusions:
107+
generated: lax
108+
paths:
109+
- third_party$
110+
- builtin$
111+
- examples$

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Build smbmetrics
2-
FROM docker.io/golang:1.21 as builder
1+
# Args
2+
ARG BASE_IMG="quay.io/samba.org/samba-server:latest"
33
ARG GIT_VERSION="(unset)"
44
ARG COMMIT_ID="(unset)"
55
ARG ARCH=""
66

7+
# Build smbmetrics
8+
FROM docker.io/golang:1.24 AS builder
9+
710
WORKDIR /workspace
811
# Copy the Go Modules manifests
912
COPY go.mod go.mod
@@ -23,7 +26,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=on \
2326
-o smbmetrics cmd/main.go
2427

2528
# Use samba-server (with its smb.conf and samba utils) as base image
26-
FROM quay.io/samba.org/samba-server:v0.6
29+
FROM $BASE_IMG
2730
COPY --from=builder /workspace/smbmetrics /bin/smbmetrics
2831

2932
ENTRYPOINT ["/bin/smbmetrics"]

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ BUILDAH_CMD:=buildah
1414
YAMLLINT_CMD:=yamllint
1515

1616
# Image URL to use all building/pushing image targets
17-
TAG?=latest
18-
IMG?=quay.io/samba.org/samba-metrics:$(TAG)
17+
BASE_IMG_TAG?=latest
18+
BASE_IMG_URL?=quay.io/samba.org/samba-server
19+
BASE_IMG?=$(BASE_IMG_URL):$(BASE_IMG_TAG)
20+
IMG_TAG?=$(BASE_IMG_TAG)
21+
IMG_URL?=quay.io/samba.org/samba-metrics
22+
IMG?=$(IMG_URL):$(IMG_TAG)
1923

2024
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
2125
ifeq (,$(shell $(GO_CMD) env GOBIN))
@@ -94,6 +98,7 @@ image-build: Dockerfile
9498
--build-arg=GIT_VERSION="$(GIT_VERSION)" \
9599
--build-arg=COMMIT_ID="$(COMMIT_ID)" \
96100
--build-arg=ARCH="$(GOARCH)" \
101+
--build-arg=BASE_IMG="$(BASE_IMG)" \
97102
$(CONTAINER_BUILD_OPTS) -f $< -t $(IMG) .
98103

99104
# Push the container image

0 commit comments

Comments
 (0)