@@ -152,9 +152,21 @@ def _export_container(self, container, release_image_name: str, temp_directory:
152152
153153 def _pack_release_file (self , log_path : Path , extract_dir : str , release_file : Path ):
154154 self .logger .info ("Pack container file %s" , release_file )
155- extract_content = " " .join ("'%s'" % file for file in os .listdir (extract_dir ))
156- command = f"""tar -C '{ extract_dir } ' -cvzf '{ release_file } ' { extract_content } """
157- self .run_command (command , "packing container file %s" % release_file ,
155+ extract_content = " " .join (f"'{ file } '" for file in os .listdir (extract_dir ))
156+ if not str (release_file ).endswith ("tar.gz" ):
157+ raise ValueError (f"Unexpected release file: '{ release_file } '. Expected suffix 'tar.gz'." )
158+ tmp_release_file = release_file .with_suffix ("" ) #cut off ".gz" from ".tar.gz"
159+ command = f"""tar -C '{ extract_dir } ' -vcf '{ tmp_release_file } ' { extract_content } """
160+ self .run_command (command , f"packing container file { tmp_release_file } " ,
161+ log_path .joinpath ("pack_release_file.log" ))
162+ manifest_file = os .path .join (extract_dir , "exasol-manifest.json" )
163+ with open (manifest_file , "w" ) as f :
164+ print ("{}" , file = f )
165+ command = f"""tar -C '{ extract_dir } ' -rvf '{ tmp_release_file } ' exasol-manifest.json"""
166+ self .run_command (command , f"adding manifest to '{ tmp_release_file } '" ,
167+ log_path .joinpath ("pack_release_file.log" ))
168+ command = f"""gzip { tmp_release_file } """
169+ self .run_command (command , f"Creating '{ release_file } '" ,
158170 log_path .joinpath ("pack_release_file.log" ))
159171
160172 @staticmethod
0 commit comments