Skip to content

Commit bb6dfbc

Browse files
authored
Fixes to search docs snippets (#149)
# Summary This PR is republished #140. This patch contains: - changes to `docs/community-search/quick-start` code snippets - added prerelease and public variants variants - handle auto-commit of snippets output from docs/ ## Proof of Work [Automatic output update PR](#139) [Passing snippets test](https://spruce.mongodb.com/task/mongodb_kubernetes_prerelease_kind_code_snippets_task_kind_community_search_snippets_patch_28bf6726999bd11ca62f3a90c0b939746dbf2285_682d56a7bf693400079e59fa_25_05_21_04_29_30/logs?execution=0)
1 parent 0265214 commit bb6dfbc

15 files changed

+82
-17
lines changed

.evergreen-functions.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,20 @@ functions:
447447
aws_secret: ${enterprise_aws_secret_access_key}
448448
local_files_include_filter:
449449
- src/github.com/mongodb/mongodb-kubernetes/public/architectures/**/*.log
450+
- src/github.com/mongodb/mongodb-kubernetes/docs/**/*.log
451+
remote_file: logs/${task_id}/${execution}/
452+
bucket: operator-e2e-artifacts
453+
permissions: private
454+
visibility: signed
455+
content_type: text/plain
456+
- command: s3.put
457+
params:
458+
aws_key: ${enterprise_aws_access_key_id}
459+
aws_secret: ${enterprise_aws_secret_access_key}
460+
local_files_include_filter:
450461
- src/github.com/mongodb/mongodb-kubernetes/public/architectures/**/*.out
462+
- src/github.com/mongodb/mongodb-kubernetes/docs/**/*.out
463+
preserve_path: true
451464
remote_file: logs/${task_id}/${execution}/
452465
bucket: operator-e2e-artifacts
453466
permissions: private

.evergreen.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1861,13 +1861,30 @@ buildvariants:
18611861

18621862
- name: private_kind_code_snippets
18631863
display_name: private_kind_code_snippets
1864-
allowed_requesters: ["patch"]
1864+
tags: [ "e2e_test_suite" ]
1865+
allowed_requesters: ["patch", "github_pr"]
18651866
run_on:
18661867
- ubuntu2204-large
18671868
<<: *base_om8_dependency
18681869
tasks:
18691870
- name: kind_code_snippets_task_group
18701871

1872+
- name: prerelease_kind_code_snippets
1873+
display_name: prerelease_kind_code_snippets
1874+
allowed_requesters: ["patch"]
1875+
run_on:
1876+
- ubuntu2204-large
1877+
tasks:
1878+
- name: kind_code_snippets_task_group
1879+
1880+
- name: public_kind_code_snippets
1881+
display_name: public_kind_code_snippets
1882+
allowed_requesters: ["patch"]
1883+
run_on:
1884+
- ubuntu2204-large
1885+
tasks:
1886+
- name: kind_code_snippets_task_group
1887+
18711888
### Build variants for manual patch only
18721889

18731890
- name: publish_om60_images

docs/community-search/quick-start/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ First, add the MongoDB Helm repository. This repository contains the Helm chart
5353
```shell copy
5454
helm repo add mongodb https://mongodb.github.io/helm-charts
5555
helm repo update mongodb
56-
if [[ "${OPERATOR_HELM_CHART}" != "helm_chart" ]]; then helm search repo "${OPERATOR_HELM_CHART}"; fi;
57-
```
58-
After adding the repository, update your local Helm chart repository cache:
59-
```shell
60-
helm repo update
56+
helm search repo mongodb/mongodb-kubernetes
6157
```
6258

6359
### 3. Install MongoDB Kubernetes Operator

docs/community-search/quick-start/README.md.j2

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ First, add the MongoDB Helm repository. This repository contains the Helm chart
3838
```shell copy
3939
{% include "code_snippets/090_helm_add_mogodb_repo.sh" %}
4040
```
41-
After adding the repository, update your local Helm chart repository cache:
42-
```shell
43-
helm repo update
44-
```
4541

4642
### 3. Install MongoDB Kubernetes Operator
4743

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
echo "Verifying mongodb-kubernetes-database-pods contains proper pull secret"
1+
echo "Verifying mongodb-kubernetes-database-pods service account contains proper pull secret"
22
if ! kubectl get --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" -o json \
33
sa mongodb-kubernetes-database-pods -o=jsonpath='{.imagePullSecrets[*]}' | \
44
grep community-private-preview-pullsecret; then
@@ -7,3 +7,4 @@ if ! kubectl get --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}"
77
sa mongodb-kubernetes-database-pods -o=yaml
88
return 1
99
fi
10+
echo "SUCCESS: mongodb-kubernetes-database-pods service account contains proper pull secret"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
helm repo add mongodb https://mongodb.github.io/helm-charts
22
helm repo update mongodb
3-
if [[ "${OPERATOR_HELM_CHART}" != "helm_chart" ]]; then helm search repo "${OPERATOR_HELM_CHART}"; fi;
3+
helm search repo mongodb/mongodb-kubernetes
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export K8S_CLUSTER_0_CONTEXT_NAME="${CLUSTER_NAME}"
2+
3+
export PRIVATE_PREVIEW_IMAGE_PULLSECRET="${COMMUNITY_PRIVATE_PREVIEW_PULLSECRET_DOCKERCONFIGJSON}"
4+
5+
export OPERATOR_ADDITIONAL_HELM_VALUES=""
6+
export OPERATOR_HELM_CHART="${PROJECT_DIR}/helm_chart"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export K8S_CLUSTER_0_CONTEXT_NAME="${CLUSTER_NAME}"
2+
export PRIVATE_PREVIEW_IMAGE_PULLSECRET="${COMMUNITY_PRIVATE_PREVIEW_PULLSECRET_DOCKERCONFIGJSON}"

