Skip to content

Commit 61dfb1e

Browse files
Fix issues is kubectl-mongodb related assets in github (#548)
1 parent 18f79ff commit 61dfb1e

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

api/v1/search/zz_generated.deepcopy.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ def download_artifacts_from_s3(release_version: str, commit_sha: str, staging_s3
243243
return True
244244

245245

246+
def set_permissions_filter(tarinfo):
247+
if tarinfo.name == "kubectl-mongodb":
248+
# This is the binary, make it executable: rwxr-xr-x
249+
tarinfo.mode = 0o755
250+
return tarinfo
251+
252+
246253
# create_tarballs creates `.tar.gz` archives for the artifacts that before promoting them.
247254
def create_tarballs():
248255
logger.info(f"Creating archives for subdirectories in {LOCAL_ARTIFACTS_DIR}")
@@ -256,7 +263,14 @@ def create_tarballs():
256263
archive_name = f"{dir_name}.tar.gz"
257264

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

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

0 commit comments

Comments
 (0)