Skip to content

Commit d71f112

Browse files
committed
Enteprise Search code snippets
1 parent a74a992 commit d71f112

File tree

116 files changed

+2258
-1072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2258
-1072
lines changed

.evergreen-functions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ functions:
841841
working_dir: src/github.com/mongodb/mongodb-kubernetes
842842
binary: scripts/code_snippets/sample_commit_output.sh
843843

844-
# it executes a script by convention: ./scripts/code_snippets/${task_name}_test.sh
844+
# it executes a script by convention: ./scripts/code_snippets/tests/${task_name}
845845
test_code_snippets:
846846
- *switch_context
847847
- command: shell.exec
@@ -854,4 +854,4 @@ functions:
854854
- code_snippets_reset
855855
- task_name
856856
script: |
857-
./scripts/code_snippets/${task_name}_test.sh
857+
./scripts/code_snippets/tests/${task_name}

.evergreen-snippets.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
variables:
2+
- &setup_and_teardown_group_gke_code_snippets
3+
setup_task_can_fail_task: true
4+
setup_group:
5+
- func: clone
6+
- func: setup_gcloud_cli
7+
- func: setup_mongosh
8+
- func: download_kube_tools
9+
- func: build_multi_cluster_binary
10+
teardown_task:
11+
- func: upload_e2e_logs
12+
- func: upload_code_snippets_logs
13+
14+
- &setup_and_teardown_group_kind_code_snippets
15+
setup_task_can_fail_task: true
16+
setup_group_can_fail_task: true
17+
setup_group:
18+
- func: clone
19+
- func: cleanup_exec_environment
20+
- func: download_kube_tools
21+
- func: configure_docker_auth
22+
- func: setup_kubernetes_environment
23+
- func: python_venv
24+
- func: setup_cloud_qa
25+
teardown_task:
26+
- func: upload_e2e_logs
27+
- func: upload_code_snippets_logs
28+
- func: teardown_kubernetes_environment
29+
- func: teardown_cloud_qa
30+
31+
# This variable is copied over from .evergreen.yml because anchors don't work for included files
32+
- &base_om8_dependency
33+
depends_on:
34+
- name: build_om_images
35+
variant: build_om80_images
36+
- name: build_operator_ubi
37+
variant: init_test_run
38+
- name: build_init_database_image_ubi
39+
variant: init_test_run
40+
- name: build_database_image_ubi
41+
variant: init_test_run
42+
- name: build_test_image
43+
variant: init_test_run
44+
- name: build_init_appdb_images_ubi
45+
variant: init_test_run
46+
- name: build_init_om_images_ubi
47+
variant: init_test_run
48+
- name: build_agent_images_ubi
49+
variant: init_test_run
50+
51+
tasks:
52+
# Code snippets tasks
53+
# Each scripts/code_snippets/tests/test_*.sh should have its task defined here.
54+
# TODO: it should be autogenerated
55+
# Each task executes test_code_snippets functon executes scripts/code_snippets/tests/${task_name} by task name convention
56+
- name: test_gke_multi_cluster_snippets.sh
57+
tags: [ "code_snippets" ]
58+
commands:
59+
- func: test_code_snippets
60+
- func: sample_commit_output
61+
62+
- name: test_gke_multi_cluster_no_mesh_snippets.sh
63+
tags: [ "code_snippets" ]
64+
commands:
65+
- func: test_code_snippets
66+
- func: sample_commit_output
67+
68+
- name: test_kind_search_community_snippets.sh
69+
tags: [ "code_snippets", "patch-run" ]
70+
commands:
71+
- func: test_code_snippets
72+
- func: sample_commit_output
73+
74+
- name: test_kind_search_enterprise_snippets.sh
75+
tags: [ "code_snippets", "patch-run" ]
76+
commands:
77+
- func: test_code_snippets
78+
- func: sample_commit_output
79+
80+
task_groups:
81+
- name: gke_code_snippets_task_group
82+
<<: *setup_and_teardown_group_gke_code_snippets
83+
max_hosts: -1
84+
tasks:
85+
- test_gke_multi_cluster_snippets.sh
86+
- test_gke_multi_cluster_no_mesh_snippets.sh
87+
88+
- name: kind_code_snippets_task_group
89+
<<: *setup_and_teardown_group_kind_code_snippets
90+
max_hosts: -1
91+
tasks:
92+
- test_kind_search_community_snippets.sh
93+
- test_kind_search_enterprise_snippets.sh
94+
95+
buildvariants:
96+
# These variants are used to test the code snippets and each one can be used in patches
97+
# Prerelease is especially used when the repo is tagged
98+
# More details in the TD: https://docs.google.com/document/d/1fuTxfRtP8QPtn7sKYxQM_AGcD6xycTZH8svngGxyKhc/edit?tab=t.0#bookmark=id.e8uva0393mbe
99+
- name: public_gke_code_snippets
100+
display_name: public_gke_code_snippets
101+
allowed_requesters: [ "patch" ]
102+
run_on:
103+
- ubuntu2204-small
104+
tasks:
105+
- name: gke_code_snippets_task_group
106+
107+
- name: prerelease_gke_code_snippets
108+
display_name: prerelease_gke_code_snippets
109+
tags: [ "release" ]
110+
allowed_requesters: [ "patch", "github_tag" ]
111+
depends_on:
112+
- variant: release_images
113+
name: '*'
114+
patch_optional: true
115+
run_on:
116+
- ubuntu2204-small
117+
tasks:
118+
- name: gke_code_snippets_task_group
119+
120+
- name: private_gke_code_snippets
121+
display_name: private_gke_code_snippets
122+
allowed_requesters: [ "patch" ]
123+
run_on:
124+
- ubuntu2204-small
125+
<<: *base_om8_dependency
126+
tasks:
127+
- name: gke_code_snippets_task_group
128+
129+
- name: private_kind_code_snippets
130+
display_name: private_kind_code_snippets
131+
tags: [ "e2e_test_suite" ]
132+
allowed_requesters: [ "patch", "github_pr" ]
133+
run_on:
134+
- ubuntu2204-large
135+
<<: *base_om8_dependency
136+
tasks:
137+
- name: kind_code_snippets_task_group
138+
139+
- name: prerelease_kind_code_snippets
140+
display_name: prerelease_kind_code_snippets
141+
allowed_requesters: [ "patch" ]
142+
run_on:
143+
- ubuntu2204-large
144+
tasks:
145+
- name: kind_code_snippets_task_group
146+
147+
- name: public_kind_code_snippets
148+
display_name: public_kind_code_snippets
149+
allowed_requesters: [ "patch" ]
150+
run_on:
151+
- ubuntu2204-large
152+
tasks:
153+
- name: kind_code_snippets_task_group

