Skip to content

Commit 39c7d8f

Browse files
committed
Refactor of existing snippets on master
1 parent 55b869d commit 39c7d8f

File tree

277 files changed

+2071
-872
lines changed

Some content is hidden

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

277 files changed

+2071
-872
lines changed

.evergreen-functions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ functions:
819819
working_dir: src/github.com/mongodb/mongodb-kubernetes
820820
binary: scripts/code_snippets/sample_commit_output.sh
821821

822-
# it executes a script by convention: ./scripts/code_snippets/${task_name}_test.sh
822+
# it executes a script by convention: ./scripts/code_snippets/tests/${task_name}
823823
test_code_snippets:
824824
- *switch_context
825825
- command: shell.exec
@@ -832,4 +832,4 @@ functions:
832832
- code_snippets_reset
833833
- task_name
834834
script: |
835-
./scripts/code_snippets/${task_name}_test.sh
835+
./scripts/code_snippets/tests/${task_name}

.evergreen-snippets.yml

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

.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
@@ -658,19 +637,6 @@ task_groups:
658637
- unit_tests_python
659638
- sbom_tests
660639

661-
- name: gke_code_snippets_task_group
662-
<<: *setup_and_teardown_group_gke_code_snippets
663-
max_hosts: -1
664-
tasks:
665-
- task_gke_multi_cluster_snippets
666-
- task_gke_multi_cluster_no_mesh_snippets
667-
668-
- name: kind_code_snippets_task_group
669-
<<: *setup_and_teardown_group_kind_code_snippets
670-
max_hosts: -1
671-
tasks:
672-
- task_kind_community_search_snippets
673-
674640
# Task group for deploying mongodbcommunity resources and testing the (former) MCO
675641
- name: e2e_mdb_community_task_group
676642
max_hosts: -1
@@ -1985,65 +1951,6 @@ buildvariants:
19851951
tasks:
19861952
- name: release_all_currently_used_agents_on_ecr
19871953

1988-
# These variants are used to test the code snippets and each one can be used in patches
1989-
# Prerelease is especially used when the repo is tagged
1990-
# More details in the TD: https://docs.google.com/document/d/1fuTxfRtP8QPtn7sKYxQM_AGcD6xycTZH8svngGxyKhc/edit?tab=t.0#bookmark=id.e8uva0393mbe
1991-
- name: public_gke_code_snippets
1992-
display_name: public_gke_code_snippets
1993-
allowed_requesters: ["patch"]
1994-
run_on:
1995-
- ubuntu2204-small
1996-
tasks:
1997-
- name: gke_code_snippets_task_group
1998-
1999-
- name: prerelease_gke_code_snippets
2000-
display_name: prerelease_gke_code_snippets
2001-
tags: [ "release" ]
2002-
allowed_requesters: ["patch", "github_tag"]
2003-
depends_on:
2004-
- variant: release_images
2005-
name: '*'
2006-
patch_optional: true
2007-
run_on:
2008-
- ubuntu2204-small
2009-
tasks:
2010-
- name: gke_code_snippets_task_group
2011-
2012-
- name: private_gke_code_snippets
2013-
display_name: private_gke_code_snippets
2014-
allowed_requesters: ["patch"]
2015-
run_on:
2016-
- ubuntu2204-small
2017-
<<: *base_om8_dependency
2018-
tasks:
2019-
- name: gke_code_snippets_task_group
2020-
2021-
- name: private_kind_code_snippets
2022-
display_name: private_kind_code_snippets
2023-
tags: [ "e2e_test_suite" ]
2024-
allowed_requesters: ["patch", "github_pr"]
2025-
run_on:
2026-
- ubuntu2204-large
2027-
<<: *base_om8_dependency
2028-
tasks:
2029-
- name: kind_code_snippets_task_group
2030-
2031-
- name: prerelease_kind_code_snippets
2032-
display_name: prerelease_kind_code_snippets
2033-
allowed_requesters: ["patch"]
2034-
run_on:
2035-
- ubuntu2204-large
2036-
tasks:
2037-
- name: kind_code_snippets_task_group
2038-
2039-
- name: public_kind_code_snippets
2040-
display_name: public_kind_code_snippets
2041-
allowed_requesters: ["patch"]
2042-
run_on:
2043-
- ubuntu2204-large
2044-
tasks:
2045-
- name: kind_code_snippets_task_group
2046-
20471954
### Build variants for manual patch only
20481955

20491956
- name: backup_csv_images

.githooks/pre-commit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ function check_incorrect_makefile_variable_brackets() {
148148
fi
149149
}
150150

151+
function validate_snippets() {
152+
scripts/code_snippets/validate_snippets.py
153+
}
154+
151155
function pre_commit() {
156+
validate_snippets | prepend "validate_snippets"
157+
152158
if [[ "${MDB_UPDATE_LICENSES:-""}" == "true" ]]; then
153159
( (time update_licenses) 2>&1 | prepend "update_licenses" ) &
154160
fi

.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

docs/community-search/quick-start/code_snippets/0045_create_namespaces.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/community-search/quick-start/code_snippets/0200_configure_community_search_pullsecret.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/community-search/quick-start/code_snippets/0210_verify_community_search_pullsecret.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/community-search/quick-start/code_snippets/0305_create_mongodb_community_user_secrets.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)