Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (61 loc) · 1.59 KB
/
Copy pathMakefile
File metadata and controls
75 lines (61 loc) · 1.59 KB
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
.PHONY: build run test clean docker-build docker-run fmt vet lint
# Binary name
BINARY_NAME=alertmanager-alert-sync
# Build the application
build:
go build -o $(BINARY_NAME) ./cmd/alertmanager-alert-sync
# Run the application
run:
go run ./cmd/alertmanager-alert-sync/main.go
# Run tests
test:
go test -v ./...
# Run tests with coverage
test-coverage:
go test -cover ./...
# Clean build artifacts
clean:
go clean
rm -f $(BINARY_NAME)
# Build Docker image
docker-build:
docker build -t $(BINARY_NAME):latest .
# Run Docker container
docker-run:
docker run -p 8080:8080 \
-e ALERTMANAGER_HOST=${ALERTMANAGER_HOST} \
-e GRAFANA_IRM_URL=${GRAFANA_IRM_URL} \
-e GRAFANA_IRM_TOKEN=${GRAFANA_IRM_TOKEN} \
-e RECONCILE_INTERVAL=${RECONCILE_INTERVAL} \
$(BINARY_NAME):latest
# Format code
fmt:
go fmt ./...
# Run go vet
vet:
go vet ./...
# Run linter (requires golangci-lint)
lint:
golangci-lint run
# Install dependencies
deps:
go mod download
go mod tidy
# Run the application with hot reload (requires air)
dev:
air
# Help
help:
@echo "Available targets:"
@echo " build - Build the application"
@echo " run - Run the application"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage"
@echo " clean - Clean build artifacts"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker container"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " lint - Run linter"
@echo " deps - Install dependencies"
@echo " dev - Run with hot reload"