.evergreen-tasks.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ tasks:
8484
- func: test_code_snippets
8585
- func: sample_commit_output
8686

87-
- name: task_kind_community_search_snippets
87+
- name: task_kind_search_community_snippets
88+
tags: [ "code_snippets", "patch-run" ]
89+
commands:
90+
- func: test_code_snippets
91+
- func: sample_commit_output
92+
93+
- name: task_kind_search_enterprise_snippets
8894
tags: [ "code_snippets", "patch-run" ]
8995
commands:
9096
- func: test_code_snippets

.evergreen.yml

Lines changed: 2 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include:
55
- filename: .evergreen-functions.yml
66
- filename: .evergreen-tasks.yml
77
- filename: .evergreen-mco.yml
8+
- filename: .evergreen-snippets.yml
89

910
variables:
1011
- &ops_manager_60_latest 6.0.27 # The order/index is important, since these are anchors. Please do not change
@@ -86,29 +87,6 @@ variables:
8687
- func: setup_building_host
8788
- func: build_multi_cluster_binary
8889

89-
- &setup_and_teardown_group_gke_code_snippets
90-
setup_task_can_fail_task: true
91-
setup_group:
92-
- func: clone
93-
- func: setup_gcloud_cli
94-
- func: setup_mongosh
95-
- func: download_kube_tools
96-
- func: build_multi_cluster_binary
97-
teardown_group:
98-
- func: upload_code_snippets_logs
99-
100-
- &setup_and_teardown_group_kind_code_snippets
101-
setup_task_can_fail_task: true
102-
setup_group:
103-
- func: clone
104-
- func: cleanup_exec_environment
105-
- func: download_kube_tools
106-
- func: configure_docker_auth
107-
- func: setup_kubernetes_environment
108-
teardown_task:
109-
- func: upload_e2e_logs
110-
- func: upload_code_snippets_logs
111-
11290
- &setup_and_teardown_task_cloudqa
11391
setup_task_can_fail_task: true
11492
setup_task:
@@ -172,6 +150,7 @@ variables:
172150
- name: build_init_om_images_ubi
173151
variant: init_test_run
174152

