-
Notifications
You must be signed in to change notification settings - Fork 39
1018 lines (857 loc) · 36.5 KB
/
Copy pathci.yml
File metadata and controls
1018 lines (857 loc) · 36.5 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
on:
push:
branches:
- main
- release-*
pull_request: {}
workflow_dispatch: {}
env:
# Common versions
GO_VERSION: '1.26.6'
GOLANGCI_VERSION: 'v2.12.2'
DOCKER_BUILDX_VERSION: 'v0.22.0'
UP_VERSION: 'v0.38.4'
# Registry/Org names
CROSSPLANE_REGORG: 'ghcr.io/crossplane-contrib' # xpkg.crossplane.io/crossplane-contrib
UPBOUND_REGORG: 'xpkg.upbound.io/crossplane-contrib'
PROVIDER_REPO: provider-keycloak
# Upbound registry specific variables
UP_DOMAIN: "https://upbound.io"
# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
# step 'if env.XXX != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
jobs:
detect-noop:
runs-on: ubuntu-24.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
# true only when BOTH e2e suites are skipped (gates the provider build)
skip-e2e: ${{ steps.e2e-scope.outputs.skip }}
# DAG-derived e2e tier + Keycloak matrix (the demo subset itself is
# recomputed in the e2e-tests job so it is visible per run)
e2e-tier: ${{ steps.e2e-scope.outputs.tier }}
e2e-keycloak-versions: ${{ steps.e2e-scope.outputs.keycloak_versions }}
# FGAPv2 suite runs in its own cluster and is selected independently
e2e-fgapv2: ${{ steps.e2e-scope.outputs.fgapv2 }}
steps:
- name: Detect No-op Changes
id: noop
uses: fkirc/skip-duplicate-actions@b974a9395958c231af965b70070979a577efa578 # v5.3.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Compute E2E scope via DAG
id: e2e-scope
run: |
# Full Keycloak version matrix (all supported releases)
ALL_VERSIONS='["26.7.0","26.6.2","26.5.1","26.4.4","26.3.5","26.2.5","26.1.5","26.0.8"]'
LATEST_VERSION='["26.7.0"]'
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
if echo "$COMMIT_MESSAGE" | grep -iq "\[skip e2e\]"; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "tier=skip" >> "$GITHUB_OUTPUT"
echo "keycloak_versions=[]" >> "$GITHUB_OUTPUT"
echo "fgapv2=false" >> "$GITHUB_OUTPUT"
echo "[skip e2e] found in commit message — skipping all e2e tests"
exit 0
fi
# On non-PR events (push to main, workflow_dispatch) always run full
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "tier=full" >> "$GITHUB_OUTPUT"
echo "keycloak_versions=${ALL_VERSIONS}" >> "$GITHUB_OUTPUT"
echo "fgapv2=true" >> "$GITHUB_OUTPUT"
echo "Non-PR event — running full e2e suite against all Keycloak versions"
exit 0
fi
# Compute changed files for the PR, always relative to main
git fetch --no-tags origin main:refs/remotes/origin/main
MERGE_BASE=$(git merge-base origin/main HEAD)
echo "Comparing against main (merge base ${MERGE_BASE})"
CHANGED_FILES=$(git diff --name-only "${MERGE_BASE}" HEAD)
echo "Changed files:"
echo "$CHANGED_FILES"
# Use the DAG script to determine tier + demo subset. The proof
# (which changed file matched which rule, and why each demo was
# selected) is written to the job summary.
TIER=$(echo "$CHANGED_FILES" | \
python3 scripts/e2e_dag.py select --changed-files - \
--proof-file /tmp/e2e_proof.md 2>/tmp/e2e_dag_stderr.txt)
cat /tmp/e2e_dag_stderr.txt
cat /tmp/e2e_proof.md >> "$GITHUB_STEP_SUMMARY"
echo "DAG stdout (tier/list): $TIER"
# The FGAPv2 suite runs in its own cluster (admin-fine-grained-authz:v2
# excludes the v1 feature the regular suite needs), so it is selected
# independently of the regular suite.
FGAPV2=$(echo "$CHANGED_FILES" | \
python3 scripts/e2e_dag.py select-fgapv2 --changed-files - \
--proof-file /tmp/e2e_proof_fgapv2.md 2>/tmp/e2e_dag_fgapv2_stderr.txt)
cat /tmp/e2e_dag_fgapv2_stderr.txt
cat /tmp/e2e_proof_fgapv2.md >> "$GITHUB_STEP_SUMMARY"
echo "DAG stdout (fgapv2): $FGAPV2"
if [ "$FGAPV2" = "run" ]; then
echo "fgapv2=true" >> "$GITHUB_OUTPUT"
else
echo "fgapv2=false" >> "$GITHUB_OUTPUT"
fi
if [ "$TIER" = "skip" ]; then
# Only skip the provider build when neither suite has anything to run
if [ "$FGAPV2" = "run" ]; then
echo "skip=false" >> "$GITHUB_OUTPUT"
else
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
echo "tier=skip" >> "$GITHUB_OUTPUT"
echo "keycloak_versions=[]" >> "$GITHUB_OUTPUT"
echo "No e2e-relevant changes for the regular suite — skipping it"
elif [ "$TIER" = "full" ]; then
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "tier=full" >> "$GITHUB_OUTPUT"
echo "keycloak_versions=${ALL_VERSIONS}" >> "$GITHUB_OUTPUT"
echo "Full tier — running all demos against all Keycloak versions"
else
# targeted: TIER contains a comma-separated list of demo paths
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "tier=targeted" >> "$GITHUB_OUTPUT"
echo "keycloak_versions=${LATEST_VERSION}" >> "$GITHUB_OUTPUT"
DEMO_COUNT=$(echo "$TIER" | tr ',' '\n' | wc -l)
echo "Targeted tier — running ${DEMO_COUNT} demos against latest Keycloak only"
fi
lint:
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-lint-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-lint-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
# We could run 'make lint' but we prefer this action because it leaves
# 'annotations' (i.e. it comments on PRs to point out linter violations).
- name: Lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9
with:
version: ${{ env.GOLANGCI_VERSION }}
verify: false
check-diff:
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-check-diff-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Validate E2E Case Coverage
run: make e2e-cases-check
- name: Check config/generated.lst Freshness
run: make generated-lst-check
- name: Check Diff
run: make check-diff
unit-tests:
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Fetch History
run: git fetch --prune --tags --unshallow || git fetch --prune --tags
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-unit-tests-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Run Unit Tests
run: make -j2 test
- name: Publish Unit Test Coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
with:
flags: unittests
file: _output/tests/linux_amd64/coverage.txt
local-deploy:
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Fetch History
run: git fetch --prune --tags --unshallow || git fetch --prune --tags
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-unit-tests-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Deploying locally built provider package
run: make local-deploy
build-provider:
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true' && needs.detect-noop.outputs.skip-e2e != 'true'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-e2e-provider-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-e2e-provider-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Build Provider
run: make build BUILD_REGISTRY=ci-build
- name: Export Provider Image
run: |
docker save ci-build/provider-keycloak-amd64 -o /tmp/provider-image.tar
- name: Upload Provider Image
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: provider-image
path: /tmp/provider-image.tar
retention-days: 7
- name: Upload Provider Package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: provider-xpkg
path: _output/xpkg/linux_amd64/
retention-days: 7
e2e-tests:
runs-on: ubuntu-24.04
needs: [detect-noop, build-provider]
if: needs.detect-noop.outputs.noop != 'true' && needs.detect-noop.outputs.e2e-tier != 'skip'
concurrency:
group: ${{ github.head_ref || github.run_id }}-${{ matrix.keycloak-version }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
keycloak-version: ${{ fromJSON(needs.detect-noop.outputs.e2e-keycloak-versions) }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Calculate E2E test selection
id: select
shell: bash
env:
E2E_TIER: ${{ needs.detect-noop.outputs.e2e-tier }}
run: |
set -o pipefail
if [ "${E2E_TIER}" != "targeted" ]; then
echo "demos=" >> "$GITHUB_OUTPUT"
echo "### E2E selection: ${E2E_TIER} — running all demos" >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
# Always compare against main
git fetch --no-tags origin main:refs/remotes/origin/main
MERGE_BASE=$(git merge-base origin/main HEAD)
echo "Comparing against main (merge base ${MERGE_BASE})"
DEMOS=$(git diff --name-only "${MERGE_BASE}" HEAD | \
python3 scripts/e2e_dag.py select --changed-files - \
--proof-file /tmp/e2e_proof.md)
# Always publish the proof: which file matched which rule, and why
# each demo ended up in the selection.
cat /tmp/e2e_proof.md >> "$GITHUB_STEP_SUMMARY"
if [ "${DEMOS}" = "full" ] || [ "${DEMOS}" = "skip" ] || [ -z "${DEMOS}" ]; then
echo "demos=" >> "$GITHUB_OUTPUT"
echo "### E2E selection: fallback — running all demos" >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
echo "demos=${DEMOS}" >> "$GITHUB_OUTPUT"
echo "${DEMOS}" | tr ',' '\n'
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-unit-tests-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Download Provider Image
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: provider-image
path: /tmp
- name: Download Provider Package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: provider-xpkg
path: _output/xpkg/linux_amd64/
- name: Load Provider Image
run: docker load -i /tmp/provider-image.tar
- name: Pre-pull container images
run: |
docker pull quay.io/keycloak/keycloak:${{ matrix.keycloak-version }} &
docker pull docker.io/bitnamilegacy/openldap:2.6.10 &
wait
- name: Starting testsetup for E2E Tests
id: setup
continue-on-error: true
run: |
set -o pipefail
mkdir -p logs
./dev/setup_dev_environment.sh --cluster-name fenrir-1 --deploy-local-provider --direct-helm --keycloak-version ${{ matrix.keycloak-version }} | tee logs/setup-environment.log
env:
PROVIDER_PREBUILT: "true"
- name: Collect setup logs
if: steps.setup.outcome == 'failure'
shell: bash
run: |
kind export kubeconfig --name fenrir-1 || true
./dev/collect-logs.sh || true
- name: Upload setup logs
if: steps.setup.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: e2e-setup-logs-${{ matrix.keycloak-version }}
path: |
logs/
- name: Fail on setup error
if: steps.setup.outcome == 'failure'
run: exit 1
- name: Verify kind cluster exists
run: |
echo "Checking for kind cluster fenrir-1..."
kind get clusters
if ! kind get clusters | grep -q "fenrir-1"; then
echo "ERROR: kind cluster fenrir-1 was not created"
exit 1
fi
- name: Set kind cluster as context
run: kind export kubeconfig --name fenrir-1
- name: Running E2E Tests
id: e2eTests
continue-on-error: true
shell: bash
env:
KEYCLOAK_VERSION: ${{ matrix.keycloak-version }}
E2E_DEMO_LIST: ${{ steps.select.outputs.demos }}
E2E_TIER: ${{ needs.detect-noop.outputs.e2e-tier }}
run: |
set -o pipefail
echo "E2E tier: ${E2E_TIER}"
if [ -n "${E2E_DEMO_LIST}" ]; then
echo "Targeted mode: running $(echo "${E2E_DEMO_LIST}" | tr ',' '\n' | wc -l) demos"
make uptest KEYCLOAK_VERSION="${KEYCLOAK_VERSION}" UPTEST_EXAMPLE_LIST="${E2E_DEMO_LIST}" | tee logs/uptest.log
else
echo "Full mode: running all demos"
make uptest KEYCLOAK_VERSION="${KEYCLOAK_VERSION}" | tee logs/uptest.log
fi
- name: Collect logs
if: steps.e2eTests.outcome == 'failure'
shell: bash
run: ./dev/collect-logs.sh
- name: Upload logs
if: steps.e2eTests.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: e2e-logs-${{ matrix.keycloak-version }}
path: |
logs/
- name: Fail on error
if: steps.e2eTests.outcome == 'failure'
run: exit 1
# Controller-focused e2e tests using Kyverno chainsaw directly.
# These exercise hand-written controllers (currently: connectionsecrettransform)
# in a real kind cluster with Keycloak and the provider running, and with
# Envoy Gateway + Traefik deployed as actual OIDC consumers that validate
# the secrets the controller produces.
#
# Runs on every PR against main when the controller code or tests change.
# Always runs on push to main.
e2e-controller-tests:
runs-on: ubuntu-24.04
needs: [detect-noop, build-provider]
if: needs.detect-noop.outputs.noop != 'true'
concurrency:
group: ${{ github.head_ref || github.run_id }}-controller-e2e
cancel-in-progress: true
permissions:
contents: read
env:
CONTROLLER_E2E_KEYCLOAK_VERSION: "26.7.0"
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-controller-e2e-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-controller-e2e-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Download Provider Image
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: provider-image
path: /tmp
- name: Download Provider Package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: provider-xpkg
path: _output/xpkg/linux_amd64/
- name: Load Provider Image
run: docker load -i /tmp/provider-image.tar
- name: Pull Keycloak Image
run: docker pull quay.io/keycloak/keycloak:${{ env.CONTROLLER_E2E_KEYCLOAK_VERSION }}
- name: Starting test environment
id: setup
continue-on-error: true
run: |
set -o pipefail
mkdir -p logs
./dev/setup_dev_environment.sh \
--cluster-name fenrir-1 \
--deploy-local-provider \
--direct-helm \
--keycloak-version ${{ env.CONTROLLER_E2E_KEYCLOAK_VERSION }} \
| tee logs/setup-environment.log
env:
PROVIDER_PREBUILT: "true"
- name: Collect setup logs on failure
if: steps.setup.outcome == 'failure'
run: |
kind export kubeconfig --name fenrir-1 || true
./dev/collect-logs.sh || true
- name: Upload setup logs
if: steps.setup.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: controller-e2e-setup-logs
path: logs/
- name: Fail on setup error
if: steps.setup.outcome == 'failure'
run: exit 1
- name: Set kind cluster as context
run: kind export kubeconfig --name fenrir-1
- name: Running controller e2e tests
id: controllerE2e
continue-on-error: true
run: |
set -o pipefail
make controller-e2e | tee logs/controller-e2e.log
- name: Collect controller e2e logs on failure
if: steps.controllerE2e.outcome == 'failure'
run: |
kind export kubeconfig --name fenrir-1 || true
./dev/collect-logs.sh || true
- name: Upload controller e2e logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: controller-e2e-logs
path: logs/
- name: Fail on test error
if: steps.controllerE2e.outcome == 'failure'
run: exit 1
# Fine-grained admin permissions v2 (FGAPv2) resources need Keycloak to run
# with the admin-fine-grained-authz:v2 feature. That feature replaces the v1
# feature the regular e2e suite depends on, so these demos get their own
# cluster and only run the cases listed in cluster/test/cases-fgapv2.txt.
e2e-tests-fgapv2:
runs-on: ubuntu-24.04
needs: [detect-noop, build-provider]
if: needs.detect-noop.outputs.noop != 'true' && needs.detect-noop.outputs.e2e-fgapv2 == 'true'
concurrency:
group: ${{ github.head_ref || github.run_id }}-fgapv2
cancel-in-progress: true
permissions:
contents: read
env:
FGAP_KEYCLOAK_VERSION: "26.7.0"
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-unit-tests-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Download Provider Image
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: provider-image
path: /tmp
- name: Download Provider Package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: provider-xpkg
path: _output/xpkg/linux_amd64/
- name: Load Provider Image
run: docker load -i /tmp/provider-image.tar
- name: Pre-pull container images
run: docker pull quay.io/keycloak/keycloak:${{ env.FGAP_KEYCLOAK_VERSION }}
- name: Starting testsetup for E2E Tests
id: setup
continue-on-error: true
run: |
set -o pipefail
mkdir -p logs
./dev/setup_dev_environment.sh --cluster-name fenrir-1 --deploy-local-provider --direct-helm --keycloak-version ${{ env.FGAP_KEYCLOAK_VERSION }} --fgap-version v2 | tee logs/setup-environment.log
env:
PROVIDER_PREBUILT: "true"
- name: Collect setup logs
if: steps.setup.outcome == 'failure'
shell: bash
run: |
kind export kubeconfig --name fenrir-1 || true
./dev/collect-logs.sh || true
- name: Upload setup logs
if: steps.setup.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: e2e-setup-logs-fgapv2
path: |
logs/
- name: Fail on setup error
if: steps.setup.outcome == 'failure'
run: exit 1
- name: Set kind cluster as context
run: kind export kubeconfig --name fenrir-1
- name: Running E2E Tests
id: e2eTests
continue-on-error: true
shell: bash
run: |
set -o pipefail
make uptest KEYCLOAK_VERSION="${{ env.FGAP_KEYCLOAK_VERSION }}" FGAP_VERSION=v2 | tee logs/uptest.log
- name: Collect logs
if: steps.e2eTests.outcome == 'failure'
shell: bash
run: ./dev/collect-logs.sh
- name: Upload logs
if: steps.e2eTests.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: e2e-logs-fgapv2
path: |
logs/
- name: Fail on error
if: steps.e2eTests.outcome == 'failure'
run: exit 1
publish-artifacts:
runs-on: ubuntu-24.04
needs: [detect-noop, lint, check-diff, unit-tests, local-deploy, e2e-tests, e2e-tests-fgapv2]
if: |
needs.detect-noop.outputs.noop != 'true' && needs.lint.result == 'success' && needs.check-diff.result == 'success' && needs.unit-tests.result == 'success' && needs.local-deploy.result == 'success' &&
(always() && (needs.e2e-tests.result == 'success' || needs.e2e-tests.result == 'skipped' || needs.detect-noop.outputs.skip-e2e == 'true')) &&
(always() && (needs.e2e-tests-fgapv2.result == 'success' || needs.e2e-tests-fgapv2.result == 'skipped' || needs.detect-noop.outputs.skip-e2e == 'true'))
outputs:
version: ${{ steps.version.outputs.VERSION }}
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true
- name: Login to GHCR using PAT
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Find the version
id: version
run: make common.buildvars >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-publish-artifacts-
- name: Cache Go Dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Cache Build Tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cache/tools
key: ${{ runner.os }}-${{ runner.arch }}-tools-${{ hashFiles('Makefile', 'build/makelib/**/*.mk') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-tools-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Build Artifacts
run: |-
make -j2 XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME="main" VERSION="${{ steps.version.outputs.VERSION }}" build.all
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load --cache-from type=gha --cache-to type=gha,mode=max"
- name: Upload Artifacts to GitHub
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: output
path: _output/**
- name: Publish Artifacts
run: |-
make -j2 XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME="main" VERSION="${{ steps.version.outputs.VERSION }}" publish
mirror-to-xpkg-upbound-io:
needs: publish-artifacts
runs-on: ubuntu-24.04
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true