-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PYTHON-3716 OIDC-SASL Follow-Up #1365
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
37e55b0
DRIVERS-2415 Simplifications
blink1073 c52e10a
wip clean up oidc
blink1073 1b87e6a
lint
blink1073 69346bc
fix EG config
blink1073 2971708
Merge branch 'master' of github.com:mongodb/mongo-python-driver into …
blink1073 8426412
fix handling of assume role
blink1073 6cb708a
move cache to mongocredential
blink1073 2ea10a2
finish refactor
blink1073 4a2b10a
clean up tests
blink1073 b40fab8
finish refactor
blink1073 b5aae77
lint and test on multiple platforms
blink1073 f1aa532
clean up python binary handling
blink1073 89bf558
add helper function
blink1073 bd7953d
debug
blink1073 7cf158f
try that
blink1073 1c39d65
fix binaries
blink1073 4b1eb82
try updating certifi
blink1073 50186ff
fix for windows
blink1073 5828512
use wip branch
blink1073 3ddd737
debug
blink1073 9ae811e
try to create token dir
blink1073 96bf593
use regular branch
blink1073 7109a47
try again
blink1073 47e3dea
try again
blink1073 9ad53d2
debug
blink1073 6dde30e
try again
blink1073 0e2de59
try with bash
blink1073 7226e0e
try this
blink1073 bffa4a8
try with a bash script
blink1073 501ae19
cleanup
blink1073 4bfa368
fix handling of token dir
blink1073 7a15bd0
debug on macos
blink1073 f2bbacf
more debug
blink1073 41a7a7d
add certificate workaround
blink1073 c746b6d
switch to main channel
blink1073 b8fdaa3
remove todo
blink1073 3c614b0
Merge branch 'master' of github.com:mongodb/mongo-python-driver into …
blink1073 2a6d315
address review
blink1073 237b273
add missing default
blink1073 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,48 @@ | ||
#!/bin/bash | ||
|
||
set -o xtrace | ||
set +x # Disable debug trace | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
|
||
############################################ | ||
# Main Program # | ||
############################################ | ||
|
||
# Supported/used environment variables: | ||
# MONGODB_URI Set the URI, including an optional username/password to use | ||
# to connect to the server via MONGODB-OIDC authentication | ||
# mechanism. | ||
# PYTHON_BINARY The Python version to use. | ||
|
||
echo "Running MONGODB-OIDC authentication tests" | ||
# ensure no secrets are printed in log files | ||
set +x | ||
|
||
# load the script | ||
shopt -s expand_aliases # needed for `urlencode` alias | ||
[ -s "${PROJECT_DIRECTORY}/prepare_mongodb_oidc.sh" ] && source "${PROJECT_DIRECTORY}/prepare_mongodb_oidc.sh" | ||
|
||
MONGODB_URI=${MONGODB_URI:-"mongodb://localhost"} | ||
MONGODB_URI_SINGLE="${MONGODB_URI}/?authMechanism=MONGODB-OIDC" | ||
MONGODB_URI_MULTIPLE="${MONGODB_URI}:27018/?authMechanism=MONGODB-OIDC&directConnection=true" | ||
|
||
if [ -z "${OIDC_TOKEN_DIR}" ]; then | ||
echo "Must specify OIDC_TOKEN_DIR" | ||
# Make sure DRIVERS_TOOLS is set. | ||
if [ -z "$DRIVERS_TOOLS" ]; then | ||
echo "Must specify DRIVERS_TOOLS" | ||
exit 1 | ||
fi | ||
|
||
export MONGODB_URI_SINGLE="$MONGODB_URI_SINGLE" | ||
export MONGODB_URI_MULTIPLE="$MONGODB_URI_MULTIPLE" | ||
export MONGODB_URI="$MONGODB_URI" | ||
|
||
echo $MONGODB_URI_SINGLE | ||
echo $MONGODB_URI_MULTIPLE | ||
echo $MONGODB_URI | ||
# Get the drivers secrets. Use an existing secrets file first. | ||
if [ ! -f "./secrets-export.sh" ]; then | ||
bash .evergreen/tox.sh -m aws-secrets -- drivers/oidc | ||
fi | ||
source ./secrets-export.sh | ||
|
||
if [ "$ASSERT_NO_URI_CREDS" = "true" ]; then | ||
if echo "$MONGODB_URI" | grep -q "@"; then | ||
echo "MONGODB_URI unexpectedly contains user credentials!"; | ||
exit 1 | ||
fi | ||
# # If the file did not have our creds, get them from the vault. | ||
if [ -z "$OIDC_ATLAS_URI_SINGLE" ]; then | ||
bash .evergreen/tox.sh -m aws-secrets -- drivers/oidc | ||
source ./secrets-export.sh | ||
fi | ||
|
||
if [ -z "$PYTHON_BINARY" ]; then | ||
echo "Cannot test without specifying PYTHON_BINARY" | ||
exit 1 | ||
# Make the OIDC tokens. | ||
set -x | ||
pushd ${DRIVERS_TOOLS}/.evergreen/auth_oidc | ||
. ./oidc_get_tokens.sh | ||
popd | ||
|
||
# Set up variables and run the test. | ||
if [ -n "$LOCAL_OIDC_SERVER" ]; then | ||
export MONGODB_URI=${MONGODB_URI:-"mongodb://localhost"} | ||
export MONGODB_URI_SINGLE="${MONGODB_URI}/?authMechanism=MONGODB-OIDC" | ||
export MONGODB_URI_MULTI="${MONGODB_URI}:27018/?authMechanism=MONGODB-OIDC&directConnection=true" | ||
else | ||
set +x # turn off xtrace for this portion | ||
export MONGODB_URI="$OIDC_ATLAS_URI_SINGLE" | ||
export MONGODB_URI_SINGLE="$OIDC_ATLAS_URI_SINGLE/?authMechanism=MONGODB-OIDC" | ||
export MONGODB_URI_MULTI="$OIDC_ATLAS_URI_MULTI/?authMechanism=MONGODB-OIDC" | ||
set -x | ||
fi | ||
|
||
export TEST_AUTH_OIDC=1 | ||
export COVERAGE=1 | ||
export AUTH="auth" | ||
export SET_XTRACE_ON=1 | ||
bash ./.evergreen/tox.sh -m test-eg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this
source
be under aset +x
for safety?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done