153+
# Any change to base_om8_dependency should be reflected to its copy in .evergreen-snippets.yml
175154
- &base_om8_dependency
176155
depends_on:
177156
- name: build_om_images
@@ -673,19 +652,6 @@ task_groups:
673652
- unit_tests_helm
674653
- sbom_tests
675654

676-
- name: gke_code_snippets_task_group
677-
<<: *setup_and_teardown_group_gke_code_snippets
678-
max_hosts: -1
679-
tasks:
680-
- task_gke_multi_cluster_snippets
681-
- task_gke_multi_cluster_no_mesh_snippets
682-
683-
- name: kind_code_snippets_task_group
684-
<<: *setup_and_teardown_group_kind_code_snippets
685-
max_hosts: -1
686-
tasks:
687-
- task_kind_community_search_snippets
688-
689655
# Task group for deploying mongodbcommunity resources and testing the (former) MCO
690656
- name: e2e_mdb_community_task_group
691657
max_hosts: -1
@@ -2006,65 +1972,6 @@ buildvariants:
20061972
tasks:
20071973
- name: release_all_currently_used_agents_on_ecr
20081974

2009-
# These variants are used to test the code snippets and each one can be used in patches
2010-
# Prerelease is especially used when the repo is tagged
2011-
# More details in the TD: https://docs.google.com/document/d/1fuTxfRtP8QPtn7sKYxQM_AGcD6xycTZH8svngGxyKhc/edit?tab=t.0#bookmark=id.e8uva0393mbe
2012-
- name: public_gke_code_snippets
2013-
display_name: public_gke_code_snippets
2014-
allowed_requesters: ["patch"]
2015-
run_on:
2016-
- ubuntu2204-small
2017-
tasks:
2018-
- name: gke_code_snippets_task_group
2019-
2020-
- name: prerelease_gke_code_snippets
2021-
display_name: prerelease_gke_code_snippets
2022-
tags: [ "release" ]
2023-
allowed_requesters: ["patch", "github_tag"]
2024-
depends_on:
2025-
- variant: release_images
2026-
name: '*'
2027-
patch_optional: true
2028-
run_on:
2029-
- ubuntu2204-small
2030-
tasks:
2031-
- name: gke_code_snippets_task_group
2032-
2033-
- name: private_gke_code_snippets
2034-
display_name: private_gke_code_snippets
2035-
allowed_requesters: ["patch"]
2036-
run_on:
2037-
- ubuntu2204-small
2038-
<<: *base_om8_dependency
2039-
tasks:
2040-
- name: gke_code_snippets_task_group
2041-
2042-
- name: private_kind_code_snippets
2043-
display_name: private_kind_code_snippets
2044-
tags: [ "e2e_test_suite" ]
2045-
allowed_requesters: ["patch", "github_pr"]
2046-
run_on:
2047-
- ubuntu2204-large
2048-
<<: *base_om8_dependency
2049-
tasks:
2050-
- name: kind_code_snippets_task_group
2051-
2052-
- name: prerelease_kind_code_snippets
2053-
display_name: prerelease_kind_code_snippets
2054-
allowed_requesters: ["patch"]
2055-
run_on:
2056-
- ubuntu2204-large
2057-
tasks:
2058-
- name: kind_code_snippets_task_group
2059-
2060-
- name: public_kind_code_snippets
2061-
display_name: public_kind_code_snippets
2062-
allowed_requesters: ["patch"]
2063-
run_on:
2064-
- ubuntu2204-large
2065-
tasks:
2066-
- name: kind_code_snippets_task_group
2067-
20681975
### Build variants for manual patch only
20691976

20701977
- name: backup_csv_images

.githooks/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ lint_code() {
163163
scripts/evergreen/lint_code.sh
164164
}
165165

166+
function validate_snippets() {
167+
scripts/code_snippets/validate_snippets.py
168+
}
169+
166170
# bg_job_ vars are global; run_job_in_background function is appending to them on each call
167171
bg_job_pids=()
168172
bg_job_pids_with_names=()
@@ -217,6 +221,7 @@ pre_commit() {
217221
run_job_in_background "regenerate_public_rbac_multi_cluster"
218222
run_job_in_background "python_formatting"
219223
run_job_in_background "check_erroneous_kubebuilder_annotations"
224+
run_job_in_background "validate_snippets"
220225

221226
if wait_for_all_background_jobs; then
222227
echo -e "${GREEN}pre-commit: All checks passed!${NO_COLOR}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,5 @@ docs/**/test.sh.run.log
9191

9292
# goreleaser generated files
9393
dist
94+
logs
95+
*.run.log

0 commit comments

Comments
 (0)