Skip to content

Commit dbdfc83

Browse files
authored
CLOUDP-317663: Archive snippets outputs instead of comitting (#478)
# Summary With this PR we will no longer commit snippets outputs back to the repo and just archive them to s3 instead. Additionally, `scripts/dev/update_docs_snippets.sh` scripts was updated. But automated snippets updates from CI runs are not part of this PR. **When reviewing collapse changes to tests/output directory** - all those files (previously comitted outputs) were just deleted. <img width="500" alt="image" src="https://github.com/user-attachments/assets/ec5bb172-425c-4545-996c-7a01c60a9a0b" /> ## Proof of Work **Archiving outputs to s3** [manual evg run](https://spruce.mongodb.com/version/69038706b0fce50007f25a9d/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC) **locally executed update script** ``` $ MCK_DIR=$(pwd) MCK_BRANCH=lsierant/archive-snippets-outputs DOCS_DIR=~/mdb/docs-mongodb-internal OUTPUTS_VERSION_ID=69038706b0fce50007f25a9d scripts/dev/update_docs_snippets.sh ``` ``` ~/mdb/lsierant ~/mdb/lsierant/lsierant_archive-snippets-outputs ~/mdb/docs-mongodb-internal ~/mdb/lsierant ~/mdb/lsierant/lsierant_archive-snippets-outputs Switched to branch 'main' Your branch is up to date with 'origin/main'. HEAD is now at 308db2bd35 DOCSP-54633 MongoDB Search product name change-main-backport (15252) (#15805) fatal: a branch named 'MCK-snippets-update-69038706b0fce50007f25a9d' already exists Switched to branch 'MCK-snippets-update-69038706b0fce50007f25a9d' ~/mdb/lsierant ~/mdb/lsierant/lsierant_archive-snippets-outputs Downloading snippets outputs from s3 to /var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te download: s3://operator-e2e-artifacts/snippets_outputs/69038706b0fce50007f25a9d/snippets_outputs_69038706b0fce50007f25a9d_test_kind_search_community_snippets.tgz to ../../../../var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/snippets_outputs_69038706b0fce50007f25a9d_test_kind_search_community_snippets.tgz download: s3://operator-e2e-artifacts/snippets_outputs/69038706b0fce50007f25a9d/snippets_outputs_69038706b0fce50007f25a9d_test_kind_search_external_mongod_snippets.tgz to ../../../../var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/snippets_outputs_69038706b0fce50007f25a9d_test_kind_search_external_mongod_snippets.tgz download: s3://operator-e2e-artifacts/snippets_outputs/69038706b0fce50007f25a9d/snippets_outputs_69038706b0fce50007f25a9d_test_kind_search_enterprise_snippets.tgz to ../../../../var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/snippets_outputs_69038706b0fce50007f25a9d_test_kind_search_enterprise_snippets.tgz x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/ x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/01_0090_helm_add_mogodb_repo.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/01_0100_install_operator.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/01_0110_wait_for_operator_deployment.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/01_0315_wait_for_community_resource.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/01_0330_wait_for_community_resource.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/01_0335_show_running_pods.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/03_0420_import_movies_mflix_database.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/03_0440_wait_for_search_index_ready.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/03_0444_list_search_indexes.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/03_0445_list_vector_search_indexes.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/03_0450_execute_search_query.out x scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/03_0455_execute_vector_search_query.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/ x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/02_0090_helm_add_mogodb_repo.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/02_0100_install_operator.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/02_0310_wait_for_database_resource.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/02_0335_show_running_pods.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/03_0420_import_movies_mflix_database.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/03_0440_wait_for_search_index_ready.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/03_0444_list_search_indexes.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/03_0445_list_vector_search_indexes.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/03_0450_execute_search_query.out x scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets/03_0455_execute_vector_search_query.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/ x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/04_0090_helm_add_mogodb_repo.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/04_0100_install_operator.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/04_0315_wait_for_community_resource.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/04_0330_wait_for_community_resource.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/04_0335_show_running_pods.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/03_0420_import_movies_mflix_database.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/03_0440_wait_for_search_index_ready.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/03_0444_list_search_indexes.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/03_0445_list_vector_search_indexes.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/03_0450_execute_search_query.out x scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets/03_0455_execute_vector_search_query.out Replacing outputs for test: /var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/scripts/code_snippets/tests/outputs/test_kind_search_community_snippets Replacing outputs for test: /var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/scripts/code_snippets/tests/outputs/test_kind_search_enterprise_snippets Replacing outputs for test: /var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/scripts/code_snippets/tests/outputs/test_kind_search_external_mongod_snippets /var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/scripts/code_snippets/tests/outputs /var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d/scripts/code_snippets/tests/outputs ├── test_kind_search_community_snippets │   ├── 01_0090_helm_add_mogodb_repo.out │   ├── 01_0100_install_operator.out │   ├── 01_0110_wait_for_operator_deployment.out │   ├── 01_0315_wait_for_community_resource.out │   ├── 01_0330_wait_for_community_resource.out │   ├── 01_0335_show_running_pods.out │   ├── 03_0420_import_movies_mflix_database.out │   ├── 03_0440_wait_for_search_index_ready.out │   ├── 03_0444_list_search_indexes.out │   ├── 03_0445_list_vector_search_indexes.out │   ├── 03_0450_execute_search_query.out │   └── 03_0455_execute_vector_search_query.out ├── test_kind_search_enterprise_snippets │   ├── 02_0090_helm_add_mogodb_repo.out │   ├── 02_0100_install_operator.out │   ├── 02_0310_wait_for_database_resource.out │   ├── 02_0335_show_running_pods.out │   ├── 03_0420_import_movies_mflix_database.out │   ├── 03_0440_wait_for_search_index_ready.out │   ├── 03_0444_list_search_indexes.out │   ├── 03_0445_list_vector_search_indexes.out │   ├── 03_0450_execute_search_query.out │   └── 03_0455_execute_vector_search_query.out └── test_kind_search_external_mongod_snippets ├── 03_0420_import_movies_mflix_database.out ├── 03_0440_wait_for_search_index_ready.out ├── 03_0444_list_search_indexes.out ├── 03_0445_list_vector_search_indexes.out ├── 03_0450_execute_search_query.out ├── 03_0455_execute_vector_search_query.out ├── 04_0090_helm_add_mogodb_repo.out ├── 04_0100_install_operator.out ├── 04_0315_wait_for_community_resource.out ├── 04_0330_wait_for_community_resource.out └── 04_0335_show_running_pods.out 4 directories, 33 files ~/mdb/docs-mongodb-internal /var/folders/_l/xlckyyss4nsf1hd_0wf1pt3r0000gp/T/tmp.f9z7UeJ2Te/69038706b0fce50007f25a9d ~/mdb/lsierant/lsierant_archive-snippets-outputs [MCK-snippets-update-69038706b0fce50007f25a9d 5198ea9981] Update sample files from MCK 18 files changed, 78 insertions(+), 623 deletions(-) delete mode 100644 content/kubernetes/upcoming/source/includes/code-examples/search/04-search-external-mongod/README.md Enumerating objects: 57, done. Counting objects: 100% (57/57), done. Delta compression using up to 16 threads Compressing objects: 100% (34/34), done. Writing objects: 100% (34/34), 4.72 KiB | 4.72 MiB/s, done. Total 34 (delta 30), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (30/30), completed with 21 local objects. remote: remote: Create a pull request for 'MCK-snippets-update-69038706b0fce50007f25a9d' on GitHub by visiting: remote: https://github.com/10gen/docs-mongodb-internal/pull/new/MCK-snippets-update-69038706b0fce50007f25a9d remote: remote: GitHub found 264 vulnerabilities on 10gen/docs-mongodb-internal's default branch (25 critical, 106 high, 86 moderate, 47 low). To find out more, visit: remote: https://github.com/10gen/docs-mongodb-internal/security/dependabot remote: To github.com:10gen/docs-mongodb-internal.git * [new branch] MCK-snippets-update-69038706b0fce50007f25a9d -> MCK-snippets-update-69038706b0fce50007f25a9d ``` Branch was automatically pushed with all gathered snippets and outputs: https://github.com/10gen/docs-mongodb-internal/compare/MCK-snippets-update-69038706b0fce50007f25a9d?expand=1
1 parent 2cf14d4 commit dbdfc83

File tree

78 files changed

+103
-3576
lines changed

Some content is hidden

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

78 files changed

+103
-3576
lines changed

.evergreen-functions.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ variables:
4949
- READINESS_PROBE_VERSION
5050
- VERSION_UPGRADE_HOOK_VERSION
5151
- BUILD_SCENARIO
52+
- MDB_BASH_DEBUG
5253

5354
functions:
5455

@@ -769,18 +770,14 @@ functions:
769770
#
770771
# Code snippet test automation
771772
#
772-
773-
sample_commit_output:
774-
- command: github.generate_token
775-
params:
776-
expansion_name: GH_TOKEN
773+
archive_snippets_output:
777774
- command: subprocess.exec
778775
params:
779776
include_expansions_in_env:
780777
- GH_TOKEN
781-
- code_snippets_commit_output
778+
- MDB_BASH_DEBUG
782779
working_dir: src/github.com/mongodb/mongodb-kubernetes
783-
binary: scripts/code_snippets/sample_commit_output.sh
780+
binary: scripts/code_snippets/archive_snippets_output.sh
784781

785782
# it executes a script by convention: ./scripts/code_snippets/tests/${task_name}
786783
test_code_snippets:
@@ -793,6 +790,7 @@ functions:
793790
- code_snippets_teardown
794791
- code_snippets_reset
795792
- task_name
793+
- MDB_BASH_DEBUG
796794
script: |
797795
./scripts/code_snippets/tests/${task_name}
798796

.evergreen-snippets.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,19 @@ functions:
6969
permissions: private
7070
visibility: signed
7171
content_type: text/plain
72-
- command: s3.put
73-
params:
74-
aws_key: ${enterprise_aws_access_key_id}
75-
aws_secret: ${enterprise_aws_secret_access_key}
76-
local_files_include_filter:
77-
- src/github.com/mongodb/mongodb-kubernetes/public/architectures/**/*.out
78-
- src/github.com/mongodb/mongodb-kubernetes/docs/**/*.out
79-
preserve_path: true
80-
remote_file: logs/${task_id}/${execution}/
81-
bucket: operator-e2e-artifacts
82-
permissions: private
83-
visibility: signed
84-
content_type: text/plain
8572

8673
upload_code_snippets_outputs:
8774
- command: s3.put
8875
params:
8976
aws_key: ${enterprise_aws_access_key_id}
9077
aws_secret: ${enterprise_aws_secret_access_key}
9178
local_files_include_filter:
92-
- snippets_outputs.tgz
93-
remote_file: logs/${task_id}/${execution}/
79+
- snippets_outputs*.tgz
80+
remote_file: snippets_outputs/${version_id}
9481
bucket: operator-e2e-artifacts
9582
permissions: private
9683
visibility: signed
9784
content_type: ${content_type|application/x-gzip}
98-
display_name: "Snippets Outputs"
9985

10086
tasks:
10187
# Code snippets tasks
@@ -106,31 +92,31 @@ tasks:
10692
tags: [ "code_snippets" ]
10793
commands:
10894
- func: test_code_snippets
109-
- func: sample_commit_output
95+
- func: archive_snippets_output
11096

11197
- name: test_gke_multi_cluster_no_mesh_snippets.sh
11298
tags: [ "code_snippets" ]
11399
commands:
114100
- func: test_code_snippets
115-
- func: sample_commit_output
101+
- func: archive_snippets_output
116102

117103
- name: test_kind_search_community_snippets.sh
118104
tags: [ "code_snippets", "patch-run" ]
119105
commands:
120106
- func: test_code_snippets
121-
- func: sample_commit_output
107+
- func: archive_snippets_output
122108

123109
- name: test_kind_search_enterprise_snippets.sh
124110
tags: [ "code_snippets", "patch-run" ]
125111
commands:
126112
- func: test_code_snippets
127-
- func: sample_commit_output
113+
- func: archive_snippets_output
128114

129115
- name: test_kind_search_external_mongod_snippets.sh
130116
tags: [ "code_snippets", "patch-run" ]
131117
commands:
132118
- func: test_code_snippets
133-
- func: sample_commit_output
119+
- func: archive_snippets_output
134120

135121
task_groups:
136122
- name: gke_code_snippets_task_group

.evergreen-tasks.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,25 @@ tasks:
6666
tags: [ "code_snippets" ]
6767
commands:
6868
- func: test_code_snippets
69-
- func: sample_commit_output
69+
- func: archive_snippets_output
7070

7171
- name: task_gke_multi_cluster_no_mesh_snippets
7272
tags: [ "code_snippets" ]
7373
commands:
7474
- func: test_code_snippets
75-
- func: sample_commit_output
75+
- func: archive_snippets_output
7676

7777
- name: task_kind_search_community_snippets
7878
tags: [ "code_snippets", "patch-run" ]
7979
commands:
8080
- func: test_code_snippets
81-
- func: sample_commit_output
81+
- func: archive_snippets_output
8282

8383
- name: task_kind_search_enterprise_snippets
8484
tags: [ "code_snippets", "patch-run" ]
8585
commands:
8686
- func: test_code_snippets
87-
- func: sample_commit_output
87+
- func: archive_snippets_output
8888

8989
## Below are only e2e runs for .evergreen.yml ##
9090

.evergreen.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ parameters:
191191
value: "false"
192192
description: set this to true if you would like to delete the resources created in the code snippet tests, but keep the clusters
193193

194-
- key: code_snippets_commit_output
195-
value: "false"
196-
description: set this to true if you would like the pipeline to automatically push a branch with updated snippets outputs
194+
- key: MDB_BASH_DEBUG
195+
value: "0"
196+
description: set this to 1 if you want shell scripts to enable set -x
197197

198198
# Triggered manually or by PCT.
199199
patch_aliases:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
set -eou pipefail
4+
test "${MDB_BASH_DEBUG:-0}" -eq 1 && set -x
5+
6+
source scripts/dev/set_env_context.sh
7+
8+
# task_name is available from evergreen expansions and its set to the snippets test name (see tasks in .evergreen-snippets.yml)
9+
test_name=${task_name:?}
10+
test_name=${test_name%.sh}
11+
patch_id=${version_id:?}
12+
13+
# to run it locally:
14+
# $ test_name=test_kind_search_enterprise_snippets.sh archive_snippets_output.sh
15+
16+
output_dir="scripts/code_snippets/tests/outputs/${test_name}"
17+
if [[ ! -d "${output_dir}" ]]; then
18+
echo "Output dir is missing: ${output_dir}"
19+
exit 1
20+
fi
21+
22+
file_name="snippets_outputs_${patch_id}_${test_name}.tgz"
23+
tar -cvzf "${file_name}" "${output_dir}"
24+
25+
echo "Collected snippets outputs from ${test_name} into ${file_name}"

scripts/code_snippets/sample_commit_output.sh

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

scripts/code_snippets/tests/outputs/test_gke_multi_cluster_no_mesh_snippets/ra-01_0030_verify_access_to_clusters.out

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

scripts/code_snippets/tests/outputs/test_gke_multi_cluster_no_mesh_snippets/ra-02_0200_kubectl_mongodb_configure_multi_cluster.out

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

scripts/code_snippets/tests/outputs/test_gke_multi_cluster_no_mesh_snippets/ra-02_0205_helm_configure_repo.out

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

0 commit comments

Comments
 (0)