Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(makefilemaker) add makefilemaker #25

Merged
merged 3 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
* @abhijith-darshan @kengou
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:experimental
# Build the manager binary
FROM golang:1.23 as builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 as builder

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

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
FROM --platform=${BUILDPLATFORM:-linux/amd64} gcr.io/distroless/static:nonroot
LABEL source_repository="https://github.com/sapcc/disco"
LABEL org.opencontainers.image.source="https://github.com/sapcc/disco"
WORKDIR /
Expand Down
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ IMG ?= ${IMG_REPO}:${IMG_TAG}

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.28
## Tool Versions
KUSTOMIZE_VERSION ?= 5.4.1
CONTROLLER_TOOLS_VERSION ?= 0.14.0

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

OS := $(shell go env GOOS)

.PHONY: all
all: build
.PHONY: build-all
build-all: build

##@ General

Expand Down Expand Up @@ -135,10 +138,6 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.1
CONTROLLER_TOOLS_VERSION ?= v0.14.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand All @@ -148,9 +147,16 @@ $(KUSTOMIZE): $(LOCALBIN)
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@v$(CONTROLLER_TOOLS_VERSION)

.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

install-go-licence-detector: FORCE
@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

check-dependency-licenses: FORCE install-go-licence-detector
@printf "\e[1;36m>> go-licence-detector\e[0m\n"
@go list -m -mod=readonly -json all | go-licence-detector -includeIndirect -rules .license-scan-rules.json -overrides .license-scan-overrides.jsonl
100 changes: 100 additions & 0 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Configuration file for <https://github.com/sapcc/go-makefile-maker>

metadata:
url: https://github.com/sapcc/disco

binaries:
- name: disco
fromPackage: ./
installTo: bin/

dockerfile:
enabled: false

golang:
setGoModVersion: false

golangciLint:
createConfig: true

goReleaser:
createConfig: true
binaryName: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format: .tar.gz
nameTemplate: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"

githubWorkflow:
ci:
enabled: true
coveralls: false
pushContainerToGhcr:
enabled: true
platforms: "linux/amd64,linux/arm64"
tagStrategy:
- edge
- latest
- semver
- sha
securityChecks:
enabled: true
license:
enabled: false
release:
enabled: true

makefile:
enabled: false

renovate:
enabled: true
assignees:
- kengou
- abhijith-darshan
customManagers:
- customType: "regex"
description: "Bump envtest version in the Makefile"
fileMatch: [
"^Makefile$"
]
matchStrings: [
"ENVTEST_K8S_VERSION\\s*\\?=\\s*(?<currentValue>.?(?:\\d+\\.){0,2}\\d+)"
]
datasourceTemplate: "github-tags"
depNameTemplate: "kubernetes-sigs/controller-tools"
extractVersionTemplate: "^envtest.v(?<version>.*)$"
- customType: "regex"
description: "Bump kustomize version in the Makefile"
fileMatch: [
"^Makefile$"
]
matchStrings: [
"KUSTOMIZE_VERSION\\s*\\?=\\s*(?<currentValue>.?(?:\\d+\\.){0,2}\\d+)"
]
datasourceTemplate: "github-tags"
depNameTemplate: "kubernetes-sigs/kustomize"
extractVersionTemplate: "^kustomize/v(?<version>.*)$"
- customType: "regex"
description: "Bump controller tools version in the Makefile"
fileMatch: [
"^Makefile$"
]
matchStrings: [
"CONTROLLER_TOOLS_VERSION\\s*\\?=\\s*(?<currentValue>.?(?:\\d+\\.){0,2}\\d+)"
]
datasourceTemplate: "github-tags"
depNameTemplate: "kubernetes-sigs/controller-tools"
extractVersionTemplate: "^v(?<version>.*)$"
packageRules:
- matchPackageNames: [
"github-actions"
]
groupName: "github actions"
matchUpdateTypes: [
"major",
"minor",
"patch"
]
minimumReleaseAge: "14 days"
extends: [
"helpers:pinGitHubActionDigests"
]