-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (59 loc) · 2.04 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
# Set the shell to bash always
SHELL := /bin/bash
# Look for a .env file, and if present, set make variables from it.
ifneq (,$(wildcard ./.env))
include .env
export $(shell sed 's/=.*//' .env)
endif
KIND_CLUSTER_NAME ?= local-dev
KUBECONFIG ?= $(HOME)/.kube/config
VERSION := $(shell git describe --always --tags | sed 's/-/./2' | sed 's/-/./2')
ifndef VERSION
VERSION := 0.0.0
endif
# Tools
KIND=$(shell which kind)
LINT=$(shell which golangci-lint)
KUBECTL=$(shell which kubectl)
HELM=$(shell which helm)
.DEFAULT_GOAL := help
.PHONY: test
test: ## Run all the Go test
go test -v ./...
.PHONY: lint
lint: ## Check the Go coding conventions.
$(LINT) run
.PHONY: tidy
tidy: ## Ensure that all Go imports are satisfied.
go mod tidy
.PHONY: generate
generate: tidy ## Generate all CRDs.
go generate ./...
.PHONY: dev
dev: generate ## Run the controller in debug mode.
$(KUBECTL) apply -f crds/ -R
go run cmd/main.go -d
.PHONY: local-dev
local-dev: generate ## Run the controller in debug mode.
bash ./_deploy/create-certs-local.sh
$(KUBECTL) apply -f crds/ -R
$(KUBECTL) patch crd pipelinepermissions.azuredevops.krateo.io --patch-file ./_deploy/local/patch.yaml
go run cmd/main.go -d
.PHONY: kind-up
kind-up: ## Starts a KinD cluster for local development.
@$(KIND) get kubeconfig --name $(KIND_CLUSTER_NAME) >/dev/null 2>&1 || $(KIND) create cluster --name=$(KIND_CLUSTER_NAME)
.PHONY: kind-down
kind-down: ## Shuts down the KinD cluster.
@$(KIND) delete cluster --name=$(KIND_CLUSTER_NAME)
.PHONY: install
install: ## Install this provider using Helm
@$(HELM) repo add krateo https://charts.krateo.io
@$(HELM) repo update krateo
@$(HELM) install patch-provider krateo/patch-provider
.PHONY: demo
demo: ## Run the demo examples
@$(KUBECTL) create secret generic azuredevops-secret --from-literal=token=$(TOKEN) || true
@$(KUBECTL) apply -f samples/connector-config.yaml
.PHONY: help
help: ## Print this help.
@grep -E '^[a-zA-Z\._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'