Skip to content
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
4 changes: 4 additions & 0 deletions .evergreen-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ functions:
download_multi_cluster_binary:
- command: subprocess.exec
params:
include_expansions_in_env:
- workdir
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/release/kubectl_mongodb/download_kubectl_plugin.sh
env:
Expand Down Expand Up @@ -791,6 +793,8 @@ functions:
- code_snippets_reset
- task_name
- MDB_BASH_DEBUG
add_to_path:
- ${workdir}/bin
script: |
./scripts/code_snippets/tests/${task_name}

Expand Down
14 changes: 10 additions & 4 deletions scripts/release/kubectl_mongodb/download_kubectl_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ def download_kubectl_plugin_from_s3(
# change the file's permissions to make file executable
os.chmod(local_path, 0o755)

logger.info(f"Successfully downloaded artifact to {local_path}")

if copy_to_bin_path:
shutil.copyfile(local_path, KUBECTL_MONGODB_PLUGIN_BIN_PATH)
kubectl_mongodb_workdir_path = os.path.join(os.getenv("workdir", ""), KUBECTL_MONGODB_PLUGIN_BIN_PATH)
# copy content, stat-info (mode too), timestamps..
shutil.copy2(local_path, kubectl_mongodb_workdir_path)
# preserve owner and group
st = os.stat(local_path)
os.chown(kubectl_mongodb_workdir_path, st.st_uid, st.st_gid)

logger.info(f"Copied kubectl-mongodb plugin to {kubectl_mongodb_workdir_path} for tests usage")

logger.info(
f"Successfully downloaded artifact to {local_path}{f" and {KUBECTL_MONGODB_PLUGIN_BIN_PATH}" if copy_to_bin_path else ""}"
)
except ClientError as e:
if e.response["Error"]["Code"] == "404":
raise Exception(f"Artifact not found at s3://{s3_bucket}/{s3_plugin_path}: {e}")
Expand Down
Loading