Skip to content

Commit bc73581

Browse files
authored
feat(makefilemaker) add makefilemaker (#25)
* add makefilemaker * add makefilemaker * add build platform to dockerfile
1 parent 7367920 commit bc73581

File tree

4 files changed

+118
-9
lines changed

4 files changed

+118
-9
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These owners will be the default owners for everything in
2+
# the repo. Unless a later match takes precedence,
3+
* @abhijith-darshan @kengou

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:experimental
22
# Build the manager binary
3-
FROM golang:1.23 as builder
3+
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 as builder
44

55
WORKDIR /workspace
66
# Copy the Go Modules manifests
@@ -25,7 +25,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build
2525

2626
# Use distroless as minimal base image to package the manager binary
2727
# Refer to https://github.com/GoogleContainerTools/distroless for more details
28-
FROM gcr.io/distroless/static:nonroot
28+
FROM --platform=${BUILDPLATFORM:-linux/amd64} gcr.io/distroless/static:nonroot
2929
LABEL source_repository="https://github.com/sapcc/disco"
3030
LABEL org.opencontainers.image.source="https://github.com/sapcc/disco"
3131
WORKDIR /

Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ IMG ?= ${IMG_REPO}:${IMG_TAG}
55

66
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
77
ENVTEST_K8S_VERSION = 1.28
8+
## Tool Versions
9+
KUSTOMIZE_VERSION ?= 5.4.1
10+
CONTROLLER_TOOLS_VERSION ?= 0.14.0
811

912
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
1013
ifeq (,$(shell go env GOBIN))
@@ -21,8 +24,8 @@ SHELL = /usr/bin/env bash -o pipefail
2124

2225
OS := $(shell go env GOOS)
2326

24-
.PHONY: all
25-
all: build
27+
.PHONY: build-all
28+
build-all: build
2629

2730
##@ General
2831

@@ -135,10 +138,6 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
135138
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
136139
ENVTEST ?= $(LOCALBIN)/setup-envtest
137140

138-
## Tool Versions
139-
KUSTOMIZE_VERSION ?= v5.4.1
140-
CONTROLLER_TOOLS_VERSION ?= v0.14.0
141-
142141
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
143142
.PHONY: kustomize
144143
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -148,9 +147,16 @@ $(KUSTOMIZE): $(LOCALBIN)
148147
.PHONY: controller-gen
149148
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
150149
$(CONTROLLER_GEN): $(LOCALBIN)
151-
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
150+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@v$(CONTROLLER_TOOLS_VERSION)
152151

153152
.PHONY: envtest
154153
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
155154
$(ENVTEST): $(LOCALBIN)
156155
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
156+
157+
install-go-licence-detector: FORCE
158+
@if ! hash go-licence-detector 2>/dev/null; then printf "\e[1;36m>> Installing go-licence-detector (this may take a while)...\e[0m\n"; go install go.elastic.co/go-licence-detector@latest; fi
159+
160+
check-dependency-licenses: FORCE install-go-licence-detector
161+
@printf "\e[1;36m>> go-licence-detector\e[0m\n"
162+
@go list -m -mod=readonly -json all | go-licence-detector -includeIndirect -rules .license-scan-rules.json -overrides .license-scan-overrides.jsonl

Makefile.maker.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Configuration file for <https://github.com/sapcc/go-makefile-maker>
2+
3+
metadata:
4+
url: https://github.com/sapcc/disco
5+
6+
binaries:
7+
- name: disco
8+
fromPackage: ./
9+
installTo: bin/
10+
11+
dockerfile:
12+
enabled: false
13+
14+
golang:
15+
setGoModVersion: false
16+
17+
golangciLint:
18+
createConfig: true
19+
20+
goReleaser:
21+
createConfig: true
22+
binaryName: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
23+
format: .tar.gz
24+
nameTemplate: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
25+
26+
githubWorkflow:
27+
ci:
28+
enabled: true
29+
coveralls: false
30+
pushContainerToGhcr:
31+
enabled: true
32+
platforms: "linux/amd64,linux/arm64"
33+
tagStrategy:
34+
- edge
35+
- latest
36+
- semver
37+
- sha
38+
securityChecks:
39+
enabled: true
40+
license:
41+
enabled: false
42+
release:
43+
enabled: true
44+
45+
makefile:
46+
enabled: false
47+
48+
renovate:
49+
enabled: true
50+
assignees:
51+
- kengou
52+
- abhijith-darshan
53+
customManagers:
54+
- customType: "regex"
55+
description: "Bump envtest version in the Makefile"
56+
fileMatch: [
57+
"^Makefile$"
58+
]
59+
matchStrings: [
60+
"ENVTEST_K8S_VERSION\\s*\\?=\\s*(?<currentValue>.?(?:\\d+\\.){0,2}\\d+)"
61+
]
62+
datasourceTemplate: "github-tags"
63+
depNameTemplate: "kubernetes-sigs/controller-tools"
64+
extractVersionTemplate: "^envtest.v(?<version>.*)$"
65+
- customType: "regex"
66+
description: "Bump kustomize version in the Makefile"
67+
fileMatch: [
68+
"^Makefile$"
69+
]
70+
matchStrings: [
71+
"KUSTOMIZE_VERSION\\s*\\?=\\s*(?<currentValue>.?(?:\\d+\\.){0,2}\\d+)"
72+
]
73+
datasourceTemplate: "github-tags"
74+
depNameTemplate: "kubernetes-sigs/kustomize"
75+
extractVersionTemplate: "^kustomize/v(?<version>.*)$"
76+
- customType: "regex"
77+
description: "Bump controller tools version in the Makefile"
78+
fileMatch: [
79+
"^Makefile$"
80+
]
81+
matchStrings: [
82+
"CONTROLLER_TOOLS_VERSION\\s*\\?=\\s*(?<currentValue>.?(?:\\d+\\.){0,2}\\d+)"
83+
]
84+
datasourceTemplate: "github-tags"
85+
depNameTemplate: "kubernetes-sigs/controller-tools"
86+
extractVersionTemplate: "^v(?<version>.*)$"
87+
packageRules:
88+
- matchPackageNames: [
89+
"github-actions"
90+
]
91+
groupName: "github actions"
92+
matchUpdateTypes: [
93+
"major",
94+
"minor",
95+
"patch"
96+
]
97+
minimumReleaseAge: "14 days"
98+
extends: [
99+
"helpers:pinGitHubActionDigests"
100+
]

0 commit comments

Comments
 (0)