From 185369bc9f71d41855245a033ea58c58cad85332 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Thu, 23 Oct 2025 14:40:07 +0200 Subject: [PATCH 1/3] Fix issues is kubectl-mongodb relates assets in github 1. Make `kubectl-mongodb` file executable in git assets 2. Make sure decompressing the file directly gives us the binary --- .../python/promote_kubectl_plugin.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py b/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py index 73aacd239..c6f863434 100644 --- a/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py +++ b/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py @@ -242,6 +242,11 @@ def download_artifacts_from_s3(release_version: str, commit_sha: str, staging_s3 logger.info("All the artifacts have been downloaded successfully.") 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(): @@ -256,8 +261,18 @@ 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. + tar.add(full_item_path, arcname=item_name) + # 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}") created_archives.append(full_archive_path) From 23faa0395396a8c01c612afb4bc240e98cb439f5 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Thu, 23 Oct 2025 14:47:36 +0200 Subject: [PATCH 2/3] Remove unncessary code --- scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py b/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py index c6f863434..0483bd928 100644 --- a/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py +++ b/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py @@ -267,7 +267,6 @@ def create_tarballs(): 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. - tar.add(full_item_path, arcname=item_name) # filter is passed to make the binary file executable tar.add(full_item_path, arcname=item_name, From f969d10cb3c8950f585e3a2d6a8f28cbe91fa25e Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Thu, 23 Oct 2025 18:55:55 +0200 Subject: [PATCH 3/3] Run precommit --- api/v1/search/zz_generated.deepcopy.go | 8 ++++++-- .../kubectl_mongodb/python/promote_kubectl_plugin.py | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/api/v1/search/zz_generated.deepcopy.go b/api/v1/search/zz_generated.deepcopy.go index c66322146..d18d025f8 100644 --- a/api/v1/search/zz_generated.deepcopy.go +++ b/api/v1/search/zz_generated.deepcopy.go @@ -159,7 +159,7 @@ func (in *MongoDBSearchSpec) DeepCopyInto(out *MongoDBSearchSpec) { *out = new(v1.ResourceRequirements) (*in).DeepCopyInto(*out) } - out.Security = in.Security + in.Security.DeepCopyInto(&out.Security) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MongoDBSearchSpec. @@ -231,7 +231,11 @@ func (in *MongoDBSource) DeepCopy() *MongoDBSource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Security) DeepCopyInto(out *Security) { *out = *in - out.TLS = in.TLS + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(TLS) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Security. diff --git a/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py b/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py index 0483bd928..efc2687c2 100644 --- a/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py +++ b/scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py @@ -242,12 +242,14 @@ def download_artifacts_from_s3(release_version: str, commit_sha: str, staging_s3 logger.info("All the artifacts have been downloaded successfully.") 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}") @@ -268,10 +270,8 @@ def create_tarballs(): # 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) - + 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}") created_archives.append(full_archive_path)