-
Notifications
You must be signed in to change notification settings - Fork 1
/
Taskfile.yml
91 lines (89 loc) · 2.81 KB
/
Taskfile.yml
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
version: '3'
vars:
LOCALBIN:
sh: echo "$(pwd)/bin"
ENVTEST: setup-envtest
ENVTEST_VERSION: release-0.19
ENVTEST_K8S_VERSION: 1.31.0
tasks:
fmt:
desc: "Runs `go fmt` on the source"
cmds:
- go fmt ./...
vet:
desc: "Runs `go vet` on the source"
cmds:
- go vet ./...
localbin:
internal: true
cmds:
- mkdir -p {{.LOCALBIN}}
envtest:
internal: true
deps: [localbin]
cmds:
- ./hack/download-go-tool.sh {{.LOCALBIN}} {{.ENVTEST}} sigs.k8s.io/controller-runtime/tools/setup-envtest {{.ENVTEST_VERSION}}
test:
desc: "Performs all the unit tests"
deps: [envtest]
env:
CGO_ENABLED: 1
GOEXPERIMENT: nocoverageredesign
cmds:
- KUBEBUILDER_ASSETS="$({{.LOCALBIN}}/{{.ENVTEST}} use {{.ENVTEST_K8S_VERSION}} --bin-dir {{.LOCALBIN}} -p path)" go test -race ./... -coverprofile cover.out
build:
desc: "Builds the capargo binary executable"
deps: [fmt, vet]
vars:
BUILDTIME: '{{default "now" .BUILDTIME}}'
REVISION: '{{default "local" .REVISION}}'
VERSION: '{{default "dev" .VERSION}}'
cmds:
- |
CGO_ENABLED=0 go build \
-ldflags="-s \
-X github.com/superorbital/capargo/cmd.Version={{.VERSION}} \
-X github.com/superorbital/capargo/cmd.BuildTime={{.BUILDTIME}} \
-X github.com/superorbital/capargo/cmd.Revision={{.REVISION}}" \
-o bin/capargo main.go
build-image:
desc: "Builds the capargo image"
vars:
BUILDTIME:
sh: date -u +'%Y-%m-%dT%H:%M:%SZ'
REVISION:
sh: git rev-parse --short HEAD
REGISTRY: '{{default "localhost:5001/superorbital" .REGISTRY}}'
VERSION: '{{default "local" .VERSION}}'
cmds:
- |
docker buildx build \
--tag {{.REGISTRY}}/capargo:{{.VERSION}} \
--load . \
--build-arg="VERSION={{.VERSION}}" \
--build-arg="BUILDTIME={{.BUILDTIME}}" \
--build-arg="REVISION={{.REVISION}}"
# install:
create-cluster:
desc: "Creates a Kind cluster with a local registry and ArgoCD + Cluster API installed for testing"
cmds:
- ./hack/create-cluster.sh test-capargo
- ./hack/install-argocd.sh test-capargo
- ./hack/install-capv.sh test-capargo
cleanup-cluster:
desc: "Deletes the Kind cluster and the local registry"
cmds:
- ./hack/cleanup-cluster.sh test-capargo
get-kubeconfig:
desc: "Retrieves the test cluster kubeconfig and saves it as \"test-capargo-cluster.kubeconfig\""
cmds:
- ./hack/get-kubeconfig.sh test-capargo
demo-install:
desc: "Installs the demo of capargo with a CAPV cluster on the Kind cluster"
deps: [localbin]
cmds:
- ./hack/install-demo.sh test-capargo
demo-uninstall:
desc: "Removes the capargo demo with the CAPV cluster from the Kind cluster"
cmds:
- ./hack/uninstall-demo.sh test-capargo