-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yml
104 lines (91 loc) · 2.95 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
92
93
94
95
96
97
98
99
100
101
102
103
104
version: '3'
vars:
# K3d configuration
K3D_CLUSTER_NAME: testcluster
LOCAL_IMAGE_REGISTRY_URI: localregistry.localhost
LOCAL_IMAGE_REGISTRY_PORT: 12345
APP_NAME: role-controller
tasks:
default:
cmds:
- task help
silent: true
help:
cmds:
- echo "Welcome to my project - maintainer<Tommy Tran Duc Thang> - email<[email protected]>"
- echo ""
- echo "Run task <task_name> to run predefined script"
- echo "Note":" commands start with local":" are for local development"
- echo ""
- echo "For install dev environment task local:install"
- echo "Going into dev environment task local:shell"
- echo "For local development Flow will be task local:shell -> task local:bootstrap -> task local:dev -> task local:clean"
- echo ""
- echo "For running ci on pipeline task ci:execute but if running it from local make sure you run task:shell first"
- echo ""
- task -l
silent: true
local:install:
desc: install required tools, setup env for macOS and Ubuntu
cmds:
- command -v devbox &> /dev/null || { curl -fsSL https://get.jetify.com/devbox | bash; }
- devbox install
silent: true
local:shell:
desc: Getting into dev shell that has all required tools for development
cmds:
- |
if [ "$DEVBOX_SHELL_ENABLED" != "1" ]; then
echo "Going into devbox shell"
devbox shell
fi
- echo "You already in devbox shell"
silent: true
local:shell:check:
desc: Getting into dev shell that has all required tools for development
cmds:
- |
if [ "$DEVBOX_SHELL_ENABLED" != "1" ]; then
echo "You are not in devbox shell. Please go into a devbox shell first by running:"
echo "task local:shell"
exit 1;
fi
silent: true
internal: true
local:bootstrap:
desc: setup k3d cluster for dev environment
deps: [local:shell:check]
cmds:
- k3d registry create {{.LOCAL_IMAGE_REGISTRY_URI}} --port {{.LOCAL_IMAGE_REGISTRY_PORT}}
- k3d cluster create {{.K3D_CLUSTER_NAME}} --registry-use k3d-{{.LOCAL_IMAGE_REGISTRY_URI}}:{{.LOCAL_IMAGE_REGISTRY_PORT}}
local:dev:
desc: Setup the application in the local cluster and enable hot reloading for development
deps: [local:shell:check]
cmds:
- tilt up
local:clean:
desc: clean up all resources
deps: [local:shell:check]
cmds:
- tilt down
- k3d cluster delete {{.K3D_CLUSTER_NAME}}
- k3d registry delete {{.LOCAL_IMAGE_REGISTRY_URI}}
local:test:
desc: Running test
deps: [local:shell:check]
cmds:
- go test ./...
silent: true
ci:execute:
desc: Execute CI (Pipeline Only)
cmds:
- earthly --ci +ci --IMAGE_NAME={{.APP_NAME}} --TAG={{.SHA}}
vars:
SHA:
sh: git rev-parse HEAD
silent: true
kiki:
desc: (Easter Egg)
cmds:
- echo "I love you my kiki Dayeon :3"
silent: true