-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
658 lines (570 loc) Β· 29.5 KB
/
Makefile
File metadata and controls
658 lines (570 loc) Β· 29.5 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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# ================================================================================================
# Nexmonyx Repository Template - Makefile
# ================================================================================================
#
# This makefile provides a complete build, test, and deployment framework for Go/Kubernetes projects.
#
# CUSTOMIZATION REQUIRED:
# 1. Replace {{PROJECT_NAME}} with your project name
# 2. Replace {{REGISTRY}} with your container registry (e.g., ghcr.io/myorg, harbor.mycompany.com/myproject)
# 3. Replace {{HELM_REPO}} with your Helm chart repository URL
# 4. Update COMPONENTS list with your actual components
# 5. Customize KUBECONFIG paths for your environments
# 6. Adjust build targets for your project structure
#
# ================================================================================================
.PHONY: help all test build deploy \
build-local test-local validate-local validate-pipeline-local validate-quick \
deploy-dev deploy-stg deploy-prd \
bump bump-with-monitoring \
qa-check devils-advocate workflow-status \
gh-status gh-watch gh-logs gh-builds \
check-prerequisites check-docker check-kubectl \
build test test-integration test-e2e test-all \
lint fmt clean install-deps \
docker-build docker-push \
coverage-check
# ================================================================================================
# Project Configuration
# ================================================================================================
# Project Configuration
PROJECT_NAME := node-doctor
# Container registry (DockerHub for production releases)
REGISTRY := docker.io/supporttools
# Version and build information
VERSION := $(shell date +%s)
GIT_COMMIT := $(shell git rev-parse HEAD)
BUILD_TIME := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
GO_VERSION := 1.25
# RC Version - for release candidate builds
RC_VERSION_FILE := .version-rc
RC_VERSION := $(shell [ -f $(RC_VERSION_FILE) ] && cat $(RC_VERSION_FILE) || echo "v0.1.0-rc.1")
export VERSION
export GIT_COMMIT
export BUILD_TIME
export GO_VERSION
# ================================================================================================
# Environment Configuration
# ================================================================================================
# CUSTOMIZE: Update these paths for your kubeconfig locations
KUBECONFIG_DEV := $(HOME)/.kube/dev-cluster
KUBECONFIG_STG := $(HOME)/.kube/staging-cluster
KUBECONFIG_PRD := $(HOME)/.kube/config
# Kubernetes context for production deployment
KUBECTL_CONTEXT_PRD := a1-ops-prd
export KUBECONFIG_DEV
export KUBECONFIG_STG
export KUBECONFIG_PRD
# Kubernetes namespaces (node-doctor runs in kube-system typically)
NAMESPACE_DEV := kube-system
NAMESPACE_STG := kube-system
NAMESPACE_PRD := node-doctor
# Helm Chart settings
HELM_REPO_URL := https://charts.support.tools
CHART_VERSION := v$(shell git rev-list --count HEAD)
# ================================================================================================
# Component Configuration
# ================================================================================================
# Node Doctor is a single binary
COMPONENTS := node-doctor
# Docker image for node-doctor
DOCKER_IMAGE_node-doctor := $(REGISTRY)/$(PROJECT_NAME)
# ================================================================================================
# Color Output Functions
# ================================================================================================
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[1;33m
BLUE := \033[0;34m
NC := \033[0m
define print_status
printf '\033[0;34m[%s]\033[0m %s\n' "$$(date +'%Y-%m-%d %H:%M:%S')" $(1)
endef
define print_success
printf '\033[0;32m[SUCCESS]\033[0m %s\n' $(1)
endef
define print_error
printf '\033[0;31m[ERROR]\033[0m %s\n' $(1)
endef
define print_warning
printf '\033[1;33m[WARNING]\033[0m %s\n' $(1)
endef
# ================================================================================================
# Prerequisites Checking
# ================================================================================================
check-docker:
@$(call print_status,"Checking Docker prerequisites...")
@command -v docker >/dev/null 2>&1 || ($(call print_error,"docker not found") && exit 1)
@$(call print_success,"Docker check passed")
check-kubectl:
@$(call print_status,"Checking kubectl prerequisite...")
@command -v kubectl >/dev/null 2>&1 || ($(call print_error,"kubectl not found") && exit 1)
@$(call print_success,"kubectl check passed")
check-prerequisites:
@$(call print_status,"Checking prerequisites...")
@command -v docker >/dev/null 2>&1 || ($(call print_error,"docker not found") && exit 1)
@command -v kubectl >/dev/null 2>&1 || ($(call print_error,"kubectl not found") && exit 1)
@command -v helm >/dev/null 2>&1 || ($(call print_error,"helm not found") && exit 1)
@command -v git >/dev/null 2>&1 || ($(call print_error,"git not found") && exit 1)
@command -v go >/dev/null 2>&1 || ($(call print_error,"go not found") && exit 1)
@$(call print_success,"Prerequisites check passed")
check-go-version:
@$(call print_status,"Checking Go version...")
@./scripts/validate-go-version.sh
@$(call print_success,"Go version check passed")
check-kubeconfig-%:
@$(call print_status,"Checking kubeconfig for $*...")
@ENV_UPPER=$$(echo $* | tr '[:lower:]' '[:upper:]') && \
KUBECONFIG_VAR=KUBECONFIG_$$ENV_UPPER && \
eval KUBECONFIG_PATH=\$$$$KUBECONFIG_VAR && \
if [ ! -f "$$KUBECONFIG_PATH" ]; then \
$(call print_error,"Kubeconfig not found for $*: $$KUBECONFIG_PATH"); \
exit 1; \
fi
@$(call print_success,"Kubeconfig validated for $*")
# ================================================================================================
# Build Targets
# ================================================================================================
# Build all components locally
build-all-local: check-prerequisites check-go-version
@$(call print_status,"Building all components locally...")
@for component in $(COMPONENTS); do \
$(call print_status,"Building $$component..."); \
$(MAKE) build-$$component-local || exit 1; \
done
@$(call print_success,"All components built successfully")
# Build node-doctor binary
build-node-doctor-local:
@$(call print_status,"Building node-doctor locally...")
@mkdir -p bin
@cd cmd/node-doctor && go build -ldflags="-X main.Version=$(VERSION) -X main.GitCommit=$(GIT_COMMIT) -X main.BuildTime=$(BUILD_TIME)" -o ../../bin/node-doctor
@$(call print_success,"node-doctor built: bin/node-doctor")
build-local: build-all-local
# ================================================================================================
# Test Targets
# ================================================================================================
# Run all tests locally
test-all-local: check-prerequisites check-go-version
@$(call print_status,"Running all tests locally...")
@go test ./... -v -cover -coverprofile=coverage.txt
@$(call print_success,"All tests passed")
test-local: test-all-local
# Component-specific test target
test-node-doctor-local:
@$(call print_status,"Running node-doctor tests...")
@go test ./... -v -cover
@$(call print_success,"node-doctor tests passed")
# ================================================================================================
# Standard Build and Test Targets (Task #3137)
# ================================================================================================
# Standard build target - compile binary
build: build-local
# Standard test target - unit tests only
test:
@$(call print_status,"Running unit tests...")
@go test ./pkg/... ./cmd/... -v -cover -short
@$(call print_success,"Unit tests passed")
# Integration tests
test-integration:
@$(call print_status,"Running integration tests...")
@if [ -d "test/integration" ]; then \
go test ./test/integration/... -v -cover; \
else \
$(call print_warning,"Integration tests not yet implemented (test/integration/ does not exist)"); \
fi
@$(call print_success,"Integration tests completed")
# End-to-end tests
test-e2e:
@$(call print_status,"Running E2E tests...")
@if [ -d "test/e2e" ]; then \
go test ./test/e2e/... -v -timeout 10m; \
else \
$(call print_warning,"E2E tests not yet implemented (test/e2e/ does not exist)"); \
fi
@$(call print_success,"E2E tests completed")
# Run all tests with coverage
test-all:
@$(call print_status,"Running all tests with coverage...")
@mkdir -p coverage
@go test ./... -v -cover -covermode=atomic -coverprofile=coverage/coverage.out
@go tool cover -html=coverage/coverage.out -o coverage/coverage.html
@go tool cover -func=coverage/coverage.out | grep total | awk '{print "Total coverage: " $$3}'
@$(call print_success,"All tests passed - coverage report: coverage/coverage.html")
# Check coverage meets minimum threshold (80%)
COVERAGE_THRESHOLD := 80
coverage-check:
@$(call print_status,"Checking coverage threshold (minimum $(COVERAGE_THRESHOLD)%)...")
@mkdir -p coverage
@go test ./... -covermode=atomic -coverprofile=coverage/coverage.out -short > /dev/null 2>&1
@COVERAGE=$$(go tool cover -func=coverage/coverage.out | grep total | awk '{print $$3}' | sed 's/%//'); \
echo "Current coverage: $${COVERAGE}%"; \
if [ $$(echo "$${COVERAGE} < $(COVERAGE_THRESHOLD)" | bc -l) -eq 1 ]; then \
$(call print_error,"Coverage $${COVERAGE}% is below minimum threshold of $(COVERAGE_THRESHOLD)%"); \
exit 1; \
fi
@$(call print_success,"Coverage check passed (>= $(COVERAGE_THRESHOLD)%)")
# Lint code with golangci-lint
lint:
@$(call print_status,"Running golangci-lint...")
@command -v golangci-lint >/dev/null 2>&1 || ($(call print_error,"golangci-lint not found - run 'make install-deps'") && exit 1)
@golangci-lint run ./...
@$(call print_success,"Linting passed")
# Format code with gofmt and goimports
fmt:
@$(call print_status,"Formatting Go code...")
@command -v goimports >/dev/null 2>&1 || ($(call print_error,"goimports not found - run 'make install-deps'") && exit 1)
@gofmt -s -w .
@goimports -w .
@$(call print_success,"Code formatted")
# Clean build artifacts
clean:
@$(call print_status,"Cleaning build artifacts...")
@rm -rf bin/
@rm -rf coverage/
@rm -f coverage.txt coverage.out
@go clean -cache -testcache -modcache -fuzzcache
@$(call print_success,"Build artifacts cleaned")
# Install development dependencies
install-deps:
@$(call print_status,"Installing development dependencies...")
@command -v golangci-lint >/dev/null 2>&1 || \
($(call print_status,"Installing golangci-lint...") && \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
@command -v goimports >/dev/null 2>&1 || \
($(call print_status,"Installing goimports...") && \
go install golang.org/x/tools/cmd/goimports@latest)
@$(call print_status,"Downloading Go module dependencies...")
@go mod download
@go mod tidy
@$(call print_success,"Dependencies installed")
# Docker build shorthand
docker-build: build-all-images
# Docker push shorthand
docker-push: push-all-images
# ================================================================================================
# Validation Targets (mirrors CI/CD pipeline)
# ================================================================================================
validate-pipeline-local: check-prerequisites check-go-version
@$(call print_status,"Running full pipeline validation (mirrors CI/CD)...")
@./scripts/validate-pipeline-local.sh
@$(call print_success,"Pipeline validation passed")
validate-quick: check-prerequisites check-go-version
@$(call print_status,"Running quick validation (format, vet, staticcheck)...")
@./scripts/validate-pipeline-local.sh --quick
@$(call print_success,"Quick validation passed")
validate-component:
@$(call print_status,"Validating component: $(COMPONENT)...")
@./scripts/validate-pipeline-local.sh --component $(COMPONENT)
@$(call print_success,"Component validation passed")
validate-local: validate-pipeline-local
# ================================================================================================
# Docker Image Build Targets
# ================================================================================================
# Build Docker image for node-doctor
build-node-doctor-image: check-docker
@$(call print_status,"Building node-doctor Docker image...")
@docker build -f Dockerfile -t $(DOCKER_IMAGE_node-doctor):$(VERSION) .
@docker tag $(DOCKER_IMAGE_node-doctor):$(VERSION) $(DOCKER_IMAGE_node-doctor):latest
@$(call print_success,"node-doctor image built: $(DOCKER_IMAGE_node-doctor):$(VERSION)")
# Build all images (just node-doctor)
build-all-images: build-node-doctor-image
@$(call print_success,"Docker image built successfully")
# Push node-doctor image to registry
push-node-doctor-image:
@$(call print_status,"Pushing node-doctor image to registry...")
@docker push $(DOCKER_IMAGE_node-doctor):$(VERSION)
@docker push $(DOCKER_IMAGE_node-doctor):latest
@$(call print_success,"node-doctor image pushed")
push-all-images: push-node-doctor-image
@$(call print_success,"Image pushed to registry")
# ================================================================================================
# Helm Chart Targets
# ================================================================================================
helm-lint:
@$(call print_status,"Linting Helm chart...")
@helm lint ./helm/$(PROJECT_NAME)
@$(call print_success,"Helm lint passed")
helm-package:
@$(call print_status,"Packaging Helm chart...")
@helm package ./helm/$(PROJECT_NAME) --version $(CHART_VERSION)
@$(call print_success,"Helm chart packaged")
helm-publish: helm-package
@$(call print_status,"Publishing Helm chart to repository...")
@# CUSTOMIZE: Add your Helm chart publish command
@$(call print_success,"Helm chart published")
# ================================================================================================
# Deployment Targets
# ================================================================================================
deploy-dev: check-kubeconfig-dev
@$(call print_status,"Deploying to development environment...")
@KUBECONFIG=$(KUBECONFIG_DEV) helm upgrade --install $(PROJECT_NAME) ./helm/$(PROJECT_NAME) \
--namespace $(NAMESPACE_DEV) \
--set image.tag=$(VERSION) \
--set environment=dev \
--wait
@$(call print_success,"Deployed to development")
deploy-stg: check-kubeconfig-stg
@$(call print_status,"Deploying to staging environment...")
@KUBECONFIG=$(KUBECONFIG_STG) helm upgrade --install $(PROJECT_NAME) ./helm/$(PROJECT_NAME) \
--namespace $(NAMESPACE_STG) \
--set image.tag=$(VERSION) \
--set environment=staging \
--wait
@$(call print_success,"Deployed to staging")
deploy-prd: check-kubeconfig-prd
@echo "β οΈ CRITICAL DECISION: Deploy to Production"
@echo "ββββββββββββββββββββββββββββββββββββββββ"
@echo "What: Deploy $(PROJECT_NAME) version $(VERSION) to production"
@echo "Why: Approved for production deployment"
@echo "Risk: May impact production users"
@echo ""
@read -p "Do you approve? (y/n): " approve; \
if [ "$$approve" != "y" ] && [ "$$approve" != "Y" ]; then \
$(call print_error,"Production deployment cancelled"); \
exit 1; \
fi
@$(call print_status,"Deploying to production environment...")
@KUBECONFIG=$(KUBECONFIG_PRD) helm upgrade --install $(PROJECT_NAME) ./helm/$(PROJECT_NAME) \
--namespace $(NAMESPACE_PRD) \
--set image.tag=$(VERSION) \
--set environment=production \
--wait
@$(call print_success,"Deployed to production")
# ================================================================================================
# Version Bump and Deployment Workflow
# ================================================================================================
bump: validate-pipeline-local
@$(call print_status,"Creating new version bump...")
@$(call print_status,"Current VERSION: $(VERSION)")
@git add . && git commit -m "bump: automated version bump to $(VERSION) [skip ci]" || true
@git push origin $$(git rev-parse --abbrev-ref HEAD)
@$(call print_success,"Version bumped and pushed - CI/CD will handle deployment")
bump-with-monitoring: bump
@$(call print_status,"Monitoring GitHub Actions workflow...")
@$(MAKE) gh-watch
# Increment RC version (e.g., v0.1.0-rc.1 -> v0.1.0-rc.2)
increment-rc-version:
@$(call print_status,"Incrementing RC version...")
@CURRENT_RC=$$(cat $(RC_VERSION_FILE)); \
BASE_VERSION=$$(echo $$CURRENT_RC | sed 's/-rc\.[0-9]*$$//'); \
RC_NUM=$$(echo $$CURRENT_RC | sed 's/.*-rc\.//'); \
NEW_RC_NUM=$$((RC_NUM + 1)); \
NEW_RC_VERSION="$$BASE_VERSION-rc.$$NEW_RC_NUM"; \
echo $$NEW_RC_VERSION > $(RC_VERSION_FILE); \
echo "$(GREEN)β
RC version updated: $$CURRENT_RC -> $$NEW_RC_VERSION$(NC)"
# Deploy to production cluster using kubectl
deploy-prd-kubectl: check-kubectl
@$(call print_status,Deploying to production cluster $(KUBECTL_CONTEXT_PRD)...)
@$(call print_status,Checking namespace $(NAMESPACE_PRD)...)
@KUBECONFIG=$(KUBECONFIG_PRD) kubectl config use-context $(KUBECTL_CONTEXT_PRD)
@KUBECONFIG=$(KUBECONFIG_PRD) kubectl get namespace $(NAMESPACE_PRD) > /dev/null 2>&1 || \
(echo "Creating namespace $(NAMESPACE_PRD)..." && \
KUBECONFIG=$(KUBECONFIG_PRD) kubectl create namespace $(NAMESPACE_PRD))
@$(call print_status,Applying RBAC resources...)
@KUBECONFIG=$(KUBECONFIG_PRD) kubectl apply -f deployment/rbac.yaml -n $(NAMESPACE_PRD)
@$(call print_status,Applying DaemonSet...)
@KUBECONFIG=$(KUBECONFIG_PRD) kubectl apply -f deployment/daemonset.yaml -n $(NAMESPACE_PRD)
@$(call print_status,Waiting for rollout to complete...)
@KUBECONFIG=$(KUBECONFIG_PRD) kubectl rollout status daemonset/node-doctor -n $(NAMESPACE_PRD) --timeout=5m
@$(call print_success,Deployed to production cluster $(KUBECTL_CONTEXT_PRD))
# Build and push RC release to Harbor and deploy to a1-ops-prd cluster
bump-rc: validate-pipeline-local increment-rc-version
@$(call print_status,Building RC release: $(RC_VERSION))
@$(call print_status,Registry: $(REGISTRY)/$(PROJECT_NAME))
@$(call print_status,Cluster: $(KUBECTL_CONTEXT_PRD) Namespace: $(NAMESPACE_PRD))
@echo ""
@$(call print_status,Building multi-arch Docker image for amd64 and arm64...)
@docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg VERSION=$(RC_VERSION) \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg BUILD_TIME=$(BUILD_TIME) \
-t $(REGISTRY)/$(PROJECT_NAME):$(RC_VERSION) \
-t $(REGISTRY)/$(PROJECT_NAME):latest \
-f Dockerfile \
--push \
.
@$(call print_success,Multi-arch image built and pushed: $(REGISTRY)/$(PROJECT_NAME):$(RC_VERSION))
@echo ""
@$(call print_status,Updating DaemonSet image tag...)
@sed -i.bak 's|image: .*node-doctor:.*|image: $(REGISTRY)/$(PROJECT_NAME):$(RC_VERSION)|' deployment/daemonset.yaml
@rm -f deployment/daemonset.yaml.bak
@echo ""
@$(MAKE) deploy-prd-kubectl
@echo ""
@$(call print_status,Committing RC release...)
@git add $(RC_VERSION_FILE) deployment/daemonset.yaml
@git commit -m "bump-rc: Release candidate $(RC_VERSION) deployed to $(KUBECTL_CONTEXT_PRD)" || true
@git tag -a $(RC_VERSION) -m "Release candidate $(RC_VERSION)" || true
@git push origin main --tags || true
@echo ""
@echo "π RC Release $(RC_VERSION) complete!"
@echo " - Built and pushed to Harbor"
@echo " - Deployed to $(KUBECTL_CONTEXT_PRD) cluster"
@echo " - Tagged as $(RC_VERSION)"
@echo ""
@echo "Next steps:"
@echo " - Verify deployment: kubectl --context=$(KUBECTL_CONTEXT_PRD) -n $(NAMESPACE_PRD) get pods -l app=node-doctor"
@echo " - Check logs: kubectl --context=$(KUBECTL_CONTEXT_PRD) -n $(NAMESPACE_PRD) logs -l app=node-doctor"
@echo " - Monitor health: kubectl --context=$(KUBECTL_CONTEXT_PRD) -n $(NAMESPACE_PRD) get pods -l app=node-doctor -w"
# ================================================================================================
# Quality Workflow Targets
# ================================================================================================
workflow-status:
@$(call print_status,"Checking workflow status...")
@echo "TODO: Check TaskForge or project management system"
qa-check:
@$(call print_status,"Running QA validation...")
@echo "QA Check: Running validation suite"
@$(MAKE) validate-pipeline-local
@$(MAKE) test-local
@$(call print_success,"QA validation passed")
devils-advocate:
@$(call print_status,"Running Devils Advocate validation...")
@echo "Devils Advocate: Challenging implementation..."
@echo "- Testing edge cases"
@echo "- Verifying error handling"
@echo "- Checking security implications"
@$(call print_success,"Devils Advocate review complete")
# ================================================================================================
# GitHub Actions Monitoring
# ================================================================================================
gh-status:
@$(call print_status,"Checking GitHub Actions status...")
@gh run list --limit 5
gh-watch:
@$(call print_status,"Watching GitHub Actions workflow...")
@gh run watch
gh-logs:
@$(call print_status,"Fetching GitHub Actions logs...")
@gh run view --log
gh-builds:
@$(call print_status,"Showing recent builds...")
@gh run list --workflow=pipeline-v2.yml --limit 10
# ================================================================================================
# Help System
# ================================================================================================
help:
@echo "$(PROJECT_NAME) Makefile - Repository Template"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "QUICK START"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make install-deps Install development dependencies"
@echo " make build Compile node-doctor binary"
@echo " make test Run unit tests"
@echo " make test-all Run all tests with coverage"
@echo " make lint Run linter (golangci-lint)"
@echo " make fmt Format code (gofmt + goimports)"
@echo " make clean Clean build artifacts"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "BUILD COMMANDS"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make build Compile binary (shorthand for build-local)"
@echo " make build-local Build node-doctor binary"
@echo " make docker-build Build Docker image"
@echo " make docker-push Push Docker image to registry"
@echo " make clean Remove build artifacts and caches"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "TEST COMMANDS"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make test Run unit tests (fast)"
@echo " make test-integration Run integration tests"
@echo " make test-e2e Run end-to-end tests"
@echo " make test-all Run all tests with coverage report"
@echo " make coverage-check Verify coverage >= 80% threshold"
@echo " make lint Run golangci-lint"
@echo " make fmt Format code with gofmt and goimports"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "DEVELOPMENT COMMANDS"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make install-deps Install golangci-lint, goimports, etc."
@echo " make validate-quick Quick validation (format, vet, staticcheck)"
@echo " make validate-pipeline-local Full validation (mirrors CI/CD)"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "VALIDATION COMMANDS (Pre-push)"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make validate-pipeline-local Full validation (mirrors CI/CD exactly)"
@echo " make validate-quick Quick validation (format, vet, staticcheck)"
@echo " make validate-component COMPONENT=api Validate specific component"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "DEPLOYMENT COMMANDS"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make bump Bump version and trigger CI/CD"
@echo " make bump-rc Build RC, push to Harbor, deploy to a1-ops-prd"
@echo " make bump-with-monitoring Bump and watch deployment"
@echo " make deploy-dev Deploy to development"
@echo " make deploy-stg Deploy to staging"
@echo " make deploy-prd Deploy to production (requires approval)"
@echo " make deploy-prd-kubectl Deploy to a1-ops-prd using kubectl"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "QUALITY WORKFLOW COMMANDS"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make qa-check Run QA validation"
@echo " make devils-advocate Run adversarial testing"
@echo " make workflow-status Check workflow status"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "GITHUB ACTIONS MONITORING"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make gh-status Show recent GitHub Actions runs"
@echo " make gh-watch Watch current workflow execution"
@echo " make gh-logs View workflow logs"
@echo " make gh-builds Show recent builds"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "HELM COMMANDS"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make helm-lint Lint Helm chart"
@echo " make helm-package Package Helm chart"
@echo " make helm-publish Publish Helm chart to repository"
@echo ""
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "UTILITY COMMANDS"
@echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make check-prerequisites Check all required tools installed"
@echo " make check-go-version Verify Go version matches requirements"
@echo " make check-kubeconfig-dev Verify development kubeconfig"
@echo " make help Show this help message"
@echo ""
@echo "For more information, see docs/development/"
workflow-help:
@echo "Quality Workflow Commands"
@echo ""
@echo " make workflow-status - Show current workflow status"
@echo " make qa-check - Run QA validation gate"
@echo " make devils-advocate - Run adversarial testing gate"
@echo " make workflow-validate - Full workflow validation"
@echo ""
@echo "See docs/development/task-execution-workflow.md for complete workflow documentation"
gh-help:
@echo "GitHub Actions Monitoring Commands"
@echo ""
@echo " make gh-status - Show recent workflow runs"
@echo " make gh-watch - Watch current workflow (follows logs)"
@echo " make gh-logs - Show logs from latest run"
@echo " make gh-builds - Show recent pipeline builds"
@echo ""
@echo "Requires 'gh' CLI: https://cli.github.com/"
# Default target
all: test-local build-local validate-pipeline-local
@$(call print_success,"All targets completed successfully")
# ================================================================================================
# End of Makefile
# ================================================================================================