Commit 1ad24cf
authored
CLOUDP-341025: Refactor of existing snippets on master (#366)
# Summary
This PR refactors how we generate and manage outputs from snippet tests.
Before, every snippet module has its own output/ directory. But because
snippet modules were reused across different tests we had no way of
storing the outputs from different test runs (the files were
overwritten).
Changes were needed to accommodate upcoming Search snippets, but due to
the large scale of this refactoring it was extracted onto master.
**Only changes to public/architectures has been made performed in this
PR. Existing search snippets are left intact and will be refactored on
the search feature branch**. After this PR is approved, a followup PR in
the docs repo will be created adjusting for the new include paths.
This PR incorporated changes from #150 to fix diagnostic dumps from GKE
clusters.
# What this change will help
* committing back snippet output will be easy as adding changes from one
directory `scripts/code_snippets/tests/outputs/test_*` instead of
traversing the tree and dealing with the conflicts pushed from different
test runs.
* more clarity what snippets and outputs we're using in docs
* ability to share snippet modules and gather different outputs from the
same snippet module for different testing scenarios.
## Glossary
* `Snippet module` - directory containing `test.sh` and scripts in a
`code_snippets` sub directory. It's a reusable set of scripts, e.g.
`public/architectures/setup-multi-cluster/ra-01-setup-gke`.
* Snippet test - automated test running in evg that runs multiple
snippet modules. It's a top level entrypoint that runs all the snippet
modules. Examples:
`scripts/code_snippets/tests/test_gke_multi_cluster_no_mesh_snippets.sh`,
`scripts/code_snippets/test_gke_multi_cluster_snippets.sh`.
* Previously we named these files a "task" and they were directly in
`scripts/code_snippets` dir (e.g.
`scripts/code_snippets/task_gke_multi_cluster_no_mesh_snippets_test.sh`).
* `Snippet outputs` - output files (.out) gathered from a `Snippet
test`.
## Changes
* Snippet modules don't store their outputs in the snippet directory
now, but in `scripts/code_snippets/tests/outputs/<test name>` directory,
which is gathering *all* outputs from a given snippet test.
* Every file name in any of the code_snippets directories in the
codebase must have a globally unique name. Existing file names has been
refactored to match the new convention (in public/architecture).
* Validation/linter has been added
(`scripts/code_snippets/validate_snippets.py`) added to `pre-commit`
that enforces this convention.
* The naming convention is the following:
* Snippet module directory must be prefixed by some arbitrary prefix.
Snippet modules in reference architectures has been prefixed with
"ra-NN`, e.g. `ra-02-setup-operator`. Every snippet file belonging to
this module should be also prefixed (e.g.
`ra-02_0046_create_image_pull_secrets.sh`)
* This allows for storing all the snippets outputs in a flat directory,
guaranteeing we won't overwrite outputs.
* This also helps quickly verifying the paths that will be used in the
docs to include snippets and outputs. Having those prefixes will help
identifying if any included file is coming from a correct snippet test
and module.
* Improved diagnostic gathering from the test runs
* GKE clusters are correctly handled now
* Every file name is prefixed with the kube context name and the
namespace from which the files were downloaded. *This will impact all
the e2e test runs*, but it will improve diagnostic archive in cases
where we dump more than one namespace or k8s cluster.
* All evergreen yamls related to snippets have been moved into
.evergreen-snippets.yml (included from the main .evergreen-snippets.yml)
Here is the fragment of the current directory structure:
```
public/architectures
├── ra-06-ops-manager-multi-cluster
│ ├── code_snippets
│ │ ├── ra-06_0250_generate_certs.sh
│ │ ├── ra-06_0300_ops_manager_create_admin_credentials.sh
[...]
│ │ ├── ra-06_9100_delete_backup_namespaces.sh
│ │ └── ra-06_9200_delete_om.sh
│ ├── env_variables.sh
│ ├── teardown.sh
│ └── test.sh
├── ra-07-mongodb-replicaset-multi-cluster
│ ├── code_snippets
│ │ ├── ra-07_1050_generate_certs.sh
│ │ ├── ra-07_1100_mongodb_replicaset_multi_cluster.sh
[...]
│ │ └── ra-07_9000_delete_resources.sh
│ ├── env_variables.sh
│ ├── teardown.sh
│ └── test.sh
```
```
scripts/code_snippets
├── tests
│ ├── outputs
│ │ ├── test_gke_multi_cluster_no_mesh_snippets
│ │ ├── test_gke_multi_cluster_snippets
│ │ │ ├── ra-01_0030_verify_access_to_clusters.out
│ │ │ ├── ra-02_0200_kubectl_mongodb_configure_multi_cluster.out
│ │ │ ├── ra-02_0205_helm_configure_repo.out
[...]
│ │ │ ├── ra-06_0321_ops_manager_wait_for_pending_state.out
│ │ │ ├── ra-06_0322_ops_manager_wait_for_running_state.out
│ │ │ └── ra-06_0522_ops_manager_wait_for_running_state.out
│ │ └── test_kind_search_community_snippets
│ │ ├── 01_0090_helm_add_mogodb_repo.out
│ │ ├── 01_0100_install_operator.out
[...]
│ │ ├── 03_0450_execute_search_query.out
│ │ └── 03_0455_execute_vector_search_query.out
│ ├── test_gke_multi_cluster_no_mesh_snippets.sh
│ ├── test_gke_multi_cluster_snippets.sh
│ └── test_kind_search_community_snippets.sh
```
## Proof of Work
[Green EVG
run](https://spruce.mongodb.com/version/68ae250c41ef2800073ac896/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC)
for all snippets.
## Checklist
- [ ] Have you linked a jira ticket and/or is the ticket in the title?
- [ ] Have you checked whether your jira ticket required DOCSP changes?
- [ ] Have you added changelog file?
- use `skip-changelog` label if not needed
- refer to [Changelog files and Release
Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes)
section in CONTRIBUTING.md for more details1 parent 0c9e388 commit 1ad24cf
File tree
220 files changed
+1783
-976
lines changed- .githooks
- docs/community-search/quick-start
- code_snippets
- output
- public/architectures
- mongodb-replicaset-mc-no-mesh
- output
- mongodb-replicaset-multi-cluster
- output
- mongodb-sharded-mc-no-mesh
- output
- mongodb-sharded-multi-cluster
- output
- ops-manager-mc-no-mesh
- output
- ops-manager-multi-cluster
- output
- ra-06-ops-manager-multi-cluster
- code_snippets
- ra-07-mongodb-replicaset-multi-cluster
- code_snippets
- ra-08-mongodb-sharded-multi-cluster
- code_snippets
- ra-10-ops-manager-mc-no-mesh
- code_snippets
- ra-11-mongodb-sharded-mc-no-mesh
- code_snippets
- ra-12-mongodb-replicaset-mc-no-mesh
- code_snippets
- setup-multi-cluster
- ra-01-setup-gke
- code_snippets
- ra-02-setup-operator
- code_snippets
- output
- ra-03-setup-istio
- code_snippets
- ra-04-verify-connectivity
- code_snippets
- ra-05-setup-cert-manager
- code_snippets
- ra-09-setup-externaldns
- code_snippets
- yamls
- setup-externaldns
- code_snippets
- setup-gke
- output
- setup-operator
- verify-connectivity
- scripts
- code_snippets
- tests
- outputs
- test_gke_multi_cluster_snippets
- test_kind_search_community_snippets
- dev
- contexts
- evergreen/e2e
- funcs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
220 files changed
+1783
-976
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 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 | 478 | | |
506 | 479 | | |
507 | 480 | | |
| |||
817 | 790 | | |
818 | 791 | | |
819 | 792 | | |
820 | | - | |
| 793 | + | |
821 | 794 | | |
822 | 795 | | |
823 | 796 | | |
| |||
830 | 803 | | |
831 | 804 | | |
832 | 805 | | |
833 | | - | |
| 806 | + | |
834 | 807 | | |
835 | 808 | | |
836 | 809 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 154 | | |
168 | 155 | | |
169 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 91 | | |
114 | 92 | | |
115 | 93 | | |
| |||
173 | 151 | | |
174 | 152 | | |
175 | 153 | | |
| 154 | + | |
176 | 155 | | |
177 | 156 | | |
178 | 157 | | |
| |||
580 | 559 | | |
581 | 560 | | |
582 | 561 | | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | 562 | | |
597 | 563 | | |
598 | 564 | | |
| |||
1827 | 1793 | | |
1828 | 1794 | | |
1829 | 1795 | | |
1830 | | - | |
1831 | | - | |
1832 | | - | |
1833 | | - | |
1834 | | - | |
1835 | | - | |
1836 | | - | |
1837 | | - | |
1838 | | - | |
1839 | | - | |
1840 | | - | |
1841 | | - | |
1842 | | - | |
1843 | | - | |
1844 | | - | |
1845 | | - | |
1846 | | - | |
1847 | | - | |
1848 | | - | |
1849 | | - | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
1857 | | - | |
1858 | | - | |
1859 | | - | |
1860 | | - | |
1861 | | - | |
1862 | | - | |
1863 | | - | |
1864 | | - | |
1865 | | - | |
1866 | | - | |
1867 | | - | |
1868 | | - | |
1869 | | - | |
1870 | | - | |
1871 | | - | |
1872 | | - | |
1873 | | - | |
1874 | | - | |
1875 | | - | |
1876 | 1796 | | |
1877 | 1797 | | |
1878 | 1798 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
| |||
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | 227 | | |
| |||
0 commit comments