Skip to content
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

DRIVERS-2543 Pull mongohouse image from ADL ECR repo #363

Merged
merged 26 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .evergreen/atlas_data_lake/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Atlas Data Lake Testing

The files in this directory are required to build and launch a local
## Git Checkout

Two scripts in this directory are required to build and launch a local
`mongohoused` for testing. In the Evergreen configuration file, execute
the following command in the foreground to build the server:

Expand All @@ -16,3 +18,22 @@ sh ${DRIVERS_TOOLS}/.evergreen/atlas_data_lake/run-mongohouse-local.sh

`$DRIVERS_TOOLS` is an environment variable set to the root directory
of the clone of the `drivers-evergreen-tools` repository.

## Docker Image

Two scripts in this directory are required to pull and run the
`mongohoused` docker image. In the Evergreen configuration file, execute
the following command in the foreground to build the server:

```
bash ${DRIVERS_TOOLS}/.evergreen/atlas_data_lake/pull-mongohouse-image.sh
```

and the following command in the foreground to run the server:

```
bash ${DRIVERS_TOOLS}/.evergreen/atlas_data_lake/run-mongohouse-image.sh
```

`$DRIVERS_TOOLS` is an environment variable set to the root directory
of the clone of the `drivers-evergreen-tools` repository.
Empty file modified .evergreen/atlas_data_lake/build-mongohouse-local.sh
100755 → 100644
Empty file.
15 changes: 15 additions & 0 deletions .evergreen/atlas_data_lake/pull-mongohouse-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#
# This script sets up the local docker image for mongohoused.
#
set -eux

DRIVERS_TOOLS=${DRIVERS_TOOLS:-$(readlink -f ../..)}
REPO="904697982180.dkr.ecr.us-east-1.amazonaws.com/atlas-query-engine-test"
pushd $DRIVERS_TOOLS/.evergreen/auth_aws
bash setup_secrets.sh drivers/adl
source secrets-export.sh
unset AWS_SESSION_TOKEN
popd
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $REPO
docker pull $REPO
13 changes: 13 additions & 0 deletions .evergreen/atlas_data_lake/run-mongohouse-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
#
# This script launches a docker-based mongohoused for testing.
#
# There is no corresponding 'shutdown' script; this project relies
# on Evergreen to terminate processes and clean up when tasks end.
set -eux

DRIVERS_TOOLS=${DRIVERS_TOOLS:-$(readlink -f ../..)}
IMAGE=904697982180.dkr.ecr.us-east-1.amazonaws.com/atlas-query-engine-test
USE_TTY=""
test -t 1 && USE_TTY="-t"
docker run -d -p 27017:27017 -v "$DRIVERS_TOOLS/.evergreen/atlas_data_lake:/src" -i $USE_TTY $IMAGE --config ./testdata/config/external/drivers/config.yaml
Empty file modified .evergreen/atlas_data_lake/run-mongohouse-local.sh
100755 → 100644
Empty file.
12 changes: 7 additions & 5 deletions .evergreen/auth_aws/setup_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@

AWS_ROLE_ARN = "arn:aws:iam::857654397073:role/drivers-test-secrets-role"


def get_secrets(vaults, region, profile):
"""Get the driver secret values."""
# Handle local credentials.
profile = profile or os.environ.get("AWS_PROFILE")
session = boto3.Session(profile_name=profile)
creds = None
kwargs = dict(region_name=region)
if "AWS_ACCESS_KEY_ID" not in os.environ and not profile:
session = boto3.Session(profile_name=profile)
client = session.client(service_name='sts', **kwargs)
try:
# This will only fail locally.
Expand All @@ -29,11 +31,11 @@ def get_secrets(vaults, region, profile):
raise ValueError("Please provide a profile (typically using AWS_PROFILE)")

creds = resp['Credentials']

if creds:
kwargs.update(aws_access_key_id=creds['AccessKeyId'],
aws_secret_access_key=creds['SecretAccessKey'],
aws_session_token=creds['SessionToken'])
else:
session = boto3.Session(profile_name=profile)
aws_secret_access_key=creds['SecretAccessKey'],
aws_session_token=creds['SessionToken'])
client = session.client(service_name='secretsmanager', **kwargs)

secrets = []
Expand Down
Loading