-
-
Notifications
You must be signed in to change notification settings - Fork 10
1196 lines (1113 loc) · 46.1 KB
/
Copy pathci.yaml
File metadata and controls
1196 lines (1113 loc) · 46.1 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
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: CI - KSail
on:
push:
branches: [main]
pull_request:
merge_group:
workflow_dispatch:
inputs:
run_system_tests:
description: "Run system tests"
required: false
type: boolean
default: true
env:
# Use pipe (|) instead of comma (,) so Go falls through to direct on ANY proxy
# error (including 403), not just 404/410. Hardens CI against transient
# proxy.golang.org outages. go.sum still verifies module integrity.
GOPROXY: "https://proxy.golang.org|direct"
# Soft memory limit for Go build toolchain (compiler, linker). The KSail
# binary links a large dependency tree and the Go linker can exceed the
# default runner memory on cache-miss builds. Setting GOMEMLIMIT makes the
# GC work harder to stay within budget, reducing peak RSS.
GOMEMLIMIT: "6GiB"
concurrency:
group: "ci-ksail-${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
permissions: {}
jobs:
# cancel-stale-merge-queue — kept for future use when jobs are moved to merge_group
# cancel-stale-merge-queue:
# name: 🧹 Cancel Stale Merge Queue Runs
# if: github.event_name == 'merge_group'
# runs-on: ubuntu-latest
# timeout-minutes: 2
# permissions:
# actions: write
# steps:
# - name: Cancel previous runs for same merge queue entry
# uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
# with:
# script: |
# const ref = context.ref;
# const match = ref.match(/^(refs\/heads\/gh-readonly-queue\/.+)-[0-9a-f]+$/);
# if (!match) {
# console.log('Not a merge queue ref, skipping');
# return;
# }
# const stablePrefix = match[1];
#
# for (const status of ['in_progress', 'queued']) {
# let page = 1;
# while (true) {
# const { data: { workflow_runs: runs } } = await github.rest.actions.listWorkflowRuns({
# owner: context.repo.owner,
# repo: context.repo.repo,
# workflow_id: 'ci.yaml',
# event: 'merge_group',
# status,
# per_page: 100,
# page,
# });
#
# if (runs.length === 0) break;
#
# for (const run of runs) {
# if (run.run_number >= context.runNumber) continue;
# const runRef = `refs/heads/${run.head_branch}`;
# const runMatch = runRef.match(/^(refs\/heads\/gh-readonly-queue\/.+)-[0-9a-f]+$/);
# if (runMatch && runMatch[1] === stablePrefix) {
# console.log(`Cancelling stale run ${run.id} (${runRef})`);
# try {
# await github.rest.actions.cancelWorkflowRun({
# owner: context.repo.owner,
# repo: context.repo.repo,
# run_id: run.id,
# });
# } catch (error) {
# if (error && (error.status === 409 || error.status === 422)) {
# console.log(`Skipping run ${run.id}; it is no longer cancellable (${error.status})`);
# continue;
# }
# throw error;
# }
# }
# }
#
# if (runs.length < 100) break;
# page += 1;
# }
# }
# Wait for sufficient GitHub API rate limit before proceeding
rate-limit-gate:
name: ⏳ Rate Limit Gate
if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/rate-limit-gate
# Detect which file categories changed to conditionally run jobs
changes:
name: 🔍 Detect Changes
if: github.event_name != 'merge_group'
needs: [rate-limit-gate]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
benchmark: ${{ steps.filter.outputs.benchmark }}
system-test: ${{ steps.filter.outputs.system-test }}
schema: ${{ steps.filter.outputs.schema }}
cli: ${{ steps.filter.outputs.cli }}
vsce: ${{ steps.filter.outputs.vsce }}
docs: ${{ steps.filter.outputs.docs }}
docs-deps: ${{ steps.filter.outputs.docs-deps }}
vsce-deps: ${{ steps.filter.outputs.vsce-deps }}
copilot-plugin: ${{ steps.filter.outputs.copilot-plugin }}
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: 🔍 Filter paths
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: |
code:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- '.github/actions/**'
benchmark:
# Limit to packages that contain benchmarks plus module files.
# Avoids paying ~30 min of benchmark cost on PRs that touch only
# unrelated Go code. Keep this in sync with the package discovery
# step in the `benchmark` job (`grep -rl '^func Benchmark'`).
- 'pkg/apis/cluster/v1alpha1/**/*.go'
- 'pkg/cli/cmd/cipher/**/*.go'
- 'pkg/cli/cmd/cluster/**/*.go'
- 'pkg/client/argocd/**/*.go'
- 'pkg/client/docker/**/*.go'
- 'pkg/client/flux/**/*.go'
- 'pkg/client/helm/**/*.go'
- 'pkg/client/kubectl/**/*.go'
- 'pkg/client/kustomize/**/*.go'
- 'pkg/fsutil/configmanager/ksail/**/*.go'
- 'pkg/fsutil/marshaller/**/*.go'
- 'pkg/k8s/readiness/**/*.go'
- 'pkg/notify/**/*.go'
- 'pkg/svc/diff/**/*.go'
- 'pkg/svc/image/**/*.go'
- 'pkg/svc/registryresolver/**/*.go'
- 'go.mod'
- 'go.sum'
- '.github/workflows/ci.yaml'
system-test:
# NOTE: Do not use negative patterns (!) here.
# dorny/paths-filter v4 uses picomatch where negated patterns
# like '!**/*_test.go' match ANY file that is not a test file
# (including .mdx, .json, etc.), causing docs-only PRs to
# falsely trigger system tests.
# Use an explicit allowlist of directories whose changes truly
# require system tests (cluster/workload code, providers,
# provisioners, installers, client libraries). Chat, MCP,
# cipher, toolgen, docs generators, and schema generators are
# intentionally omitted.
- 'main.go'
- 'internal/buildmeta/**'
- 'pkg/apis/**'
- 'pkg/cli/annotations/**'
- 'pkg/cli/cmd/cluster/**'
- 'pkg/cli/cmd/workload/**'
- 'pkg/cli/cmd/tenant/**'
- 'pkg/cli/dockerutil/**'
- 'pkg/cli/editor/**'
- 'pkg/cli/flags/**'
- 'pkg/cli/kubeconfig/**'
- 'pkg/cli/kubeconfighook/**'
- 'pkg/cli/lifecycle/**'
- 'pkg/cli/setup/**'
- 'pkg/cli/ui/asciiart/**'
- 'pkg/cli/ui/confirm/**'
- 'pkg/cli/ui/errorhandler/**'
- 'pkg/cli/ui/picker/**'
- 'pkg/client/**'
- 'pkg/di/**'
- 'pkg/envvar/**'
- 'pkg/fsutil/**'
- 'pkg/k8s/**'
- 'pkg/notify/**'
- 'pkg/runner/**'
- 'pkg/svc/detector/**'
- 'pkg/svc/diff/**'
- 'pkg/svc/image/**'
- 'pkg/svc/installer/**'
- 'pkg/svc/provider/**'
- 'pkg/svc/provisioner/**'
- 'pkg/svc/registryresolver/**'
- 'pkg/svc/state/**'
- 'pkg/svc/tenant/**'
- 'pkg/svc/versionresolver/**'
- 'pkg/timer/**'
- 'go.mod'
- 'go.sum'
- '.github/actions/**'
- '.github/fixtures/**'
- '.github/workflows/ci.yaml'
schema:
- 'pkg/apis/**/*.go'
- 'go.mod'
- 'schemas/gen_schema.go'
cli:
- 'cmd/**/*.go'
- 'pkg/**/*.go'
- 'go.mod'
- 'docs/gen_docs.go'
- 'docs/gen_docs_prose.go'
vsce:
- 'vsce/**'
- '.github/workflows/ci.yaml'
docs:
# Matches docs content (MDX, Astro, config) but not Go generators.
# Avoid negative patterns — see system-test comment above.
- 'docs/src/**'
- 'docs/public/**'
- 'docs/astro.config.*'
- 'docs/tsconfig.json'
- 'docs/package*.json'
- 'docs/.npmrc'
- '.github/workflows/ci.yaml'
docs-deps:
- 'docs/package*.json'
vsce-deps:
- 'vsce/package*.json'
copilot-plugin:
- 'copilot-plugin/**'
- '.github/plugin/**'
- '.claude-plugin/**'
- '.github/workflows/ci.yaml'
ci-go:
name: ✅ Validate Go Project
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: devantler-tech/reusable-workflows/.github/workflows/validate-go-project.yaml@3b781dc75a8218d568ddbd4b92aee971bf9e835d # v3.1.3
permissions:
contents: write
issues: write
pull-requests: write
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
# Gate: wait for the org-wide Required Workflow "✅ Validate Go Project" to
# finish before starting expensive system tests. On workflow_dispatch the
# required workflow does not run, so this job is skipped.
wait-for-validate-go:
name: ⏳ Wait for Go Validation
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [changes]
if: >-
github.event_name == 'pull_request'
&& needs.changes.outputs.system-test == 'true'
&& github.event.pull_request.head.repo.full_name == github.repository
permissions:
checks: read
steps:
- name: Wait for ✅ Validate Go Project
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const sha = context.payload.pull_request.head.sha;
const owner = context.repo.owner;
const repo = context.repo.repo;
const prefix = '✅ Validate Go Project';
const maxWait = 25 * 60 * 1000; // 25 minutes
const poll = 30 * 1000; // 30 seconds
const start = Date.now();
while (Date.now() - start < maxWait) {
const { data: checks } = await github.rest.checks.listForRef({
owner, repo, ref: sha, per_page: 100,
});
const relevant = checks.check_runs.filter(cr =>
cr.name.startsWith(prefix)
);
if (relevant.length > 0) {
const pending = relevant.filter(cr => cr.status !== 'completed');
if (pending.length === 0) {
const failed = relevant.filter(cr =>
!['success', 'skipped', 'neutral'].includes(cr.conclusion)
);
if (failed.length > 0) {
const names = failed.map(cr => `${cr.name}: ${cr.conclusion}`).join('\n');
core.setFailed(`Go validation failed:\n${names}`);
return;
}
core.info(`✅ All ${relevant.length} Go validation check(s) passed`);
return;
}
core.info(`⏳ Waiting for ${pending.length}/${relevant.length} check(s)...`);
} else {
core.info('⏳ No Go validation checks found yet...');
}
await new Promise(r => setTimeout(r, poll));
}
// On timeout, succeed gracefully if no checks ever appeared
// (required workflow may not be configured for this repo).
const { data: final } = await github.rest.checks.listForRef({
owner, repo, ref: sha, per_page: 100,
});
const remaining = final.check_runs.filter(cr =>
cr.name.startsWith(prefix)
);
if (remaining.length === 0) {
core.warning('No Go validation checks found — required workflow may not apply to this repo');
return;
}
core.setFailed('Timed out waiting for Go validation checks to complete');
build-artifact:
name: 🏗️ Build KSail Binary
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [changes]
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && (needs.changes.outputs.code == 'true' || needs.changes.outputs.cli == 'true' || needs.changes.outputs.system-test == 'true'))
permissions:
contents: read
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: ⚙️ Setup Go
id: setup-go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: 📦 Cache KSail Binary
uses: ./.github/actions/cache-ksail-binary
with:
go-version: ${{ steps.setup-go.outputs.go-version }}
source-hash: ${{ hashFiles('go.mod', 'go.sum', '**/*.go') }}
output-path: /usr/local/bin/ksail
generate:
name: 📝 Generate Schema & Docs
runs-on: ubuntu-latest
timeout-minutes: 25
# Depend on build-artifact so the Go build cache is warm by the time
# `go generate ./docs/...` (and ./schemas/...) re-compiles the cli import
# graph. On events where build-artifact is skipped (push to main), this
# falls through and the job still runs.
needs: [changes, build-artifact]
if: >-
!cancelled()
&& github.event_name != 'merge_group'
&& (needs.changes.outputs.schema == 'true' || needs.changes.outputs.cli == 'true')
&& (needs.build-artifact.result == 'success' || needs.build-artifact.result == 'skipped')
permissions:
contents: read
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: ⚙️ Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: 📝 Generate JSON schema
if: needs.changes.outputs.schema == 'true'
run: go generate ./schemas/...
- name: 📚 Generate reference documentation
if: needs.changes.outputs.cli == 'true'
run: go generate ./docs/...
- name: 📤 Upload patch
run: |
git add -N .
git diff > /tmp/generate.patch
if [ -s /tmp/generate.patch ]; then
echo "Changes detected"
else
echo "No changes"
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: generate-patch
path: /tmp/generate.patch
if-no-files-found: ignore
retention-days: 1
- name: ❌ Fail if generated files are out of date (fork PR)
if: >-
github.event_name == 'pull_request'
&& github.event.pull_request.head.repo.full_name != github.repository
shell: bash
run: |
if [ -s /tmp/generate.patch ]; then
echo "::error::Generated files are out of date. Please run 'go generate ./schemas/...' and 'go generate ./docs/...' locally and commit the results."
echo ""
cat /tmp/generate.patch
exit 1
fi
auto-commit:
name: 📤 Auto-Commit Generated Changes
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [changes, generate]
if: >-
always()
&& github.event_name != 'merge_group'
&& (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
&& needs.generate.result == 'success'
permissions:
contents: write
pull-requests: write
steps:
- name: 🔑 Generate GitHub App Token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: generate-token
with:
client-id: ${{ vars.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env] - GitHub App token generation, no environment scoping available for app installations
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.head_ref || github.ref_name }}
persist-credentials: true
token: ${{ steps.generate-token.outputs.token }}
- name: 📥 Download patches
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "*-patch"
merge-multiple: true
path: /tmp/patches
- name: 📋 Apply patches
run: |
set -euo pipefail
shopt -s nullglob
for patch in /tmp/patches/*.patch; do
if [ -s "$patch" ]; then
patch_name="$(basename "$patch")"
echo "Applying ${patch_name}..."
if git apply --3way "$patch"; then
echo "Applied ${patch_name} with 3-way merge."
else
echo "3-way apply failed for ${patch_name}; falling back to direct apply with rejects..." >&2
if git apply --reject "$patch"; then
echo "Applied ${patch_name} with rejects."
rej_files=$(find . -name '*.rej' 2>/dev/null || true)
if [ -n "$rej_files" ]; then
echo "::error::Reject files found after applying ${patch_name}:"
echo "${rej_files}"
git status --short || true
echo "Failing job to avoid committing partially-applied patches." >&2
exit 1
fi
else
echo "::error::Failed to apply patch ${patch_name}. See diagnostics above." >&2
git status --short || true
exit 1
fi
fi
else
echo "Skipping empty patch $(basename "$patch")"
fi
done
- name: 📤 Commit and push generated changes (PR branch)
if: github.event_name == 'pull_request'
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
with:
commit_message: "chore: sync modules and update generated files"
commit_user_name: generator-bot
commit_user_email: generator-bot@users.noreply.github.com
branch: ${{ github.head_ref }}
- name: 📤 Open PR for generated changes (protected branch)
if: github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: "chore: sync modules and update generated files"
committer: "generator-bot <generator-bot@users.noreply.github.com>"
branch: chore/sync-generated-files/${{ github.ref_name }}
base: ${{ github.ref_name }}
title: "chore: sync modules and update generated files"
body: |
Auto-generated changes detected on `${{ github.ref_name }}`.
This PR updates generated files (schemas, docs, etc.) that were
not included in the originating commit.
delete-branch: true
audit-docs:
name: 🔍 Audit Docs Dependencies
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [changes]
if: github.event_name != 'merge_group' && needs.changes.outputs.docs-deps == 'true'
permissions:
contents: write
steps:
- name: � Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: �🔍 NPM Audit and Fix
uses: ./.github/actions/npm-audit-and-fix
with:
working-directory: docs
client-id: ${{ vars.APP_CLIENT_ID }}
app-private-key: ${{ secrets.APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env] - GitHub App token generation, no environment scoping available for app installations
commit-message: "chore(docs): fix npm audit vulnerabilities"
audit-vsce:
name: 🔍 Audit VSCode Extension Dependencies
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [changes]
if: github.event_name != 'merge_group' && needs.changes.outputs.vsce-deps == 'true'
permissions:
contents: write
steps:
- name: � Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: �🔍 NPM Audit and Fix
uses: ./.github/actions/npm-audit-and-fix
with:
working-directory: vsce
client-id: ${{ vars.APP_CLIENT_ID }}
app-private-key: ${{ secrets.APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env] - GitHub App token generation, no environment scoping available for app installations
commit-message: "chore(vsce): fix npm audit vulnerabilities"
build-docs:
name: 📚 Build Documentation
runs-on: ubuntu-latest
needs: [changes]
if: github.event_name == 'pull_request' && needs.changes.outputs.docs == 'true'
timeout-minutes: 10
permissions:
contents: read
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: ⚙️ Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
cache: "npm"
cache-dependency-path: docs/package-lock.json
- name: 📦 Install dependencies
working-directory: docs
run: npm ci
- name: 🏗️ Build with Astro
working-directory: docs
run: npm run build
vscode-extension:
name: 🧩 VSCode Extension
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [changes]
if: github.event_name != 'merge_group' && needs.changes.outputs.vsce == 'true'
permissions:
contents: read
defaults:
run:
working-directory: vsce
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: ⚙️ Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
cache: "npm"
cache-dependency-path: "vsce/package-lock.json"
- name: 📦 Install dependencies
run: npm ci
- name: 🏗️ Compile
run: npm run compile
- name: 📦 Package extension
run: npm run package
- name: 📦 Create VSIX package
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
run: npx @vscode/vsce package --out ksail.vsix
- name: 📤 Upload VSIX artifact
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ksail-vsix
path: ksail.vsix
retention-days: 7
copilot-plugin:
name: 🧩 Copilot CLI Plugin
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [changes]
if: github.event_name != 'merge_group' && needs.changes.outputs.copilot-plugin == 'true'
permissions:
contents: read
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: 🧪 Validate plugin manifests
run: |
set -euo pipefail
for f in \
copilot-plugin/plugin.json \
copilot-plugin/.claude-plugin/plugin.json \
copilot-plugin/.mcp.json \
.github/plugin/marketplace.json \
.claude-plugin/marketplace.json; do
echo "Validating $f"
jq -e . "$f" >/dev/null
done
# Required fields on the Copilot CLI + Claude Code plugin manifests
for f in copilot-plugin/plugin.json copilot-plugin/.claude-plugin/plugin.json; do
jq -e '.name == "ksail" and .version' "$f" >/dev/null
done
# Each marketplace must reference the plugin directory
for f in .github/plugin/marketplace.json .claude-plugin/marketplace.json; do
jq -e '.plugins[0].source == "./copilot-plugin" and .plugins[0].name == "ksail"' "$f" >/dev/null
done
# Skill manifest must exist
test -f copilot-plugin/skills/ksail/SKILL.md
# MCP server must point at the ksail binary
jq -e '.mcpServers.ksail.command == "ksail"' copilot-plugin/.mcp.json >/dev/null
warm-helm-cache:
name: 🔥 Warm Helm Cache
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [changes, build-artifact, wait-for-validate-go]
if: >-
!cancelled()
&& (needs.wait-for-validate-go.result == 'success' || needs.wait-for-validate-go.result == 'skipped')
&& (
(github.event_name == 'pull_request'
&& needs.changes.outputs.system-test == 'true'
&& github.event.pull_request.head.repo.full_name == github.repository)
|| (github.event_name == 'workflow_dispatch' && inputs.run_system_tests == true)
)
permissions:
contents: read
outputs:
cache-key: ${{ steps.warm.outputs.cache-key }}
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: ⚙️ Setup Go
id: setup-go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: 📦 Cache KSail Binary
uses: ./.github/actions/cache-ksail-binary
with:
go-version: ${{ steps.setup-go.outputs.go-version }}
source-hash: ${{ hashFiles('go.mod', 'go.sum', '**/*.go') }}
output-path: /usr/local/bin/ksail
save: "false"
- name: 🔥 Warm Helm chart cache
id: warm
uses: ./.github/actions/warm-helm-cache
warm-mirror-cache:
name: 🔥 Warm Mirror Cache
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [changes, build-artifact, wait-for-validate-go]
if: >-
!cancelled()
&& (needs.wait-for-validate-go.result == 'success' || needs.wait-for-validate-go.result == 'skipped')
&& (
(github.event_name == 'pull_request'
&& needs.changes.outputs.system-test == 'true'
&& github.event.pull_request.head.repo.full_name == github.repository)
|| (github.event_name == 'workflow_dispatch' && inputs.run_system_tests == true)
)
permissions:
contents: read
outputs:
cache-key: ${{ steps.warm.outputs.cache-key }}
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: ⚙️ Setup Go
id: setup-go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: 📦 Cache KSail Binary
uses: ./.github/actions/cache-ksail-binary
with:
go-version: ${{ steps.setup-go.outputs.go-version }}
source-hash: ${{ hashFiles('go.mod', 'go.sum', '**/*.go') }}
output-path: /usr/local/bin/ksail
save: "false"
- name: 🔥 Warm mirror cache
id: warm
uses: ./.github/actions/warm-mirror-cache
# Docker-based system tests run in full parallelism with no concurrency
# constraints — each job gets its own runner with local Docker containers.
system-test-docker:
name: 🧪 System Test (Docker)
runs-on: ubuntu-latest
timeout-minutes: 75
needs:
[
changes,
build-artifact,
warm-helm-cache,
warm-mirror-cache,
wait-for-validate-go,
]
if: >-
!cancelled()
&& (needs.wait-for-validate-go.result == 'success' || needs.wait-for-validate-go.result == 'skipped')
&& (
(github.event_name == 'pull_request'
&& needs.changes.outputs.system-test == 'true'
&& github.event.pull_request.head.repo.full_name == github.repository)
|| (github.event_name == 'workflow_dispatch' && inputs.run_system_tests == true)
)
permissions:
contents: read
packages: write
strategy:
fail-fast: true
max-parallel: 15
matrix:
distribution: [KWOK, Vanilla, K3s, VCluster, Talos]
provider: [Docker]
init: [true, false]
args:
- ""
- "--name system-test-cluster --cni Cilium --csi Enabled --load-balancer Enabled --metrics-server Enabled --policy-engine Kyverno --cert-manager Enabled --gitops-engine Flux"
- "--cni Calico --csi Disabled --load-balancer Disabled --metrics-server Disabled --policy-engine Gatekeeper --gitops-engine ArgoCD"
- "--gitops-engine Flux --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- "--gitops-engine ArgoCD --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
exclude:
# init=false primarily validates CLI flag parsing — the provisioner/installer
# logic is the same as init=true. Keep only default and full-stack variants.
- distribution: Vanilla
provider: Docker
init: false
args: "--cni Calico --csi Disabled --load-balancer Disabled --metrics-server Disabled --policy-engine Gatekeeper --gitops-engine ArgoCD"
- distribution: Vanilla
provider: Docker
init: false
args: "--gitops-engine Flux --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: Vanilla
provider: Docker
init: false
args: "--gitops-engine ArgoCD --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: K3s
provider: Docker
init: false
args: "--cni Calico --csi Disabled --load-balancer Disabled --metrics-server Disabled --policy-engine Gatekeeper --gitops-engine ArgoCD"
- distribution: K3s
provider: Docker
init: false
args: "--gitops-engine Flux --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: K3s
provider: Docker
init: false
args: "--gitops-engine ArgoCD --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: Talos
provider: Docker
init: false
args: "--cni Calico --csi Disabled --load-balancer Disabled --metrics-server Disabled --policy-engine Gatekeeper --gitops-engine ArgoCD"
- distribution: Talos
provider: Docker
init: false
args: "--gitops-engine Flux --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: Talos
provider: Docker
init: false
args: "--gitops-engine ArgoCD --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: VCluster
provider: Docker
init: false
args: "--cni Calico --csi Disabled --load-balancer Disabled --metrics-server Disabled --policy-engine Gatekeeper --gitops-engine ArgoCD"
- distribution: VCluster
provider: Docker
init: false
args: "--gitops-engine Flux --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: VCluster
provider: Docker
init: false
args: "--gitops-engine ArgoCD --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
# KWOK: init=false primarily validates CLI flag parsing (same as other distributions).
# Additionally, KWOK suppresses Flux so workload push cannot discover a registry
# via FluxInstance, and init=false provides no ksail.yaml fallback.
# Exclude all non-default init=false args for KWOK, matching other distributions.
- distribution: KWOK
provider: Docker
init: false
args: "--name system-test-cluster --cni Cilium --csi Enabled --load-balancer Enabled --metrics-server Enabled --policy-engine Kyverno --cert-manager Enabled --gitops-engine Flux"
- distribution: KWOK
provider: Docker
init: false
args: "--cni Calico --csi Disabled --load-balancer Disabled --metrics-server Disabled --policy-engine Gatekeeper --gitops-engine ArgoCD"
- distribution: KWOK
provider: Docker
init: false
args: "--gitops-engine Flux --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
- distribution: KWOK
provider: Docker
init: false
args: "--gitops-engine ArgoCD --local-registry ghcr.io/devantler-tech/ksail/system-test-manifests"
include:
- distribution: Talos
provider: Docker
init: true
args: "--name system-test-cluster-with-image-verification --image-verification Enabled"
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: 🧹 Free disk space
# Targeted `rm -rf` of large hosted-tooling directories that the system
# tests do not need. Avoids the slow `apt-get remove` path used by
# endersonmenezes/free-disk-space, which previously consumed 3–9 min per
# job (with apt autoremove pulling in update-initramfs / man-db rebuilds).
# Each directory removal is best-effort: missing paths are not an error.
run: |
set -euo pipefail
before=$(df --output=avail -BG / | tail -1 | tr -dc '0-9')
# Largest offenders on ubuntu-latest (sizes from
# https://github.com/actions/runner-images). Order by descending size.
sudo rm -rf \
/usr/local/lib/android \
/usr/share/dotnet \
/opt/ghc \
/usr/local/share/boost \
/usr/share/swift \
/opt/hostedtoolcache/CodeQL \
/opt/hostedtoolcache/PyPy \
/opt/hostedtoolcache/Ruby \
/opt/hostedtoolcache/Python \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/local/julia* \
/usr/local/aws-cli \
/usr/local/aws-sam-cli \
/usr/share/gradle* \
/usr/share/az* \
/usr/share/miniconda || true
docker system prune -af --volumes || true
after=$(df --output=avail -BG / | tail -1 | tr -dc '0-9')
echo "Free disk space on /: ${before}G -> ${after}G (gained $((after - before))G)"
- name: 🔐 Login to Docker Hub
if: ${{ vars.DOCKERHUB_USERNAME != '' }}
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} # zizmor: ignore[secrets-outside-env] - third-party action input, no environment scoping available
- name: ⚙️ Setup Go
id: setup-go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: false
- name: 📦 Cache KSail Binary
uses: ./.github/actions/cache-ksail-binary
with:
go-version: ${{ steps.setup-go.outputs.go-version }}
source-hash: ${{ hashFiles('go.mod', 'go.sum', '**/*.go') }}
output-path: /usr/local/bin/ksail
save: "false"
- name: 📥 Restore Helm Cache
uses: ./.github/actions/restore-helm-cache
- name: 📥 Restore Mirror Cache
uses: ./.github/actions/restore-mirror-cache
- name: 🧪 Run KSail System Test
uses: ./.github/actions/ksail-system-test
with:
distribution: ${{ matrix.distribution }}
provider: ${{ matrix.provider }}
init: ${{ matrix.init }}
args: ${{ matrix.args }}
apply-overlay-path: ".github/fixtures/podinfo-overlay"
ghcr-user: ${{ github.actor }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
benchmark:
name: 📊 Benchmark
needs: [changes]
if: >-
(github.event_name == 'push' || github.event_name == 'pull_request')
&& needs.changes.outputs.benchmark == 'true'
runs-on: ubuntu-latest
timeout-minutes: 40
permissions:
contents: read
pull-requests: write
outputs:
skip: ${{ steps.discover.outputs.skip }}
steps:
- name: 📄 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: ⚙️ Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: 🔍 Discover benchmark packages
id: discover
shell: bash
run: |
set -euo pipefail
pkgs=$(grep -rl '^func Benchmark' --include='*_test.go' . \