From 86047f993ce448fb3709b8f4dbd3dbb14c05185a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sierant?= Date: Wed, 14 May 2025 15:28:30 +0200 Subject: [PATCH 1/7] Fixed helm repo search command --- docs/community-search/quick-start/README.md | 6 +----- docs/community-search/quick-start/README.md.j2 | 4 ---- .../quick-start/code_snippets/090_helm_add_mogodb_repo.sh | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/docs/community-search/quick-start/README.md b/docs/community-search/quick-start/README.md index 01998f597..3934db1ab 100644 --- a/docs/community-search/quick-start/README.md +++ b/docs/community-search/quick-start/README.md @@ -53,11 +53,7 @@ First, add the MongoDB Helm repository. This repository contains the Helm chart ```shell copy helm repo add mongodb https://mongodb.github.io/helm-charts helm repo update mongodb -if [[ "${OPERATOR_HELM_CHART}" != "helm_chart" ]]; then helm search repo "${OPERATOR_HELM_CHART}"; fi; -``` -After adding the repository, update your local Helm chart repository cache: -```shell -helm repo update +helm search repo mongodb/mongodb-kubernetes ``` ### 3. Install MongoDB Kubernetes Operator diff --git a/docs/community-search/quick-start/README.md.j2 b/docs/community-search/quick-start/README.md.j2 index ec2371869..0e3125075 100644 --- a/docs/community-search/quick-start/README.md.j2 +++ b/docs/community-search/quick-start/README.md.j2 @@ -38,10 +38,6 @@ First, add the MongoDB Helm repository. This repository contains the Helm chart ```shell copy {% include "code_snippets/090_helm_add_mogodb_repo.sh" %} ``` -After adding the repository, update your local Helm chart repository cache: -```shell -helm repo update -``` ### 3. Install MongoDB Kubernetes Operator diff --git a/docs/community-search/quick-start/code_snippets/090_helm_add_mogodb_repo.sh b/docs/community-search/quick-start/code_snippets/090_helm_add_mogodb_repo.sh index 8b19942ad..a348a3e0f 100644 --- a/docs/community-search/quick-start/code_snippets/090_helm_add_mogodb_repo.sh +++ b/docs/community-search/quick-start/code_snippets/090_helm_add_mogodb_repo.sh @@ -1,3 +1,3 @@ helm repo add mongodb https://mongodb.github.io/helm-charts helm repo update mongodb -if [[ "${OPERATOR_HELM_CHART}" != "helm_chart" ]]; then helm search repo "${OPERATOR_HELM_CHART}"; fi; +helm search repo mongodb/mongodb-kubernetes From a543d9cd22525adc022b28ac3d2f5146b7fbe2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sierant?= Date: Wed, 14 May 2025 15:38:29 +0200 Subject: [PATCH 2/7] Review fixes --- .../code_snippets/0210_verify_community_search_pullsecret.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/community-search/quick-start/code_snippets/0210_verify_community_search_pullsecret.sh b/docs/community-search/quick-start/code_snippets/0210_verify_community_search_pullsecret.sh index f9b442230..576824091 100644 --- a/docs/community-search/quick-start/code_snippets/0210_verify_community_search_pullsecret.sh +++ b/docs/community-search/quick-start/code_snippets/0210_verify_community_search_pullsecret.sh @@ -1,4 +1,4 @@ -echo "Verifying mongodb-kubernetes-database-pods contains proper pull secret" +echo "Verifying mongodb-kubernetes-database-pods service account contains proper pull secret" if ! kubectl get --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" -o json \ sa mongodb-kubernetes-database-pods -o=jsonpath='{.imagePullSecrets[*]}' | \ grep community-private-preview-pullsecret; then @@ -7,3 +7,4 @@ if ! kubectl get --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" sa mongodb-kubernetes-database-pods -o=yaml return 1 fi +echo "SUCCESS: mongodb-kubernetes-database-pods service account contains proper pull secret" From 8cdfba4f99ee66c81b10ff4bd5b14f35de244b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sierant?= Date: Fri, 16 May 2025 11:23:32 +0200 Subject: [PATCH 3/7] Added kind code snippets test to patch-run --- .evergreen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen.yml b/.evergreen.yml index 78e2fbf80..3090d2936 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -1862,7 +1862,7 @@ buildvariants: - name: private_kind_code_snippets display_name: private_kind_code_snippets - allowed_requesters: ["patch"] + allowed_requesters: ["patch", "github_pr"] run_on: - ubuntu2204-large <<: *base_om8_dependency From 5bd1055c2b73f2c7db22f2fa9a0b78f7c4d7adf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sierant?= Date: Fri, 16 May 2025 11:26:27 +0200 Subject: [PATCH 4/7] Added kind code snippets test to patch-run --- .evergreen-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen-tasks.yml b/.evergreen-tasks.yml index 779547d94..500e2a182 100644 --- a/.evergreen-tasks.yml +++ b/.evergreen-tasks.yml @@ -85,7 +85,7 @@ tasks: - func: sample_commit_output - name: task_kind_community_search_snippets - tags: [ "code_snippets", "patch-run" ] + tags: [ "patch-run" ] commands: - func: test_code_snippets - func: sample_commit_output From 9da0bed38b8d25dc6e16c5fd39405e405d23902d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sierant?= Date: Fri, 16 May 2025 11:27:19 +0200 Subject: [PATCH 5/7] Added kind code snippets test to patch-run --- .evergreen-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen-tasks.yml b/.evergreen-tasks.yml index 500e2a182..779547d94 100644 --- a/.evergreen-tasks.yml +++ b/.evergreen-tasks.yml @@ -85,7 +85,7 @@ tasks: - func: sample_commit_output - name: task_kind_community_search_snippets - tags: [ "patch-run" ] + tags: [ "code_snippets", "patch-run" ] commands: - func: test_code_snippets - func: sample_commit_output From 4583f2415b4d4cfc541c9242c1fae03d56962747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sierant?= Date: Mon, 19 May 2025 11:35:38 +0200 Subject: [PATCH 6/7] Triggering search snippets in PRs --- .evergreen.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.evergreen.yml b/.evergreen.yml index 3090d2936..7d455da66 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -1862,6 +1862,7 @@ buildvariants: - name: private_kind_code_snippets display_name: private_kind_code_snippets + tags: [ "e2e_test_suite" ] allowed_requesters: ["patch", "github_pr"] run_on: - ubuntu2204-large From 623d3fc6659799dcd97fccd02d653318577e8778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sierant?= Date: Mon, 19 May 2025 18:15:07 +0200 Subject: [PATCH 7/7] Changes to commiting snippets --- .evergreen.yml | 9 +++++++++ .../quick-start/env_variables_e2e_public.sh | 2 ++ scripts/code_snippets/sample_commit_output.sh | 2 +- scripts/dev/contexts/evg-private-context | 4 ++++ scripts/dev/contexts/prerelease_gke_code_snippets | 2 +- scripts/dev/contexts/public_gke_code_snippets | 2 +- scripts/dev/contexts/public_kind_code_snippets | 14 ++++++++++++++ 7 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 docs/community-search/quick-start/env_variables_e2e_public.sh create mode 100644 scripts/dev/contexts/public_kind_code_snippets diff --git a/.evergreen.yml b/.evergreen.yml index 7d455da66..d521f5c91 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -1870,6 +1870,15 @@ buildvariants: tasks: - name: kind_code_snippets_task_group + - name: public_kind_code_snippets + display_name: public_kind_code_snippets + allowed_requesters: ["patch", "github_pr"] + run_on: + - ubuntu2204-large + <<: *base_om8_dependency + tasks: + - name: kind_code_snippets_task_group + ### Build variants for manual patch only - name: publish_om60_images diff --git a/docs/community-search/quick-start/env_variables_e2e_public.sh b/docs/community-search/quick-start/env_variables_e2e_public.sh new file mode 100644 index 000000000..8a835d9b7 --- /dev/null +++ b/docs/community-search/quick-start/env_variables_e2e_public.sh @@ -0,0 +1,2 @@ +export K8S_CLUSTER_0_CONTEXT_NAME="${CLUSTER_NAME}" +export PRIVATE_PREVIEW_IMAGE_PULLSECRET="${COMMUNITY_PRIVATE_PREVIEW_PULLSECRET_DOCKERCONFIGJSON}" diff --git a/scripts/code_snippets/sample_commit_output.sh b/scripts/code_snippets/sample_commit_output.sh index d54623980..ff2fd4e4a 100755 --- a/scripts/code_snippets/sample_commit_output.sh +++ b/scripts/code_snippets/sample_commit_output.sh @@ -3,7 +3,7 @@ set -Eeou pipefail source scripts/dev/set_env_context.sh -if [ "${COMMIT_OUTPUT:-false}" = true ]; then +if [[ "${CODE_SNIPPETS_COMMIT_OUTPUT:-"false"}" == "true" ]]; then echo "Pushing output files" branch="meko-snippets-update-$(date "+%Y%m%d%H%M%S")" git checkout -b "${branch}" diff --git a/scripts/dev/contexts/evg-private-context b/scripts/dev/contexts/evg-private-context index 423355528..52584edc7 100644 --- a/scripts/dev/contexts/evg-private-context +++ b/scripts/dev/contexts/evg-private-context @@ -101,6 +101,10 @@ export RUNNING_IN_EVG="true" export DELETE_KIND_NETWORK="true" +# code_snippets_commit_output can be set in evergreen patch by --param code_snippets_commit_output=true +# it's also set explicitly in public_*_snippets variants +export CODE_SNIPPETS_COMMIT_OUTPUT=${code_snippets_commit_output:-"false"} + # MCO # shellcheck disable=SC2154 export READINESS_PROBE_IMAGE="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-readinessprobe:${version_id}" diff --git a/scripts/dev/contexts/prerelease_gke_code_snippets b/scripts/dev/contexts/prerelease_gke_code_snippets index 8eb284746..61a07676f 100644 --- a/scripts/dev/contexts/prerelease_gke_code_snippets +++ b/scripts/dev/contexts/prerelease_gke_code_snippets @@ -11,7 +11,7 @@ source "${script_dir}/root-context" export MDB_GKE_PROJECT="scratch-kubernetes-team" export K8S_CLUSTER_SUFFIX="-${version_id}-${RANDOM}" -export COMMIT_OUTPUT=true +export CODE_SNIPPETS_COMMIT_OUTPUT=true # we reset evg host to use a default ~/.kube/config for GKE instead of the one from evg host export EVG_HOST_NAME="" diff --git a/scripts/dev/contexts/public_gke_code_snippets b/scripts/dev/contexts/public_gke_code_snippets index 8f93b699b..c8695b45e 100644 --- a/scripts/dev/contexts/public_gke_code_snippets +++ b/scripts/dev/contexts/public_gke_code_snippets @@ -18,4 +18,4 @@ export EVG_HOST_NAME="" # ENV_VARIABLES.SH overrides export OPERATOR_ADDITIONAL_HELM_VALUES="" export OPERATOR_HELM_CHART="" -export COMMIT_OUTPUT=true +export CODE_SNIPPETS_COMMIT_OUTPUT=true diff --git a/scripts/dev/contexts/public_kind_code_snippets b/scripts/dev/contexts/public_kind_code_snippets new file mode 100644 index 000000000..c3f64ba1a --- /dev/null +++ b/scripts/dev/contexts/public_kind_code_snippets @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# this context file is for code snippets running on GKE clusters +set -Eeou pipefail + +# overrides of public env_variables.sh +script_name=$(readlink -f "${BASH_SOURCE[0]}") +script_dir=$(dirname "${script_name}") + +source "${script_dir}/root-context" + +export NAMESPACE=mongodb +export CODE_SNIPPETS_FLAVOR=e2e_private +export CODE_SNIPPETS_COMMIT_OUTPUT=true