-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTaskfile.yml
More file actions
835 lines (769 loc) · 27 KB
/
Copy pathTaskfile.yml
File metadata and controls
835 lines (769 loc) · 27 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
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
version: "3"
includes:
local:
taskfile: ./Taskfile.local.yml
optional: true
# Incremental build pipeline for incident-commander. Each stage tracks its
# own sources + generates, so `task build` re-runs only the stages whose
# inputs changed since the last successful run. Checksums live in .task/.
#
# Stages (topologically):
# tailwind-asset → controller-gen → generate → gen-schemas → manifests
# → fmt → ginkgo → ui:install → ui:build → go:build
#
# The Makefile's `make build` still works for CI and parity with existing
# scripts; this Taskfile is the fast local path.
vars:
APP_NAME: incident-commander
REGISTRY: '{{.REGISTRY | default "docker.lab"}}'
IMAGE: "{{.REGISTRY}}/{{.APP_NAME}}"
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
# Build locations
BIN_DIR: "{{.ROOT_DIR}}/.bin"
BINARY: "{{.BIN_DIR}}/{{.APP_NAME}}"
FARO_BINARY: "{{.BIN_DIR}}/faro"
TAILWIND_VERSION: 3.4.17
TAILWIND_JS: auth/oidc/static/tailwind.min.js
CONTROLLER_GEN_VERSION: v0.19.0
PGRST_VERSION: v14.1
CONTROLLER_GEN: "{{.BIN_DIR}}/controller-gen"
VERSION_TAG:
sh: git describe --abbrev=0 --tags --exact-match 2>/dev/null || echo latest
BUILD_DATE:
sh: date "+%Y-%m-%d %H:%M:%S"
tasks:
default:
desc: Show available tasks
cmds:
- task --list
proto:
desc: Regenerate plugin gRPC stubs from plugin/api/plugin.proto
cmds:
- make proto
sources:
- plugin/api/plugin.proto
generates:
- plugin/api/plugin.pb.go
- plugin/api/plugin_grpc.pb.go
signing-key:
desc: Generate an RSA private signing key at the default path
cmds:
- |
set -e
path=".mission-control-signing-key.pem"
if [ -e "$path" ]; then
echo "$path already exists"
exit 1
fi
openssl genrsa -out "$path" 2048
chmod 600 "$path"
echo "Generated $path"
generates:
- .mission-control-signing-key.pem
build:
desc: Build the full incident-commander binary with embedded UI
deps:
- go:build
clean:
desc: Remove build artifacts and Task checksums
cmds:
- rm -rf .task .bin/{{.APP_NAME}} ui/frontend/dist ui/frontend/node_modules
- rm -f {{.TAILWIND_JS}}
# ────────────── Downloaded + vendored assets ──────────────
tailwind-asset:
desc: Download the vendored Tailwind script used by the OIDC static page
cmds:
- curl -sL "https://cdn.tailwindcss.com/{{.TAILWIND_VERSION}}" -o {{.TAILWIND_JS}}
generates:
- "{{.TAILWIND_JS}}"
status:
- test -s {{.TAILWIND_JS}}
# ────────────── Code generation ──────────────
controller-gen:
desc: Install controller-gen into .bin if missing or wrong version
cmds:
- mkdir -p {{.BIN_DIR}}
- GOBIN={{.BIN_DIR}} go install sigs.k8s.io/controller-tools/cmd/controller-gen@{{.CONTROLLER_GEN_VERSION}}
generates:
- "{{.CONTROLLER_GEN}}"
status:
- test -x {{.CONTROLLER_GEN}}
- '{{.CONTROLLER_GEN}} --version 2>/dev/null | grep -q "{{.CONTROLLER_GEN_VERSION}}"'
generate:
desc: Run controller-gen object codegen for CRD types
deps: [controller-gen]
cmds:
- '{{.CONTROLLER_GEN}} object paths="./api/..." paths="./logs/..."'
sources:
- api/**/*.go
- logs/**/*.go
gen-schemas:
desc: Generate JSON schemas for all CRDs (hack/generate-schemas)
deps: [generate]
cmds:
- |
set -e
cp go.mod hack/generate-schemas/go.mod
cd hack/generate-schemas
go mod edit -module=github.com/flanksource/incident-commander/hack/generate-schemas
go mod edit -require=github.com/flanksource/incident-commander@v1.0.0
go mod edit -replace=github.com/flanksource/incident-commander=../../
if grep -v "^//" ../../go.mod | grep -q "replace.*github.com/flanksource/duty.*=>"; then
go mod edit -replace=github.com/flanksource/duty=../../../duty
fi
if grep -v "^//" ../../go.mod | grep -q "replace.*github.com/flanksource/clicky.*=>"; then
go mod edit -replace=github.com/flanksource/clicky=../../../clicky
fi
go mod tidy
go run ./main.go
sources:
- go.mod
- go.sum
- api/**/*.go
- hack/generate-schemas/main.go
generates:
- config/schemas/*.schema.json
manifests:
desc: Generate CRD manifests
deps: [controller-gen, generate]
cmds:
- '{{.CONTROLLER_GEN}} crd paths="./api/..." output:crd:artifacts:config=config/crds'
sources:
- api/**/*.go
generates:
- config/crds/*.yaml
fmt:
desc: Run gofmt across the module
cmds:
- go fmt ./...
sources:
- "**/*.go"
- exclude: ui/frontend/**
- exclude: .bin/**
- exclude: node_modules/**
ginkgo:
desc: Install ginkgo v2 into the module
cmds:
- go install github.com/onsi/ginkgo/v2/ginkgo
sources:
- go.mod
- go.sum
status:
- command -v ginkgo >/dev/null 2>&1
# ────────────── Frontend ──────────────
ui:install:
desc: Install ui/frontend dependencies and update lockfile when package metadata changes
dir: ui/frontend
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
sources:
- package.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
status:
# `.modules.yaml` is only written after a successful install — a stale
# `node_modules/` containing only `.pnpm/` (broken install) won't pass.
- test -f node_modules/.modules.yaml
- test node_modules/.modules.yaml -nt pnpm-lock.yaml
- test node_modules/.modules.yaml -nt package.json
ui:install:local:
desc: |
Reinstall ui/frontend with @flanksource/clicky-ui linked to the sibling
../clicky-ui checkout. Used by `task dev`. No caching — runs every time
so the link is fresh. Restores pnpm-lock.yaml afterwards so the
committed lockfile keeps its registry-resolved entries.
dir: ui/frontend
env:
CLICKY_UI_LOCAL: "1"
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
- git restore pnpm-lock.yaml
ui:build:
desc: Build the embedded UI bundle (tsc --noEmit + vite) into ui/frontend/dist
dir: ui/frontend
deps: [ui:install]
cmds:
- pnpm run build
sources:
- src/**/*.ts
- src/**/*.tsx
- src/**/*.css
- index.html
- package.json
- pnpm-lock.yaml
- tsconfig.json
- vite.config.ts
# Clicky-ui is linked via pnpm workspace; rebuild when its dist changes.
- ../../../clicky-ui/packages/ui/dist/**/*.mjs
- ../../../clicky-ui/packages/ui/dist/**/*.js
- ../../../clicky-ui/packages/ui/dist/**/*.css
generates:
- dist/index.html
- dist/assets/**
ui:test:
desc: Run frontend unit tests (vitest)
dir: ui/frontend
deps: [ui:install]
cmds:
- pnpm test
sources:
- src/**/*.ts
- src/**/*.tsx
# ────────────── Go build ──────────────
ui:checksum:
desc: Regenerate ui/bundle_checksum.go (sha256 of the embedded bundle)
deps: [ui:build]
cmds:
- go generate ./ui/...
sources:
- ui/frontend/dist/index.html
- ui/frontend/dist/assets/**
- ui/internal/gen-checksum/main.go
generates:
- ui/bundle_checksum.go
go:build-fast:
desc: Build the Go binary without the UI bundle (for fast iteration on Go code)
deps:
- ui:build
- ui:checksum
cmds:
- mkdir -p {{.BIN_DIR}}
- >-
go build -o {{.BINARY}} -ldflags "-X \"main.version={{.VERSION_TAG}} built at {{.BUILD_DATE}}\"" main.go
sources:
- "**/*.go"
- go.mod
- go.sum
generates:
- "{{.BINARY}}"
go:build:
desc: Build the Go binary with the embedded UI bundle + tailwind asset
deps:
- tailwind-asset
- manifests
- gen-schemas
- fmt
- ginkgo
- ui:build
- ui:checksum
cmds:
- mkdir -p {{.BIN_DIR}}
- >-
go build -o {{.BINARY}} -ldflags "-X \"main.version={{.VERSION_TAG}} built at {{.BUILD_DATE}}\"" main.go
sources:
- "**/*.go"
- go.mod
- go.sum
- ui/frontend/dist/index.html
- ui/frontend/dist/assets/**
- ui/bundle_checksum.go
- exclude: ui/frontend/node_modules/**
- exclude: .bin/**
- exclude: .task/**
generates:
- "{{.BINARY}}"
# ────────────── faro (slim remote client) ──────────────
faro:build:
desc: Build the slim faro client binary (no embedded UI / server)
deps:
- tailwind-asset
cmds:
- mkdir -p {{.BIN_DIR}}
- >-
go build -trimpath -o {{.FARO_BINARY}} -ldflags "-s -w -X \"main.version={{.VERSION}} built at {{.BUILD_DATE}}\"" ./faro
sources:
- "**/*.go"
- "{{.TAILWIND_JS}}"
- go.mod
- go.sum
- exclude: ui/frontend/**
- exclude: .bin/**
- exclude: .task/**
generates:
- "{{.FARO_BINARY}}"
faro:install:
desc: Build and install the faro client to the default go bin (go env GOBIN)
cmds:
- >-
go install -trimpath -ldflags "-s -w -X \"main.version={{.VERSION}} built at {{.BUILD_DATE}}\"" ./faro
faro:run:
desc: Build and run faro (pass args after --, e.g. `task faro:run -- whoami`)
deps:
- faro:build
interactive: true
cmds:
- "{{.FARO_BINARY}} {{.CLI_ARGS}}"
# ────────────── Plugins ──────────────
ui:install:plugin:kubernetes-logs:
desc: Install pnpm deps for the kubernetes-logs plugin UI workspace
dir: plugins/kubernetes-logs/ui-src
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
sources:
- package.json
- pnpm-workspace.yaml
status:
# `.modules.yaml` only exists after a successful install — guards
# against a half-populated node_modules/ that contains only `.pnpm/`.
- test -f node_modules/.modules.yaml
- test node_modules/.modules.yaml -nt package.json
ui:install:plugin:kubernetes-logs:local:
desc: |
Reinstall the kubernetes-logs plugin UI with @flanksource/clicky-ui
linked to the sibling ../clicky-ui checkout. Used by `task dev:plugins`.
No caching; restores pnpm-lock.yaml afterwards.
dir: plugins/kubernetes-logs/ui-src
env:
CLICKY_UI_LOCAL: "1"
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
- git restore pnpm-lock.yaml
ui:build:plugin:kubernetes-logs:
desc: Build the kubernetes-logs plugin UI bundle into plugins/kubernetes-logs/ui
dir: plugins/kubernetes-logs/ui-src
deps: [ui:install:plugin:kubernetes-logs]
env:
PLUGIN_VERSION: "{{.VERSION}}"
PLUGIN_BUILD_DATE: "{{.BUILD_DATE}}"
cmds:
- pnpm run build
sources:
- src/**/*.ts
- src/**/*.tsx
- src/**/*.css
- index.html
- package.json
- tsconfig.json
- vite.config.ts
# Rebuild when clicky-ui dist or its style tokens change.
- ../../../../clicky-ui/packages/ui/dist/index.mjs
- ../../../../clicky-ui/packages/ui/src/styles/**/*.css
generates:
- ../ui/index.html
generate:plugin:kubernetes-logs:
desc: Regenerate ui_checksum.go (sha256 of the embedded UI bundle)
deps: [ui:build:plugin:kubernetes-logs]
cmds:
- go generate ./plugins/kubernetes-logs/...
sources:
- plugins/kubernetes-logs/ui/**
- plugins/kubernetes-logs/internal/gen-checksum/main.go
generates:
- plugins/kubernetes-logs/ui_checksum.go
build:plugin:kubernetes-logs:
desc: Build the kubernetes-logs reference plugin (UI + checksum + Go binary) into $MISSION_CONTROL_PLUGIN_PATH
deps: [generate:plugin:kubernetes-logs]
vars:
PLUGIN_NAME: kubernetes-logs
PLUGIN_DIR: "{{.ROOT_DIR}}/plugins/kubernetes-logs"
PLUGIN_PATH:
sh: echo "${MISSION_CONTROL_PLUGIN_PATH:-$HOME/.mission-control/plugins}"
cmds:
- mkdir -p {{.PLUGIN_PATH}}
- >-
go build -o {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}
-ldflags "-X 'main.Version={{.VERSION}}' -X 'main.BuildDate={{.BUILD_DATE}}'"
./plugins/{{.PLUGIN_NAME}}
- echo "Installed {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}} version={{.VERSION}} built={{.BUILD_DATE}}"
sources:
- plugins/kubernetes-logs/**/*.go
- plugins/kubernetes-logs/ui/**
- plugins/kubernetes-logs/ui_checksum.go
- plugin/**/*.go
- go.mod
- go.sum
generates:
- "{{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}"
ui:install:plugin:sql-server:
desc: Install pnpm deps for the sql-server plugin UI workspace
dir: plugins/sql-server/ui-src
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
sources:
- package.json
status:
# `.modules.yaml` only exists after a successful install — guards
# against a half-populated node_modules/ that contains only `.pnpm/`.
- test -f node_modules/.modules.yaml
- test node_modules/.modules.yaml -nt package.json
ui:install:plugin:sql-server:local:
desc: |
Reinstall the sql-server plugin UI with @flanksource/clicky-ui linked
to the sibling ../clicky-ui checkout. Used by `task dev:plugins`.
No caching; restores pnpm-lock.yaml afterwards.
dir: plugins/sql-server/ui-src
env:
CLICKY_UI_LOCAL: "1"
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
- git restore pnpm-lock.yaml
ui:build:plugin:sql-server:
desc: Build the sql-server plugin UI bundle into plugins/sql-server/ui
dir: plugins/sql-server/ui-src
deps: [ui:install:plugin:sql-server]
env:
PLUGIN_VERSION: "{{.VERSION}}"
PLUGIN_BUILD_DATE: "{{.BUILD_DATE}}"
cmds:
- pnpm run build
sources:
- src/**/*.ts
- src/**/*.tsx
- index.html
- package.json
- tsconfig.json
- vite.config.ts
# Rebuild when locally-linked clicky-ui dist or its style tokens change.
- ../../../../clicky-ui/packages/ui/dist/index.mjs
- ../../../../clicky-ui/packages/ui/src/styles/**/*.css
generates:
- ../ui/index.html
generate:plugin:sql-server:
desc: Regenerate ui_checksum.go (sha256 of the embedded UI bundle)
deps: [ui:build:plugin:sql-server]
cmds:
- go generate ./plugins/sql-server/...
sources:
- plugins/sql-server/ui/**
- plugins/sql-server/internal/gen-checksum/main.go
generates:
- plugins/sql-server/ui_checksum.go
build:plugin:sql-server:
desc: Build the sql-server plugin (UI + checksum + Go binary) into $MISSION_CONTROL_PLUGIN_PATH
deps: [generate:plugin:sql-server]
vars:
PLUGIN_NAME: sql-server
PLUGIN_DIR: "{{.ROOT_DIR}}/plugins/sql-server"
PLUGIN_PATH:
sh: echo "${MISSION_CONTROL_PLUGIN_PATH:-$HOME/.mission-control/plugins}"
cmds:
- mkdir -p {{.PLUGIN_PATH}}
- >-
go build -o {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}
-ldflags "-X 'main.Version={{.VERSION}}' -X 'main.BuildDate={{.BUILD_DATE}}'"
./plugins/{{.PLUGIN_NAME}}
- echo "Installed {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}} version={{.VERSION}} built={{.BUILD_DATE}}"
sources:
- plugins/sql-server/**/*.go
- plugins/sql-server/ui/**
- plugins/sql-server/ui_checksum.go
- plugin/**/*.go
- go.mod
- go.sum
generates:
- "{{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}"
ui:install:plugin:postgres:
desc: Install pnpm deps for the postgres plugin UI workspace
dir: plugins/postgres/ui-src
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
sources:
- package.json
status:
- test -f node_modules/.modules.yaml
- test node_modules/.modules.yaml -nt package.json
ui:install:plugin:postgres:local:
desc: |
Reinstall the postgres plugin UI with @flanksource/clicky-ui linked
to the sibling ../clicky-ui checkout. Used by `task dev:plugins`.
No caching; restores pnpm-lock.yaml afterwards.
dir: plugins/postgres/ui-src
env:
CLICKY_UI_LOCAL: "1"
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
- git restore pnpm-lock.yaml
ui:build:plugin:postgres:
desc: Build the postgres plugin UI bundle into plugins/postgres/ui
dir: plugins/postgres/ui-src
deps: [ui:install:plugin:postgres]
env:
PLUGIN_VERSION: "{{.VERSION}}"
PLUGIN_BUILD_DATE: "{{.BUILD_DATE}}"
cmds:
- pnpm run build
sources:
- src/**/*.ts
- src/**/*.tsx
- index.html
- package.json
- tsconfig.json
- vite.config.ts
- ../../../../clicky-ui/packages/ui/dist/index.mjs
- ../../../../clicky-ui/packages/ui/src/styles/**/*.css
generates:
- ../ui/index.html
generate:plugin:postgres:
desc: Regenerate ui_checksum.go (sha256 of the embedded UI bundle)
deps: [ui:build:plugin:postgres]
cmds:
- go generate ./plugins/postgres/...
sources:
- plugins/postgres/ui/**
- plugins/postgres/internal/gen-checksum/main.go
generates:
- plugins/postgres/ui_checksum.go
build:plugin:postgres:
desc: Build the postgres plugin (UI + checksum + Go binary) into $MISSION_CONTROL_PLUGIN_PATH
deps: [generate:plugin:postgres]
vars:
PLUGIN_NAME: postgres
PLUGIN_DIR: "{{.ROOT_DIR}}/plugins/postgres"
PLUGIN_PATH:
sh: echo "${MISSION_CONTROL_PLUGIN_PATH:-$HOME/.mission-control/plugins}"
cmds:
- mkdir -p {{.PLUGIN_PATH}}
- >-
go build -o {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}
-ldflags "-X 'main.Version={{.VERSION}}' -X 'main.BuildDate={{.BUILD_DATE}}'"
./plugins/{{.PLUGIN_NAME}}
- echo "Installed {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}} version={{.VERSION}} built={{.BUILD_DATE}}"
sources:
- plugins/postgres/**/*.go
- plugins/postgres/ui/**
- plugins/postgres/ui_checksum.go
- plugin/**/*.go
- go.mod
- go.sum
generates:
- "{{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}"
ui:install:plugin:arthas:
desc: Install pnpm deps for the arthas plugin UI workspace
dir: plugins/arthas/ui-src
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
sources:
- package.json
status:
- test -f node_modules/.modules.yaml
- test node_modules/.modules.yaml -nt package.json
ui:install:plugin:arthas:local:
desc: |
Reinstall the arthas plugin UI with @flanksource/clicky-ui linked
to the sibling ../clicky-ui checkout. Used by `task dev:plugins`.
No caching; restores pnpm-lock.yaml afterwards.
dir: plugins/arthas/ui-src
env:
CLICKY_UI_LOCAL: "1"
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
- git restore pnpm-lock.yaml
ui:build:plugin:arthas:
desc: Build the arthas plugin UI bundle into plugins/arthas/ui
dir: plugins/arthas/ui-src
deps: [ui:install:plugin:arthas]
env:
PLUGIN_VERSION: "{{.VERSION}}"
PLUGIN_BUILD_DATE: "{{.BUILD_DATE}}"
cmds:
- pnpm run build
sources:
- src/**/*.ts
- src/**/*.tsx
- index.html
- package.json
- tsconfig.json
- vite.config.ts
- ../../../../clicky-ui/packages/ui/dist/index.mjs
- ../../../../clicky-ui/packages/ui/src/styles/**/*.css
generates:
- ../ui/index.html
generate:plugin:arthas:
desc: Regenerate ui_checksum.go (sha256 of the embedded UI bundle)
deps: [ui:build:plugin:arthas]
cmds:
- go generate ./plugins/arthas/...
sources:
- plugins/arthas/ui/**
- plugins/arthas/internal/gen-checksum/main.go
generates:
- plugins/arthas/ui_checksum.go
build:plugin:arthas:
desc: Build the arthas plugin (UI + checksum + Go binary) into $MISSION_CONTROL_PLUGIN_PATH
deps: [generate:plugin:arthas]
vars:
PLUGIN_NAME: arthas
PLUGIN_DIR: "{{.ROOT_DIR}}/plugins/arthas"
PLUGIN_PATH:
sh: echo "${MISSION_CONTROL_PLUGIN_PATH:-$HOME/.mission-control/plugins}"
cmds:
- mkdir -p {{.PLUGIN_PATH}}
- >-
go build -o {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}
-ldflags "-X 'main.Version={{.VERSION}}' -X 'main.BuildDate={{.BUILD_DATE}}'"
./plugins/{{.PLUGIN_NAME}}
- echo "Installed {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}} version={{.VERSION}} built={{.BUILD_DATE}}"
sources:
- plugins/arthas/**/*.go
- plugins/arthas/ui/**
- plugins/arthas/ui_checksum.go
- plugin/**/*.go
- go.mod
- go.sum
generates:
- "{{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}"
ui:install:plugin:golang:
desc: Install pnpm deps for the golang plugin UI workspace
dir: plugins/golang/ui-src
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
sources:
- package.json
status:
- test -f node_modules/.modules.yaml
- test node_modules/.modules.yaml -nt package.json
ui:install:plugin:golang:local:
desc: |
Reinstall the golang plugin UI with @flanksource/clicky-ui linked
to the sibling ../clicky-ui checkout. Used by `task dev:plugins`.
No caching; restores pnpm-lock.yaml afterwards.
dir: plugins/golang/ui-src
env:
CLICKY_UI_LOCAL: "1"
cmds:
- CI=true pnpm install --no-frozen-lockfile --prefer-offline
- git restore pnpm-lock.yaml
ui:build:plugin:golang:
desc: Build the golang plugin UI bundle into plugins/golang/ui
dir: plugins/golang/ui-src
deps: [ui:install:plugin:golang]
env:
PLUGIN_VERSION: "{{.VERSION}}"
PLUGIN_BUILD_DATE: "{{.BUILD_DATE}}"
cmds:
- pnpm run build
sources:
- src/**/*.ts
- src/**/*.tsx
- src/**/*.css
- index.html
- package.json
- tsconfig.json
- vite.config.ts
- ../../../../clicky-ui/packages/ui/dist/index.mjs
- ../../../../clicky-ui/packages/ui/src/styles/**/*.css
generates:
- ../ui/index.html
generate:plugin:golang:
desc: Regenerate ui_checksum.go for the golang plugin
deps: [ui:build:plugin:golang]
cmds:
- go generate ./plugins/golang/...
sources:
- plugins/golang/ui/**
- plugins/golang/internal/gen-checksum/main.go
generates:
- plugins/golang/ui_checksum.go
build:plugin:golang:
desc: Build the golang plugin into $MISSION_CONTROL_PLUGIN_PATH
deps: [generate:plugin:golang]
vars:
PLUGIN_NAME: golang
PLUGIN_PATH:
sh: echo "${MISSION_CONTROL_PLUGIN_PATH:-$HOME/.mission-control/plugins}"
cmds:
- mkdir -p {{.PLUGIN_PATH}}
- >-
go build -o {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}
-ldflags "-X 'main.Version={{.VERSION}}' -X 'main.BuildDate={{.BUILD_DATE}}'"
./plugins/{{.PLUGIN_NAME}}
- echo "Installed {{.PLUGIN_PATH}}/{{.PLUGIN_NAME}} version={{.VERSION}} built={{.BUILD_DATE}}"
sources:
- plugins/golang/**/*.go
- plugins/golang/ui/**
- plugins/golang/ui_checksum.go
- plugin/**/*.go
- go.mod
- go.sum
generates:
- "{{.PLUGIN_PATH}}/{{.PLUGIN_NAME}}"
# ────────────── Developer loops ──────────────
run:
desc: Build + run `serve --ui` on port 8080
deps: [build]
cmds:
- "{{.BINARY}} serve --ui {{.CLI_ARGS}}"
clicky-ui:build:
desc: Rebuild the @flanksource/clicky-ui package only (not the whole clicky-ui monorepo)
dir: "{{.ROOT_DIR}}/../clicky-ui/packages/ui"
cmds:
- pnpm build
sources:
- src/**/*.ts
- src/**/*.tsx
- src/**/*.css
- package.json
- tsconfig.json
generates:
- dist/index.mjs
- dist/index.d.mts
env:
CI: "true"
dev:
desc: |
Rebuild clicky-ui + incident-commander UI (linked to local clicky-ui)
+ the Go binary, then start `serve --ui --dev` with a local htpasswd.
The Go server proxies /ui to Vite so frontend changes are served from
Vite watch mode instead of the embedded bundle.
env:
PGRST_VERSION: any
cmds:
# Order matters: build clicky-ui dist, link it into ui/frontend, then
# build the embedded bundle + Go binary that consume the linked dist.
- task: clicky-ui:build
- task: ui:install:local
- task: go:build-fast
# secret is hardcoded for dev purposes and is save to
- "{{.BINARY}} serve --htpasswd-file .htpasswd --disable-operators -vv --postgrest-uri http://localhost:0 --ui --dev {{.CLI_ARGS}}"
dev:plugins:
desc: |
Build the sql-server, postgres, kubernetes-logs, and arthas plugin binaries with their
UIs linked to the sibling ../clicky-ui checkout. Use this loop when
iterating on clicky-ui changes that need to surface in the plugin UIs.
cmds:
- task: clicky-ui:build
- task: ui:install:plugin:kubernetes-logs:local
- task: ui:install:plugin:sql-server:local
- task: ui:install:plugin:postgres:local
- task: ui:install:plugin:arthas:local
- task: ui:install:plugin:golang:local
- task: build:plugin:kubernetes-logs
- task: build:plugin:sql-server
- task: build:plugin:postgres
- task: build:plugin:arthas
- task: build:plugin:golang
test:
desc: Run Ginkgo tests (skips e2e)
deps: [ginkgo]
cmds:
- >-
ginkgo -r --skip-package=tests/e2e --keep-going --junit-report junit-report.xml --github-output --output-dir test-reports --succinct --label-filter='!ignore_local'
# ────────────── Kubernetes lab deploy (existing tasks) ──────────────
image:lab:
desc: "Build and push the incident-commander image to the lab registry. Defaults REGISTRY=docker.lab; override with REGISTRY=docker.example.com."
cmds:
- docker buildx build --platform linux/amd64 --push . -f Dockerfile -t {{.IMAGE}}:{{.VERSION}} -t {{.IMAGE}}:latest
deploy:lab:
desc: "Build, push, and patch the running incident-commander deployment in the current kubectl context. Defaults REGISTRY=docker.lab."
deps: [image:lab]
vars:
CURRENT_NAMESPACE:
sh: kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null || echo "default"
DEPLOYMENT:
sh: |
ns={{.CURRENT_NAMESPACE | default "default"}}
name=$(kubectl -n "$ns" get deploy \
-l app.kubernetes.io/name={{.APP_NAME}} \
-o jsonpath='{.items[0].metadata.name}' 2>/dev/null)
if [ -z "$name" ]; then
name=$(kubectl -n "$ns" get deploy \
-o jsonpath='{.items[?(@.metadata.name=="{{.APP_NAME}}")].metadata.name}' 2>/dev/null)
fi
echo "${name:-{{.APP_NAME}}}"
cmds:
- echo "Patching deploy/{{.DEPLOYMENT}} in namespace {{.CURRENT_NAMESPACE}} -> {{.IMAGE}}:{{.VERSION}}"
- >-
kubectl -n {{.CURRENT_NAMESPACE}} set image deploy/{{.DEPLOYMENT}} {{.APP_NAME}}={{.IMAGE}}:{{.VERSION}}
- kubectl -n {{.CURRENT_NAMESPACE}} rollout restart deploy/{{.DEPLOYMENT}}
- kubectl -n {{.CURRENT_NAMESPACE}} rollout status deploy/{{.DEPLOYMENT}} --timeout=300s