-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
118 lines (102 loc) · 4.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Run go fmt against code
fmt: golangci-lint
$(LOCALBIN)/golangci-lint run --fix
# Run go mod tidy
tidy:
go mod tidy
# Run tests
test: mocks tidy fmt helm-lint test-cover
# Run coverage tests
test-cover: ginkgo
$(GINKGO) --cover ./...
release: goreleaser semver
@version=$$($(SEMVER)); \
git tag -s $$version -m"Release $$version"
$(GORELEASER) --clean
test-release: goreleaser
$(GORELEASER) --skip=publish --snapshot --clean
mocks: mockgen
$(MOCKGEN) -destination pkg/mocks/core/mock.go --package core k8s.io/client-go/kubernetes/typed/core/v1 CoreV1Interface,SecretInterface
$(MOCKGEN) -destination pkg/mocks/ssclient/mock.go --package ssclient github.com/bitnami-labs/sealed-secrets/pkg/client/clientset/versioned/typed/sealedsecrets/v1alpha1 BitnamiV1alpha1Interface,SealedSecretInterface
$(MOCKGEN) -destination pkg/mocks/seal/mock.go --package seal github.com/bakito/sealed-secrets-web/pkg/seal Sealer
## toolbox - start
## Current working directory
LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || pwd)
## Location to install dependencies to
LOCALBIN ?= $(LOCALDIR)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
## Tool Binaries
GINKGO ?= $(LOCALBIN)/ginkgo
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
GORELEASER ?= $(LOCALBIN)/goreleaser
HELM_DOCS ?= $(LOCALBIN)/helm-docs
MOCKGEN ?= $(LOCALBIN)/mockgen
SEMVER ?= $(LOCALBIN)/semver
## Tool Versions
GINKGO_VERSION ?= v2.20.0
GOLANGCI_LINT_VERSION ?= v1.60.1
GORELEASER_VERSION ?= v2.2.0
HELM_DOCS_VERSION ?= v1.14.2
MOCKGEN_VERSION ?= v0.4.0
SEMVER_VERSION ?= v1.1.3
## Tool Installer
.PHONY: ginkgo
ginkgo: $(GINKGO) ## Download ginkgo locally if necessary.
$(GINKGO): $(LOCALBIN)
test -s $(LOCALBIN)/ginkgo || GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION)
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
.PHONY: goreleaser
goreleaser: $(GORELEASER) ## Download goreleaser locally if necessary.
$(GORELEASER): $(LOCALBIN)
test -s $(LOCALBIN)/goreleaser || GOBIN=$(LOCALBIN) go install github.com/goreleaser/goreleaser/v2@$(GORELEASER_VERSION)
.PHONY: helm-docs
helm-docs: $(HELM_DOCS) ## Download helm-docs locally if necessary.
$(HELM_DOCS): $(LOCALBIN)
test -s $(LOCALBIN)/helm-docs || GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@$(HELM_DOCS_VERSION)
.PHONY: mockgen
mockgen: $(MOCKGEN) ## Download mockgen locally if necessary.
$(MOCKGEN): $(LOCALBIN)
test -s $(LOCALBIN)/mockgen || GOBIN=$(LOCALBIN) go install go.uber.org/mock/mockgen@$(MOCKGEN_VERSION)
.PHONY: semver
semver: $(SEMVER) ## Download semver locally if necessary.
$(SEMVER): $(LOCALBIN)
test -s $(LOCALBIN)/semver || GOBIN=$(LOCALBIN) go install github.com/bakito/semver@$(SEMVER_VERSION)
## Update Tools
.PHONY: update-toolbox-tools
update-toolbox-tools:
@rm -f \
$(LOCALBIN)/ginkgo \
$(LOCALBIN)/golangci-lint \
$(LOCALBIN)/goreleaser \
$(LOCALBIN)/helm-docs \
$(LOCALBIN)/mockgen \
$(LOCALBIN)/semver
toolbox makefile -f $(LOCALDIR)/Makefile \
github.com/onsi/ginkgo/v2/ginkgo \
github.com/golangci/golangci-lint/cmd/golangci-lint \
github.com/goreleaser/goreleaser/v2 \
github.com/norwoodj/helm-docs/cmd/helm-docs \
go.uber.org/mock/[email protected]/uber-go/mock \
github.com/bakito/semver
## toolbox - end
build:
podman build --build-arg VERSION=dev --build-arg BUILD=dev --build-arg TARGETPLATFORM=linux/amd64 -t sealed-secrets-web .
build-arm:
podman build --build-arg VERSION=dev --build-arg BUILD=dev --build-arg TARGETPLATFORM=linux/arm64 -t sealed-secrets-web .
docs: helm-docs update-chart-version
@$(LOCALBIN)/helm-docs
update-chart-version: semver
@version=$$($(LOCALBIN)/semver -next); \
versionNum=$$($(LOCALBIN)/semver -next -numeric); \
sed -i "s/^version:.*$$/version: $${versionNum}/" ./chart/Chart.yaml; \
sed -i "s/^appVersion:.*$$/appVersion: $${version}/" ./chart/Chart.yaml
helm-lint: docs
helm lint ./chart
helm-template:
helm template ./chart -n sealed-secrets-web
@echo "#######################"
helm template ./chart -n sealed-secrets-web --set disableLoadSecrets=true --set sealedSecrets.serviceName=