-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
88 lines (77 loc) · 3.02 KB
/
Taskfile.yml
File metadata and controls
88 lines (77 loc) · 3.02 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
version: '3'
tasks:
go:build:
desc: Build the manager binary
cmds:
- go build -o bin/manager cmd/main.go
go:test:
desc: Run unit tests with coverage
cmds:
- go test -v -coverprofile=coverage.out ./pkg/... ./internal/config/...
- go tool cover -func=coverage.out
go:test:controller:
desc: Run controller tests individually to avoid metrics conflicts
cmds:
- go test -v ./internal/controller/...
go:test:all:
desc: Run all tests including controller tests individually
cmds:
- task: go:test
- task: go:test:controller
go:fmt:
desc: Format and vet Go code
cmds:
- go fmt ./...
- go vet ./...
go:manifests:
desc: Generate CRD manifests
cmds:
- export PATH=$PATH:$(go env GOPATH)/bin
- controller-gen crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
docker:build:
desc: Build Docker image
cmds:
- docker build -t secret-santa:latest .
docker:push:
desc: Build and push Docker image
cmds:
- docker build -t logiciq/secret-santa:latest .
- docker push logiciq/secret-santa:latest
e2e:setup:
desc: Create cluster, deploy operator and install Vault (no tests)
cmds:
- go install sigs.k8s.io/kind@latest
- go install sigs.k8s.io/controller-tools/cmd/controller-gen@latest
- kind create cluster --config=e2e/k8s/kind-config.yaml --name=secret-santa-e2e || kind get clusters | grep -q secret-santa-e2e
- kubectl config use-context kind-secret-santa-e2e
- task: go:manifests
- kubectl delete deployment secret-santa-controller -n secret-santa-system --ignore-not-found=true
- task: docker:build
- kind load docker-image secret-santa:latest --name=secret-santa-e2e
- kubectl create namespace secret-santa-system --dry-run=client -o yaml | kubectl apply -f -
- kubectl apply -f config/crd/bases/
- kubectl apply -f config/rbac/
- kubectl apply -f config/manager/
- kubectl wait --for=condition=available --timeout=180s deployment/secret-santa-controller -n secret-santa-system
- helm repo add hashicorp https://helm.releases.hashicorp.com --force-update
- helm repo update
- |
helm upgrade --install vault hashicorp/vault \
--namespace vault --create-namespace \
--set server.dev.enabled=true \
--set server.dev.devRootToken=root \
--set injector.enabled=false \
--wait --timeout 120s
- kubectl wait pod -n vault -l app.kubernetes.io/name=vault --for=condition=Ready --timeout=60s
- kubectl exec -n vault vault-0 -- env VAULT_TOKEN=root vault secrets enable -path=secret kv-v2 || true
e2e:run:
desc: Run complete e2e test suite
deps:
- e2e:setup
cmds:
- cd e2e/k8s && go mod tidy && go test -v ./... -tags=e2e
e2e:cleanup:
desc: Cleanup e2e environment
# amazonq-ignore-next-line
cmds:
- kind delete cluster --name=secret-santa-e2e || echo "Failed to delete cluster"