Skip to content

Conversation

MaciejKaras
Copy link
Collaborator

@MaciejKaras MaciejKaras commented Sep 25, 2025

Summary

This PR fixes private_gke_code_snippets tests that could not properly set the context:

scripts/dev/contexts/private_gke_code_snippets: line 13: /data/mci/33f77d5e70bc4d8e19bb3f674e0743b1/src/github.com/mongodb/mongodb-kubernetes/scripts/dev/contexts/variables/funcs/gke: No such file or directory

The reason was om80 context file replaced the script_dir variable that was also set and used in private_gke_code_snippets. After that the script_dir pointed to ./scripts/dev/contexts/variables instead of ./scripts/dev/contexts/ and the gke script could not be found. The solution was to replace script_dir usage in om80 script with PROJECT_DIR. It was also replaced in other scripts which had long path based on script_dir.

The other thing that was fixed is switch_context function. Previously because we concatenated result from multiple bash commands, we didn't consume the error code from actual command:

      script: |
        echo "Switching context"
        scripts/dev/switch_context.sh "${build_variant}"
        echo "Finished switching context"

Proof of Work

Passing CI + manual patch for private_gke_code_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?

Copy link

⚠️ (this preview might not be accurate if the PR is not rebased on current master branch)

MCK 1.4.1 Release Notes

@MaciejKaras MaciejKaras added the skip-changelog Use this label in Pull Request to not require new changelog entry file label Sep 25, 2025
@MaciejKaras MaciejKaras marked this pull request as ready for review September 25, 2025 11:44
@MaciejKaras MaciejKaras requested a review from a team as a code owner September 25, 2025 11:44
@@ -1,3 +1,7 @@
#!/usr/bin/env bash

set -Eeou pipefail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not necessary as the file is only sourced, not executed directly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! At the same time it helps mark the file in IDE as bash script ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! At the same time it helps mark the file in IDE as bash script ;)

Not requesting to change this. Just joining the chat :)

From my experience adding a shebang is usually enough for IDEs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought that Łukasz commented all added lines. But I agree pipefail is not needed, but also harmless ;)

@@ -1,3 +1,7 @@
#!/usr/bin/env bash

set -Eeou pipefail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! At the same time it helps mark the file in IDE as bash script ;)

Not requesting to change this. Just joining the chat :)

From my experience adding a shebang is usually enough for IDEs.

CUSTOM_OM_PREV_VERSION=6.0.0
export CUSTOM_OM_PREV_VERSION
CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_60_latest\s+(\S+)\s+#" <"${script_dir}"/../../../../.evergreen.yml | awk '{print $3}')
CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_60_latest\s+(\S+)\s+#" <"${PROJECT_DIR}"/.evergreen.yml | awk '{print $3}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something for this PR, but I think we should switch for yq/jq for reading yaml/json instead of awk.

@MaciejKaras MaciejKaras merged commit a712422 into master Oct 7, 2025
35 of 37 checks passed
@MaciejKaras MaciejKaras deleted the maciejk/fix-gke-tests branch October 7, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Use this label in Pull Request to not require new changelog entry file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants