-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
1344 lines (1242 loc) · 38.4 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
1344 lines (1242 loc) · 38.4 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
variables:
ORBIT_TELEMETRY_ENABLED: "false"
CANONICAL_PROJECT_ID: "77960826"
SECURITY_PROJECT_ID: "80999258"
CLICKHOUSE_VERSION: "26.2"
DEV_PREFIX: "dev"
GCLOUD_PROJECT: gitlab-ci-runners-signing
SERVICE_ACCOUNT: gitlab-orbit-kg-signer@gitlab-ci-runners-signing.iam.gserviceaccount.com
WI_POOL_PROVIDER: //iam.googleapis.com/projects/8522242139/locations/global/workloadIdentityPools/gitlab-pool-oidc-$CI_PROJECT_ID/providers/gitlab-jwt-$CI_PROJECT_ID
RUNNER_LARGE: saas-linux-large-amd64
RUNNER_LARGE_ARM: saas-linux-large-arm64
workflow:
rules:
# Security fork
- if: $CI_PROJECT_ID == $SECURITY_PROJECT_ID && $CI_COMMIT_TAG
variables:
DEV_PREFIX: "sec"
- if: $CI_PROJECT_ID == $SECURITY_PROJECT_ID && $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
DEV_PREFIX: "sec"
- if: $CI_PROJECT_ID == $SECURITY_PROJECT_ID && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^chore\(release\)/
when: never
- if: $CI_PROJECT_ID == $SECURITY_PROJECT_ID && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
DEV_PREFIX: "sec"
# Non-canonical (other forks)
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID && $CI_COMMIT_TAG
variables:
RUNNER_LARGE: saas-linux-medium-amd64
RUNNER_LARGE_ARM: saas-linux-medium-arm64
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID && $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
RUNNER_LARGE: saas-linux-medium-amd64
RUNNER_LARGE_ARM: saas-linux-medium-arm64
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^chore\(release\)/
when: never
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
RUNNER_LARGE: saas-linux-medium-amd64
RUNNER_LARGE_ARM: saas-linux-medium-arm64
# Canonical project — original behavior
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /^chore\(release\)/
when: never
# Security-template jobs can't reference .skip-on-solo-schedule, so solo
# schedules mute them through their documented kill-switch variables.
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_ONLY != ""
variables:
SAST_DISABLED: "true"
SECRET_DETECTION_DISABLED: "true"
DEPENDENCY_SCANNING_DISABLED: "true"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
include:
- template: Jobs/SAST.gitlab-ci.yml
- template: Jobs/Secret-Detection.gitlab-ci.yml
- local: .gitlab/ci/release-local.yml
- local: .gitlab/ci/stale-mr.yml
- local: .gitlab/ci/e2e-pin-bump.yml
- local: .gitlab/ci/release-deploy-mr.yml
- local: .gitlab/ci/comment-guard.yml
- project: 'gitlab-com/gl-security/security-operations/infrastructure-security-public/oidc-modules'
ref: '3.3.0'
file: 'templates/gcp_auth.yaml'
- project: 'gitlab-org/orbit/experiments/ai-review-bot'
file: '/template.yml'
- component: ${CI_SERVER_FQDN}/gitlab-org/orbit/experiments/ai-review-bot/ai-review-bot@main
inputs:
automatic: manual
labels_enabled: "false"
model: "anthropic/claude-opus-4-8"
variant: "high"
stages:
- lint
- docs
- security
- test
- benchmark
- ai
- build
- e2e
- publish
- release
- review
# Job Templates
.job-template:
tags:
- saas-linux-medium-amd64
image: registry.gitlab.com/gitlab-org/rust/build-images/orbit-knowledge-graph:latest
variables:
MISE_DISABLE_TOOLS: lefthook
before_script:
- mise install
.sccache-template:
variables:
CARGO_INCREMENTAL: "0"
SCCACHE_GCS_BUCKET: "gl-knowledgegraph-sccache"
SCCACHE_GCS_KEY_PATH: "${SCCACHE_GCS_KEY}"
SCCACHE_GCS_RW_MODE: "READ_WRITE"
DUCKDB_DOWNLOAD_LIB: "1"
before_script:
- mise install
- |
if [ -n "${SCCACHE_GCS_KEY}" ]; then
export RUSTC_WRAPPER="sccache"
sccache --start-server || true
fi
.test-template:
extends:
- .job-template
- .sccache-template
variables:
RUST_BACKTRACE: "1"
artifacts:
when: always
reports:
junit:
- target/nextest/ci/junit.xml
# Identity for jobs acting as the Orbit automation bot (infra-mgmt!3039): the
# glab image plus the bot token from Vault, readable on protected refs only.
# Extend it and add your own rules, needs, and script.
.automation-bot:
image: registry.gitlab.com/gitlab-org/cli:v1.102.0
tags:
- saas-linux-small-amd64
id_tokens:
VAULT_ID_TOKEN:
aud: https://vault.gitlab.net
secrets:
AUTOMATION_BOT_TOKEN:
file: false
vault: access_tokens/${VAULT_SECRETS_PATH}/automation-bot/token@ci
token: $VAULT_ID_TOKEN
# "Solo" scheduled pipelines run exactly one job and skip the rest of the CI
# suite. A schedule opts in by setting SCHEDULE_ONLY=<job-name>: the named job
# gates on that value, and every shared job/anchor references this guard so it
# drops out. Adding a new solo schedule needs no edits to existing jobs here.
.skip-on-solo-schedule:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_ONLY != ""
when: never
.mr-only-rules:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
.mr-and-main-rules:
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
.canonical-only-rules:
rules:
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID
when: never
.canonical-mr-only-rules:
rules:
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
.canonical-main-only-rules:
rules:
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# Lint Stage
agent-file-sync-check:
stage: lint
image: alpine:latest
tags:
- saas-linux-medium-amd64
extends:
- .mr-and-main-rules
needs: []
script:
- diff AGENTS.md CLAUDE.md || (echo "AGENTS.md and CLAUDE.md are out of sync. Please ensure they have identical content." && exit 1)
mr-title-check:
stage: lint
image: node:26-alpine
tags:
- saas-linux-medium-amd64
extends:
- .mr-only-rules
before_script:
- npm ci --ignore-scripts
script:
- ./scripts/check-mr-title.sh
ontology-schema-validate:
stage: lint
image: ghcr.io/astral-sh/uv:python3.12-alpine
tags:
- saas-linux-medium-amd64
extends:
- .mr-and-main-rules
needs: []
script:
- test "$(wc -c < config/schemas/ontology.schema.json)" -le 65536 || (echo "config/schemas/ontology.schema.json must stay at or below 64 KB" && exit 1)
- find config/ontology -name '*.yaml' ! -name 'reference.yaml' | xargs uvx check-jsonschema --verbose --schemafile config/schemas/ontology.schema.json
named-query-schema-validate:
stage: lint
image: ghcr.io/astral-sh/uv:python3.12-alpine
tags:
- saas-linux-medium-amd64
extends:
- .mr-and-main-rules
needs: []
script:
- find config/named_queries -name '*.yaml' | xargs uvx check-jsonschema --verbose --schemafile config/schemas/named_query.schema.json
migration-ledger-schema-validate:
stage: lint
image: ghcr.io/astral-sh/uv:python3.12-alpine
tags:
- saas-linux-medium-amd64
extends:
- .mr-and-main-rules
needs: []
script:
- uvx check-jsonschema --verbose --schemafile config/schemas/schema-migrations.schema.json config/schema-migrations.yaml
indexer-scenario-schema-validate:
stage: lint
image: ghcr.io/astral-sh/uv:python3.12-alpine
tags:
- saas-linux-medium-amd64
extends:
- .mr-and-main-rules
needs: []
script:
- find crates/integration-tests/tests/indexer/scenarios -name '*.yaml' | xargs uvx check-jsonschema --verbose --schemafile config/schemas/indexer_scenario.schema.json
setup-schema-validate:
stage: lint
image: ghcr.io/astral-sh/uv:python3.12-alpine
tags:
- saas-linux-medium-amd64
extends:
- .mr-and-main-rules
needs: []
script:
- find config/setup/agents -name '*.yaml' | xargs uvx check-jsonschema --verbose --schemafile config/schemas/setup_agent.schema.json
- uvx check-jsonschema --verbose --schemafile config/schemas/setup.schema.json config/setup/setup.yaml
generate-config-schema:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-and-main-rules
needs: []
script:
- mise run schema:generate
- git diff --exit-code config/schemas/config.schema.json || (echo "config/schemas/config.schema.json is out of date. Run 'mise schema:generate' and commit." && exit 1)
artifacts:
paths:
- config/schemas/config.schema.json
expire_in: 24 hours
rust-toolchain-sync-check:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-and-main-rules
needs: []
script:
- mise run toolchain:check
metrics-catalog-check:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-and-main-rules
needs: []
script:
- mise run metrics:catalog:check
dashboards-check:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-and-main-rules
needs: []
script:
- mise run dashboards:check
query-language-docs-check:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-and-main-rules
needs: []
script:
- mise run docs:query-language:check
ddl-freshness-check:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-and-main-rules
needs: []
script:
- bash ./scripts/check-ddl-freshness.sh
migration-ledger-check:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-only-rules
needs: []
script:
- git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" --depth=1
- bash ./scripts/check-migration-ledger.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
pinned-version-check:
stage: lint
image: alpine:latest
tags:
- saas-linux-medium-amd64
extends:
- .mr-only-rules
needs: []
script:
- apk add --no-cache git bash
- git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" --depth=1
- bash ./scripts/check-pinned-version.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
skill-version-bump-check:
stage: lint
image: python:3.12-alpine
tags:
- saas-linux-medium-amd64
extends:
- .mr-only-rules
needs: []
script:
- apk add --no-cache git
- |
if ! git fetch origin "$CI_MERGE_REQUEST_DIFF_BASE_SHA" --depth=1; then
git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" --depth=50
export BASE_REF_OVERRIDE="origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
fi
python3 scripts/check-skill-version-bump.py --ci --no-worktree ${BASE_REF_OVERRIDE:+--base-ref "$BASE_REF_OVERRIDE"}
prompt-version-bump-check:
stage: lint
image: alpine:latest
tags:
- saas-linux-medium-amd64
extends:
- .mr-only-rules
needs: []
script:
- apk add --no-cache git
- |
if ! git fetch origin "$CI_MERGE_REQUEST_DIFF_BASE_SHA" --depth=1; then
git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" --depth=50
export CI_MERGE_REQUEST_DIFF_BASE_SHA="origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
fi
sh scripts/check-prompt-version-bump.sh
iglu-schema-check:
stage: lint
image: alpine:latest
tags:
- saas-linux-medium-amd64
extends:
- .mr-only-rules
needs: []
# Full check (local file vs upstream content from the public Iglu
# Pages CDN). Drift between committed schema JSON and upstream fails
# the job.
script:
- apk add --no-cache bash curl python3
- bash ./scripts/iglu/check.sh
system-note-actions-check:
stage: lint
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
tags:
- saas-linux-medium-amd64
extends:
- .mr-only-rules
needs: []
# Verifies config/vendored/system_note_metadata.actions matches Rails
# SystemNoteMetadata::ICON_TYPES at the pinned commit SHA.
script:
- apk add --no-cache bash curl python3
- bash ./scripts/check-system-note-actions.sh
duckdb-fts-sources-sync-check:
stage: lint
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
tags:
- saas-linux-medium-amd64
extends:
- .mr-only-rules
needs: []
script:
- apk add --no-cache bash git gzip tar
- bash ./scripts/duckdb/check-duckdb-fts-sources-sync.sh
unused-deps-check:
stage: lint
extends:
- .job-template
- .mr-and-main-rules
needs: []
script:
- cargo shear
fmt-check:
stage: lint
extends:
- .job-template
- .mr-only-rules
script:
- cargo fmt --all -- --check
newline-check:
stage: lint
extends:
- .job-template
- .mr-only-rules
script:
- mise run lint:newlines
lint-check:
stage: lint
extends:
- .job-template
- .sccache-template
- .mr-only-rules
script:
- cargo clippy --workspace --exclude duckdb-client --all-targets --all-features -- -D warnings
- cargo clippy -p duckdb-client --all-targets -- -D warnings
- sccache --show-stats || true
# Security Stage
cargo-audit:
stage: security
extends:
- .job-template
- .mr-and-main-rules
needs: []
script:
- cargo audit
cargo-deny:
stage: security
extends:
- .job-template
- .mr-and-main-rules
needs: []
script:
- cargo deny check
cargo-geiger:
stage: security
extends:
- .job-template
- .mr-and-main-rules
needs: []
script:
- cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name' | while IFS= read -r pkg; do
if [ "$pkg" = "duckdb-client" ]; then cargo geiger -p "$pkg" || true;
else cargo geiger -p "$pkg" --all-features || true; fi;
done
allow_failure: true
generate-sbom:
stage: security
extends:
- .job-template
needs: []
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- cargo cyclonedx --format json > sbom.cdx.json
artifacts:
paths:
- sbom.cdx.json
reports:
cyclonedx: sbom.cdx.json
semgrep-sast:
stage: security
needs: []
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
exists:
- "**/*.rs"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
exists:
- "**/*.rs"
gitlab-advanced-sast:
stage: security
needs: []
# Override the default secret_detection rules so the job runs on MR pipelines.
# The Jobs/Secret-Detection.gitlab-ci.yml template defaults to branch pipelines
# only, which conflicts with this project's workflow (MR + main branch only).
secret_detection:
stage: security
needs: []
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# Docs stage
check_docs_markdown:
stage: docs
extends:
- .mr-only-rules
image: registry.gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/lint-markdown:alpine-3.23-vale-3.14.1-markdownlint2-0.22.1-lychee-0.24.2
script:
# Lint prose
- vale --minAlertLevel error docs/source
# Lint Markdown. docs/source is user-facing; root and docs/dev are contributor
# docs that previously reached CI unlinted (design-documents deferred: #981).
- markdownlint-cli2 '*.md' 'docs/dev/**/*.md' 'docs/source/**/*.md'
# Check links
- lychee --offline --include-fragments docs/source/**/*.md
check_docs_i18n_markdown:
stage: docs
image: registry.gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/lint-markdown:alpine-3.23-vale-3.14.1-markdownlint2-0.22.1-lychee-0.24.2
parallel:
matrix:
- LOCALE_CODE: ["fr-fr", "ja-jp", "ko-kr"]
rules:
- if: $CI_MERGE_REQUEST_IID
changes:
- docs-locale/${LOCALE_CODE}/**/*
script:
# Lint prose
- vale --config="docs-locale/${LOCALE_CODE}/.vale.ini" --minAlertLevel error docs-locale/${LOCALE_CODE}/source/
# Lint Markdown
- markdownlint-cli2 "docs-locale/${LOCALE_CODE}/source/**/*.md"
# Check links
- lychee --offline --include-fragments docs-locale/${LOCALE_CODE}/source/**/*.md
docs_hugo_build:
image: registry.gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/docs-gitlab-com-builder:hugo-0.154.5
stage: docs
extends:
- .mr-only-rules
variables:
DOCS_BRANCH: "main"
before_script:
# Check if this a release branch, which would be the case for a backport.
# If this is a backport MR, we need to checkout the appropriate version
# of the Docs website.
- |
if [[ $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ [0-9]+-[0-9]+-stable ]]; then
BRANCH_NAME=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
echo "Detected merge request to stable branch: $BRANCH_NAME"
# Check if we're directly on a stable branch (direct push/commit)
elif [[ $CI_COMMIT_BRANCH =~ [0-9]+-[0-9]+-stable ]]; then
BRANCH_NAME=$CI_COMMIT_BRANCH
echo "Detected direct commit to stable branch: $BRANCH_NAME"
fi
# Extract version info if we found a stable branch
if [[ -n $BRANCH_NAME ]]; then
MAJOR=$(echo $BRANCH_NAME | cut -d '-' -f 1)
MINOR=$(echo $BRANCH_NAME | cut -d '-' -f 2)
# Convert GitLab style (17-9-stable-ee) to Docs style (17.9)
DOCS_BRANCH_CANDIDATE="$MAJOR.$MINOR"
# Check if the branch exists in the Docs website repo, fallback to main if not
if git ls-remote --heads --exit-code https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com.git "refs/heads/$DOCS_BRANCH_CANDIDATE" >/dev/null 2>&1; then
DOCS_BRANCH="$DOCS_BRANCH_CANDIDATE"
echo "Using docs-gitlab-com branch $DOCS_BRANCH for release branch"
else
DOCS_BRANCH="main"
echo "Branch $DOCS_BRANCH_CANDIDATE does not exist, falling back to main"
fi
fi
# Clone the Docs website project
- git clone --depth 1 --filter=tree:0 --branch $DOCS_BRANCH https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com.git
- cd docs-gitlab-com
- make add-latest-icons
script:
# Test that Hugo will build
- hugo --gc --printPathWarnings --panicOnWarning --environment test
# Test for invalid index pages
# See https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/-/blob/main/scripts/check-index-filenames.sh
- make check-index-pages SEARCH_DIR="../docs/source"
#- make check-index-pages SEARCH_DIR="../doc-locale/source" # Enable when translation is added
# Test Stage
unit-test:
stage: test
extends:
- .test-template
- .mr-and-main-rules
tags:
- ${RUNNER_LARGE}
needs: []
script:
- ./scripts/run-unit-tests.sh --profile ci
- sccache --show-stats || true
compiler-integration-test:
stage: test
extends:
- .test-template
- .mr-and-main-rules
needs: []
script:
- cargo nextest run --profile ci -p integration-tests --test local --no-fail-fast
- sccache --show-stats || true
billing-boundary-check:
stage: test
extends:
- .test-template
- .mr-and-main-rules
needs: []
script:
- cargo nextest run --profile ci -p integration-tests --test billing_boundary
- sccache --show-stats || true
integration-tests-codegraph:
stage: test
extends:
- .test-template
- .mr-and-main-rules
needs: []
script:
- cargo nextest run --profile ci -p integration-tests-codegraph --no-fail-fast
- sccache --show-stats || true
cli-integration-test:
stage: test
extends:
- .test-template
- .mr-and-main-rules
needs: []
script:
- cargo build -p orbit-cli
- cargo nextest run --profile ci --test cli --no-fail-fast
- sccache --show-stats || true
integration-test:
stage: test
extends:
- .test-template
- .mr-and-main-rules
tags:
- ${RUNNER_LARGE}
services:
- name: docker:dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
TESTCONTAINERS_HOST_OVERRIDE: docker
needs: []
before_script:
- !reference [.sccache-template, before_script]
- |
docker pull clickhouse/clickhouse-server:${CLICKHOUSE_VERSION} &
docker pull nats:2.11-alpine &
wait
script:
# corpus-smoke runs as its own parallel job below.
- cargo nextest run --profile ci --all-features --test containers -E 'not test(corpus_smoke)'
- sccache --show-stats || true
corpus-smoke-test:
stage: test
extends:
- .test-template
- .mr-and-main-rules
tags:
- ${RUNNER_LARGE}
services:
- name: docker:dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
TESTCONTAINERS_HOST_OVERRIDE: docker
needs: []
before_script:
- !reference [.sccache-template, before_script]
- docker pull clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}
script:
# Smoke test: every query in fixtures/queries/corpus/ compiles + runs
# against a real ClickHouse schema (no correctness assertions).
- cargo nextest run --profile ci --all-features --test containers -E 'test(corpus_smoke)'
- sccache --show-stats || true
# Benchmark Stage
#
# Runs code indexing benchmarks when indexing crates change.
# Repos are auto-downloaded by gitlab-xtasks from the benchmark config.
.code-indexing-benchmark-rules:
rules:
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- crates/orbit-cli/**/*
- crates/code-graph/**/*
- crates/ontology/**/*
- crates/duckdb-client/**/*
- crates/utils/**/*
- code-indexing-benchmark.yaml
- .gitlab-ci.yml
code-indexing-benchmark-build:
stage: benchmark
needs: []
extends:
- .job-template
- .sccache-template
- .code-indexing-benchmark-rules
interruptible: true
tags:
- ${RUNNER_LARGE}
script:
- cargo build --bin orbit --release --features duckdb-client/bundled
artifacts:
paths:
- target/release/orbit
expire_in: 1 day
.code-indexing-benchmark-template:
stage: benchmark
needs:
- code-indexing-benchmark-build
extends:
- .code-indexing-benchmark-rules
interruptible: true
cache:
key: "benchmark-repos-${GROUP}"
paths:
- temp/
policy: pull-push
when: always
variables:
SCENARIO: index
script:
- |
OUTPUT_FILE="gkg-benchmark-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}-${ARCH}-${SCENARIO}-${GROUP}.json"
for attempt in 1 2 3; do
if gitlab-xtasks benchmark download-repos \
--config code-indexing-benchmark.yaml \
--output-dir temp \
--group "$GROUP"; then
break
fi
if [ "$attempt" = "3" ]; then
exit 1
fi
delay="$((attempt * 30))"
echo "Repository download failed; retrying in ${delay}s."
sleep "$delay"
done
gitlab-xtasks benchmark hyperfine \
--config code-indexing-benchmark.yaml \
--architecture "$ARCH" \
--scenario "$SCENARIO" \
--group "$GROUP" \
--output-file "$OUTPUT_FILE"
artifacts:
paths:
- gkg-benchmark-*.json
expire_in: 3 weeks
code-indexing-benchmark-v2-linux:
extends:
- .job-template
- .code-indexing-benchmark-template
tags:
- ${RUNNER_LARGE}
variables:
ARCH: "linux-x86_64"
SCENARIO: v2
parallel:
matrix:
- GROUP: [python, java, kotlin, csharp, ruby, go, rust, c, cpp, php]
.code-indexing-benchmark-analyze-template:
stage: benchmark
extends:
- .job-template
- .code-indexing-benchmark-rules
interruptible: true
script:
- |
gitlab-xtasks benchmark analyze \
--pattern "gkg-benchmark-*-${SCENARIO}-*.json" \
--output-format markdown \
--pipeline-url "$CI_PIPELINE_URL" \
--job-url "$CI_JOB_URL" \
--branch "$CI_COMMIT_REF_NAME" \
--output-file "gkg-benchmark-${SCENARIO}-results.md"
gitlab-xtasks benchmark analyze \
--pattern "gkg-benchmark-*-${SCENARIO}-*.json" \
--output-format json \
--pipeline-url "$CI_PIPELINE_URL" \
--job-url "$CI_JOB_URL" \
--branch "$CI_COMMIT_REF_NAME" \
--output-file "gkg-benchmark-${SCENARIO}-results.json"
if [[ -n "$CI_MERGE_REQUEST_IID" && -n "$BENCHMARK_GITLAB_TOKEN" ]]; then
gitlab-xtasks comment post \
--type add-or-edit \
--unique-id "code-indexing-benchmark-${SCENARIO}-comment" \
--token "$BENCHMARK_GITLAB_TOKEN" \
--file-path "gkg-benchmark-${SCENARIO}-results.md"
else
echo "Skipping benchmark comment: BENCHMARK_GITLAB_TOKEN unavailable (expected for fork MRs)."
fi
artifacts:
paths:
- gkg-benchmark-*-results.md
- gkg-benchmark-*-results.json
- gkg-benchmark-*.json
expire_in: 1 week
code-indexing-benchmark-v2-analyze:
extends: .code-indexing-benchmark-analyze-template
needs:
- code-indexing-benchmark-v2-linux
variables:
SCENARIO: v2
# Build Stage
.docker-build:
stage: build
image: docker:29
needs: []
services:
- name: docker:29-dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
IMAGE_NAME: gkg
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- git fetch --tags
- BASE_VERSION=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | sed -n '1s/^v//p')
- export GKG_VERSION="${BASE_VERSION:-0.0.0}-${DEV_PREFIX}+${CI_COMMIT_SHORT_SHA}"
- ./scripts/docker-build.sh "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DEV_PREFIX}-${CI_COMMIT_SHORT_SHA}-${ARCH}"
docker-build-amd64:
extends: .docker-build
tags:
- ${RUNNER_LARGE}
variables:
ARCH: amd64
docker-build-arm64:
extends: .docker-build
tags:
- ${RUNNER_LARGE_ARM}
variables:
ARCH: arm64
docker-manifest:
stage: build
image: docker:29
tags:
- saas-linux-medium-amd64
needs:
- docker-build-amd64
- docker-build-arm64
variables:
IMAGE_NAME: gkg
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
- docker buildx imagetools create
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DEV_PREFIX}"
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DEV_PREFIX}-${CI_COMMIT_SHORT_SHA}"
"${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DEV_PREFIX}-${CI_COMMIT_SHORT_SHA}-amd64"
"${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DEV_PREFIX}-${CI_COMMIT_SHORT_SHA}-arm64"
docker-build-mr:
stage: build
image: docker:29
tags:
- ${RUNNER_LARGE}
needs: []
services:
- name: docker:29-dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
IMAGE_NAME: gkg
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
allow_failure: true
script:
- ./scripts/docker-build.sh "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:develop-mr-${CI_MERGE_REQUEST_IID}-${CI_COMMIT_SHORT_SHA}-amd64"
# Tag = Dockerfile hash; the e2e job resolves the same tag.
e2e-robot-image:
stage: build
image: docker:29
tags:
- saas-linux-medium-amd64
needs: []
services:
- name: docker:29-dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_PROJECT_ID != $CANONICAL_PROJECT_ID
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- e2e/Dockerfile.robot
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
- TAG=$(sha256sum e2e/Dockerfile.robot | cut -c1-12)
- IMAGE="${CI_REGISTRY_IMAGE}/e2e-robot"
- |
if docker manifest inspect "${IMAGE}:${TAG}" >/dev/null 2>&1; then
echo "${IMAGE}:${TAG} already exists"
else
docker build -t "${IMAGE}:${TAG}" -f e2e/Dockerfile.robot e2e
docker push "${IMAGE}:${TAG}"
fi
check-go-proto:
needs: []
image: golang:1.24
tags:
- saas-linux-medium-amd64
stage: lint
before_script:
- apt-get update -qq && apt-get install -y -qq unzip
script:
- scripts/proto-go.sh check
- cd clients/orbitpb && go build ./...
rules:
- !reference [.skip-on-solo-schedule, rules]
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
- if: $CI_COMMIT_TAG
when: never
- changes:
- crates/orbit-server/proto/**/*
- clients/orbitpb/**/*
build-proto-gem: