Skip to content

Commit ffdc9f1

Browse files
authored
chore(build): onboard prow and update module url (#26)
* Update go.mod org to stackitcloud; Update build system Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * add IS_DEV Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * add renovate config Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * remove binaries from hack/tools/bin Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * Add goimports reviser as formatter Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * remove apko Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * remove SAP copyright Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * fix makefile Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * Update OWNERS & OWNER_ALIASES Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> * add ani and felix Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud> --------- Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
1 parent 2911251 commit ffdc9f1

39 files changed

+536
-124
lines changed

.github/renovate.json5

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
3+
extends: [
4+
'config:recommended',
5+
'github>stackitcloud/ske-ci-infra//config/renovate/ske.json5',
6+
],
7+
additionalReviewers: [
8+
'dergeberl',
9+
'nschad',
10+
],
11+
baseBranchPatterns: [
12+
'main',
13+
],
14+
packageRules: [
15+
{
16+
matchPackageNames: [
17+
'/^github.com/stackitcloud/stackit-sdk-go/',
18+
],
19+
postUpgradeTasks: {
20+
commands: [
21+
'make generate',
22+
],
23+
executionMode: 'branch',
24+
},
25+
},
26+
{
27+
matchManagers: [
28+
'gomod',
29+
],
30+
matchUpdateTypes: [
31+
'patch',
32+
'digest',
33+
],
34+
automerge: true,
35+
addLabels: [
36+
'skip-review',
37+
],
38+
},
39+
{
40+
matchPackageNames: [
41+
'/^k8s.io/',
42+
],
43+
matchBaseBranches: [
44+
'main',
45+
],
46+
automerge: false,
47+
},
48+
{
49+
groupName: 'devTools non-major',
50+
matchManagers: [
51+
'custom.regex',
52+
],
53+
matchFileNames: [
54+
'/Makefile$/',
55+
'/\\.mk$/',
56+
'/\\.sh$/',
57+
],
58+
matchUpdateTypes: [
59+
'minor',
60+
'patch',
61+
],
62+
automerge: true,
63+
addLabels: [
64+
'skip-review',
65+
],
66+
},
67+
],
68+
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Ignore tools/bin folder
2+
hack/tools/bin/*
3+
!hack/tools/bin/.gitkeep
4+
15
/args
26
/.kube-secrets
37
/tmp/*

.golangci.yaml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
version: "2"
2+
run:
3+
issues-exit-code: 1
4+
tests: true
5+
linters:
6+
default: none
7+
enable:
8+
- bodyclose
9+
- copyloopvar
10+
- dogsled
11+
- dupl
12+
- exhaustive
13+
- funlen
14+
- ginkgolinter
15+
- goconst
16+
- gocritic
17+
- gocyclo
18+
- goprintffuncname
19+
- govet
20+
- importas
21+
- ineffassign
22+
- misspell
23+
- nakedret
24+
- noctx
25+
- nolintlint
26+
- prealloc
27+
- revive
28+
- rowserrcheck
29+
- staticcheck
30+
- unconvert
31+
- unparam
32+
- unused
33+
- whitespace
34+
settings:
35+
dupl:
36+
threshold: 100
37+
exhaustive:
38+
default-signifies-exhaustive: true
39+
funlen:
40+
lines: 100
41+
statements: 50
42+
goconst:
43+
min-len: 2
44+
min-occurrences: 5
45+
gocritic:
46+
disabled-checks:
47+
- dupImport
48+
- ifElseChain
49+
- octalLiteral
50+
- whyNoLint
51+
- wrapperFunc
52+
- sprintfQuotedString
53+
enabled-tags:
54+
- diagnostic
55+
- experimental
56+
- opinionated
57+
- performance
58+
- style
59+
gocyclo:
60+
min-complexity: 15
61+
importas:
62+
alias:
63+
# kubernetes packages
64+
- pkg: k8s.io/api/(\w+)/(v[\w\d]+)
65+
alias: $1$2
66+
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
67+
alias: $1$2
68+
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/(\w+)/(v[\w\d]+)
69+
alias: $1$2
70+
- pkg: k8s.io/apimachinery/pkg/api/([^m]\w+)
71+
alias: api${1}
72+
- pkg: k8s.io/apimachinery/pkg/api/meta/table
73+
alias: metatable
74+
- pkg: k8s.io/apimachinery/pkg/util/(\w+)
75+
alias: util${1}
76+
- pkg: k8s.io/client-go/tools/clientcmd/api/(\w+)
77+
alias: clientcmd${1}
78+
- pkg: sigs.k8s.io/controller-runtime/pkg/client/fake
79+
alias: fakeclient
80+
- pkg: sigs.k8s.io/controller-runtime/pkg/log/zap
81+
alias: logzap
82+
- pkg: sigs.k8s.io/controller-runtime/pkg/log
83+
alias: logf
84+
lll:
85+
line-length: 165
86+
misspell:
87+
locale: US
88+
nolintlint:
89+
allow-unused: false # report any unused nolint directives
90+
require-explanation: true # require an explanation for nolint directives
91+
require-specific: true # require nolint directives to be specific about which linter is being skipped
92+
revive:
93+
confidence: 0
94+
exclusions:
95+
generated: lax
96+
presets:
97+
- comments
98+
- common-false-positives
99+
- legacy
100+
- std-error-handling
101+
rules:
102+
- linters:
103+
- goconst
104+
- noctx
105+
- dupl
106+
path: _test\.go
107+
- linters:
108+
- gocritic
109+
text: uncheckedInlineErr:.+client.Ignore(NotFound|AlreadyExists)
110+
- linters:
111+
- nolintlint
112+
text: should be written without leading space as `//nolint # don't require machine-readable nolint directives (i.e. with no leading space)
113+
- linters:
114+
- revive
115+
- staticcheck
116+
text: should not use dot imports
117+
- linters:
118+
- revive
119+
text: 'var-naming: avoid meaningless package names'
120+
path: 'pkg/csi/util/*'
121+
paths:
122+
- third_party$
123+
- builtin$
124+
- examples$
125+
- pkg/imagesync/third_party/.*
126+
formatters:
127+
enable:
128+
- goimports
129+
exclusions:
130+
generated: lax
131+
paths:
132+
- third_party$
133+
- builtin$
134+
- examples$

CODEOWNERS

Lines changed: 0 additions & 2 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

Makefile

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,69 @@
1-
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
2-
# SPDX-License-Identifier: Apache-2.0
1+
# Setting SHELL to bash allows bash commands to be executed by recipes.
2+
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
3+
SHELL = /usr/bin/env bash -o pipefail
4+
.SHELLFLAGS = -ec
5+
SOURCES := Makefile go.mod go.sum $(shell find $(DEST) -name '*.go' 2>/dev/null)
6+
VERSION ?= $(shell git describe --dirty --tags --match='v*' 2>/dev/null || git rev-parse --short HEAD)
7+
REGISTRY ?= ghcr.io
8+
REPO ?= stackitcloud/machine-controller-manager-provider-stackit
9+
PUSH ?= true
10+
PLATFORMS ?= amd64 arm64
11+
IS_DEV ?= true
312

4-
# Minimal Makefile wrapper - all logic is in justfile
5-
# This provides backward compatibility for make users
13+
ifeq ($(IS_DEV), true)
14+
REPO := $(REPO)-dev
15+
endif
616

7-
.PHONY: build
8-
build:
9-
just build
17+
include ./hack/tools.mk
1018

11-
.PHONY: build-local
12-
build-local:
13-
just build
19+
.PHONY: all
20+
all: verify
1421

15-
.PHONY: start
16-
start:
17-
just start
22+
.PHONY: image
23+
image: $(KO) ## Builds a single binary specified by TARGET
24+
KO_DOCKER_REPO=$(REGISTRY)/$(REPO) \
25+
$(KO) build --push=$(PUSH) \
26+
--image-label org.opencontainers.image.source="https://github.com/stackitcloud/machine-controller-manager-provider-stackit" \
27+
--sbom none -t $(VERSION) \
28+
--bare \
29+
--platform linux/amd64,linux/arm64 \
30+
./cmd/machine-controller
1831

19-
.PHONY: clean
20-
clean:
21-
just clean
32+
.PHONY: clean-tools-bin
33+
clean-tools-bin: ## Empty the tools binary directory.
34+
rm -rf $(TOOLS_BIN_DIR)/* $(TOOLS_BIN_DIR)/.version_*
2235

23-
.PHONY: revendor
24-
revendor:
25-
just revendor
36+
.PHONY: fmt
37+
fmt: $(GOIMPORTS_REVISER) ## Run go fmt against code.
38+
go fmt ./...
39+
$(GOIMPORTS_REVISER) .
2640

27-
.PHONY: update-dependencies
28-
update-dependencies:
29-
just update-deps
41+
.PHONY: modules
42+
modules: ## Runs go mod to ensure modules are up to date.
43+
go mod tidy
3044

31-
.PHONY: test-unit
32-
test-unit:
33-
just golang::test
45+
.PHONY: lint
46+
lint: $(GOLANGCI_LINT) ## Run golangci-lint against code.
47+
$(GOLANGCI_LINT) run ./...
3448

35-
.PHONY: docker-image
36-
docker-image:
37-
just docker-build
49+
.PHONY: check
50+
check: lint test ## Check everything (lint + test).
3851

39-
.PHONY: docker-push
40-
docker-push:
41-
just docker-push
52+
.PHONY: test
53+
test: ## Run tests.
54+
./hack/test.sh ./cmd/... ./pkg/...
4255

43-
.PHONY: lint
44-
lint:
45-
just lint
56+
.PHONY: verify-fmt
57+
verify-fmt: fmt ## Verify go code is formatted.
58+
@if !(git diff --quiet HEAD); then \
59+
echo "unformatted files detected, please run 'make fmt'"; exit 1; \
60+
fi
4661

47-
.PHONY: fmt
48-
fmt:
49-
just fmt
62+
.PHONY: verify-modules
63+
verify-modules: modules ## Verify go module files are up to date.
64+
@if !(git diff --quiet HEAD -- go.sum go.mod); then \
65+
echo "go module files are out of date, please run 'make modules'"; exit 1; \
66+
fi
67+
68+
.PHONY: verify
69+
verify: verify-fmt verify-modules check

OWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
reviewers:
2+
- machine-controller-manager-provider-stackit-reviewers
3+
approvers:
4+
- machine-controller-manager-provider-stackit-approvers

OWNERS_ALIASES

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
aliases:
2+
machine-controller-manager-provider-stackit-reviewers:
3+
- dergeberl
4+
- JuliusSte
5+
- Kumm-Kai
6+
- maboehm
7+
- nschad
8+
- rapsnx
9+
- robinschneider
10+
- timebertt
11+
- duciwuci
12+
- hown3d
13+
- xoxys
14+
- ftl
15+
- hasit97
16+
- mstueer
17+
- OlegVanHorst
18+
- jamand
19+
- breuerfelix
20+
- aniruddha2000
21+
machine-controller-manager-provider-stackit-approvers:
22+
- dergeberl
23+
- JuliusSte
24+
- Kumm-Kai
25+
- maboehm
26+
- nschad
27+
- rapsnx
28+
- robinschneider
29+
- timebertt
30+
- hown3d
31+
- xoxys
32+
- ftl
33+
- hasit97
34+
- mstueer
35+
- OlegVanHorst
36+
- jamand
37+
- breuerfelix
38+
- aniruddha2000

0 commit comments

Comments
 (0)