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
8 changes: 6 additions & 2 deletions api/v1/search/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ def download_artifacts_from_s3(release_version: str, commit_sha: str, staging_s3
return True


def set_permissions_filter(tarinfo):
if tarinfo.name == "kubectl-mongodb":
# This is the binary, make it executable: rwxr-xr-x
tarinfo.mode = 0o755
return tarinfo


# create_tarballs creates `.tar.gz` archives for the artifacts that before promoting them.
def create_tarballs():
logger.info(f"Creating archives for subdirectories in {LOCAL_ARTIFACTS_DIR}")
Expand All @@ -256,7 +263,14 @@ def create_tarballs():
archive_name = f"{dir_name}.tar.gz"

with tarfile.open(archive_name, "w:gz") as tar:
tar.add(dir_name)
# Iterate over the contents of the subdirectory (e.g., 'kubectl-mongodb_linux_s390x')
# and add them one by one.
for item_name in os.listdir(dir_name):
full_item_path = os.path.join(dir_name, item_name)
# Add just the binary (kubectl-mongodb_None_linux_s390x/kubectl-mongodb) to the tar
# instead of adding the dir.
# filter is passed to make the binary file executable
tar.add(full_item_path, arcname=item_name, filter=set_permissions_filter)

full_archive_path = os.path.join(original_cwd, LOCAL_ARTIFACTS_DIR, archive_name)
logger.info(f"Successfully created archive at {full_archive_path}")
Expand Down