scripts/code_snippets/sample_commit_output.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
set -Eeou pipefail
44
source scripts/dev/set_env_context.sh
55

6-
if [ "${COMMIT_OUTPUT:-false}" = true ]; then
6+
if [[ "${CODE_SNIPPETS_COMMIT_OUTPUT:-"false"}" == "true" ]]; then
77
echo "Pushing output files"
88
branch="meko-snippets-update-$(date "+%Y%m%d%H%M%S")"
99
git checkout -b "${branch}"
1010
git reset
1111
git add public/architectures/**/*.out
1212
git add docs/**/output/*.out
13+
git add docs/**/*.md
1314
git commit -m "Update code snippets outputs"
14-
git remote set-url origin https://x-access-token:"${GH_TOKEN}"@github.com/mongodb/mongodb-kubernetes.git
15+
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/mongodb/mongodb-kubernetes.git"
1516
git push origin "${branch}"
1617
else
1718
echo "Not pushing output files"

scripts/code_snippets/task_kind_community_search_snippets_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ trap dump_logs EXIT
1212
test_dir="./docs/community-search/quick-start"
1313

1414
source "${test_dir}/env_variables.sh"
15+
echo "Sourcing env variables for ${CODE_SNIPPETS_FLAVOR} flavor"
1516
# shellcheck disable=SC1090
1617
test -f "${test_dir}/env_variables_${CODE_SNIPPETS_FLAVOR}.sh" && source "${test_dir}/env_variables_${CODE_SNIPPETS_FLAVOR}.sh"
1718

18-
1919
${test_dir}/test.sh
2020
scripts/code_snippets/kind_community_search_snippets_render_template.sh

scripts/dev/contexts/evg-private-context

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ export RUNNING_IN_EVG="true"
101101

102102
export DELETE_KIND_NETWORK="true"
103103

104+
# code_snippets_commit_output can be set in evergreen patch by --param code_snippets_commit_output=true
105+
# it's also set explicitly in public_*_snippets variants
106+
export CODE_SNIPPETS_COMMIT_OUTPUT=${code_snippets_commit_output:-"false"}
107+
104108
# MCO
105109
# shellcheck disable=SC2154
106110
export READINESS_PROBE_IMAGE="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-readinessprobe:${version_id}"

scripts/dev/contexts/prerelease_gke_code_snippets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source "${script_dir}/root-context"
1111

1212
export MDB_GKE_PROJECT="scratch-kubernetes-team"
1313
export K8S_CLUSTER_SUFFIX="-${version_id}-${RANDOM}"
14-
export COMMIT_OUTPUT=true
14+
export CODE_SNIPPETS_COMMIT_OUTPUT=true
1515

1616
# we reset evg host to use a default ~/.kube/config for GKE instead of the one from evg host
1717
export EVG_HOST_NAME=""
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# this context file is for code snippets running on GKE clusters
4+
set -Eeou pipefail
5+
6+
# overrides of public env_variables.sh
7+
script_name=$(readlink -f "${BASH_SOURCE[0]}")
8+
script_dir=$(dirname "${script_name}")
9+
10+
source "${script_dir}/root-context"
11+
12+
export NAMESPACE=mongodb
13+
export CODE_SNIPPETS_FLAVOR=e2e_prerelease
14+
export CODE_SNIPPETS_COMMIT_OUTPUT=true

scripts/dev/contexts/public_gke_code_snippets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ script_dir=$(dirname "${script_name}")
1010
source "${script_dir}/root-context"
1111

1212
export MDB_GKE_PROJECT="scratch-kubernetes-team"
13+
# shellcheck disable=SC2154
1314
export K8S_CLUSTER_SUFFIX="-${version_id}-${RANDOM}"
1415

1516
# we reset evg host to use a default ~/.kube/config for GKE instead of the one from evg host
@@ -18,4 +19,4 @@ export EVG_HOST_NAME=""
1819
# ENV_VARIABLES.SH overrides
1920
export OPERATOR_ADDITIONAL_HELM_VALUES=""
2021
export OPERATOR_HELM_CHART=""
21-
export COMMIT_OUTPUT=true
22+
export CODE_SNIPPETS_COMMIT_OUTPUT=true
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# this context file is for code snippets running on GKE clusters
4+
set -Eeou pipefail
5+
6+
# overrides of public env_variables.sh
7+
script_name=$(readlink -f "${BASH_SOURCE[0]}")
8+
script_dir=$(dirname "${script_name}")
9+
10+
source "${script_dir}/root-context"
11+
12+
export NAMESPACE=mongodb
13+
export CODE_SNIPPETS_FLAVOR=e2e_public
14+
export CODE_SNIPPETS_COMMIT_OUTPUT=true

0 commit comments

Comments
 (0)