-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
97 lines (83 loc) · 2.74 KB
/
Copy pathTaskfile.yml
File metadata and controls
97 lines (83 loc) · 2.74 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
version: '3'
vars:
KIND_CLUSTER: '{{.KIND_CLUSTER | default "platform-mesh"}}'
NAMESPACE: platform-mesh-system
DEPLOYMENT: portal
CONTAINER_RUNTIME: '{{.CONTAINER_RUNTIME | default "docker"}}'
tasks:
default:
desc: Show available tasks
cmds:
- task --list
build:
desc: Build frontend and backend
cmds:
- npm run build
build:frontend:
desc: Build frontend only
dir: frontend
cmds:
- npm run build
build:backend:
desc: Build backend only
dir: backend
cmds:
- npm run build
docker:build:
desc: Build Docker image with specified tag
cmds:
- '{{.CONTAINER_RUNTIME}} build -t {{.IMAGE_NAME}} .'
vars:
IMAGE_NAME: ghcr.io/platform-mesh/portal:{{.IMAGE_TAG | default "dev"}}
docker:kind:
desc: Build container image with current tag from kind cluster and load it
vars:
IMAGE_TAG:
sh: kubectl get deployment {{.DEPLOYMENT}} -n {{.NAMESPACE}} -o jsonpath='{.spec.template.spec.containers[0].image}' | cut -d':' -f2
IMAGE_NAME: ghcr.io/platform-mesh/portal:{{.IMAGE_TAG}}
cmds:
- echo "Building image with tag {{.IMAGE_TAG}} using {{.CONTAINER_RUNTIME}}"
- '{{.CONTAINER_RUNTIME}} build -t {{.IMAGE_NAME}} .'
- |
if [ "{{.CONTAINER_RUNTIME}}" = "podman" ]; then
{{.CONTAINER_RUNTIME}} save {{.IMAGE_NAME}} -o /tmp/kind-image.tar
kind load image-archive /tmp/kind-image.tar --name {{.KIND_CLUSTER}}
rm -f /tmp/kind-image.tar
else
kind load docker-image {{.IMAGE_NAME}} --name {{.KIND_CLUSTER}}
fi
- kubectl rollout restart deployment/{{.DEPLOYMENT}} -n {{.NAMESPACE}}
- kubectl rollout status deployment/{{.DEPLOYMENT}} -n {{.NAMESPACE}} --timeout=120s
- echo "Image loaded and deployment restarted"
logs:
desc: Stream logs from portal deployment
cmds:
- kubectl logs -f deployment/{{.DEPLOYMENT}} -n {{.NAMESPACE}}
logs:previous:
desc: Show logs from previous portal pod
cmds:
- kubectl logs deployment/{{.DEPLOYMENT}} -n {{.NAMESPACE}} --previous
status:
desc: Show portal deployment status
cmds:
- kubectl get deployment {{.DEPLOYMENT}} -n {{.NAMESPACE}}
- kubectl get pods -n {{.NAMESPACE}} -l app.kubernetes.io/name=portal
restart:
desc: Restart portal deployment
cmds:
- kubectl rollout restart deployment/{{.DEPLOYMENT}} -n {{.NAMESPACE}}
- kubectl rollout status deployment/{{.DEPLOYMENT}} -n {{.NAMESPACE}} --timeout=120s
install:
desc: Install all dependencies
cmds:
- npm ci
- cd frontend && npm ci
- cd backend && npm ci
test:
desc: Run all tests
cmds:
- npm run test
lint:
desc: Run linters
cmds:
- npm run lint