Skip to content

Commit 9ee316d

Browse files
author
sapcc-bot
committed
Run go-makefile-maker
1 parent 161dfec commit 9ee316d

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

.dockerignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
# TODO: uncomment when applications no longer use git to get version information
88
#.git/
99
/.github/
10-
/.gitignore
11-
/.golangci.yaml
1210
/.goreleaser.yml
1311
/.vscode/
1412
/CONTRIBUTING.md
1513
/Dockerfile
16-
/LICENSE*
1714
/Makefile.maker.yaml
1815
/README.md
1916
/build/

.github/workflows/checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
check-latest: true
3232
go-version: 1.25.4
3333
- name: Run golangci-lint
34-
uses: golangci/golangci-lint-action@v8
34+
uses: golangci/golangci-lint-action@v9
3535
with:
3636
version: latest
3737
- name: Delete pre-installed shellcheck

.golangci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ linters:
145145
enable-all: true
146146
nolintlint:
147147
require-specific: true
148+
modernize:
149+
disable:
150+
# omitzero requires removing omitempty tags in kubernetes api struct types which are nested, which is intepreted by controller-gen and breaks the CRDs.
151+
- omitzero
148152
perfsprint:
149153
# modernize generates nicer fix code
150154
concat-loop: false

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,39 @@ RUN make -C /src install PREFIX=/pkg GOTOOLCHAIN=local
1111

1212
################################################################################
1313

14+
# To only build the tests run: docker build . --target test
15+
# We can't do `FROM builder AS test` here, as then make prepare-static-check would not be cached during interactive use when developing
16+
# and caching all the tools, especially golangci-lint, takes a few minutes.
17+
FROM golang:1.25.4-alpine3.22 AS test
18+
19+
COPY Makefile /src/Makefile
20+
21+
# used below by USER
22+
RUN addgroup -g 4200 appgroup \
23+
&& adduser -h /home/appuser -s /sbin/nologin -G appgroup -D -u 4200 appuser
24+
25+
RUN apk add --no-cache --no-progress git make py3-pip \
26+
&& pip3 install --break-system-packages reuse \
27+
&& make -C /src prepare-static-check
28+
29+
30+
# We only copy here because we want the "prepare-static-check" to be cacheable.
31+
# It is not a problem that we are overwriting the go cache from the earlier steps because we do not need to rebuild those tools.
32+
COPY --from=builder /go /go
33+
COPY --from=builder /src /src
34+
35+
RUN make -C /src static-check
36+
37+
# Some things like postgres do not like to run as root. For simplicity, just always run as an unprivileged user,
38+
# but for it to be able to read the go cache, we need to allow it.
39+
RUN chown -R 4200:4200 /src/ /go/
40+
USER 4200:4200
41+
RUN cd /src \
42+
&& git config --global --add safe.directory /src \
43+
&& make build/cover.out
44+
45+
################################################################################
46+
1447
FROM alpine:3.22
1548

1649
# upgrade all installed packages to fix potential CVEs in advance

0 commit comments

Comments
 (0)