@@ -108,6 +108,9 @@ def get_creds():
108108
109109
110110def cd_signer_request (method : str , path : str , data : str | None = None ):
111+ """
112+ Sends a request to the CD Signer API.
113+ """
111114 SigV4Auth = import_module ("botocore.auth" ).SigV4Auth
112115 AWSRequest = import_module ("botocore.awsrequest" ).AWSRequest
113116 requests = import_module ("requests" )
@@ -130,6 +133,10 @@ def cd_signer_request(method: str, path: str, data: str | None = None):
130133
131134
132135def cd_signer_create_request (manifest : Any ) -> str :
136+ """
137+ Sends a POST request to create a new signing request. After creation, we
138+ need to send another request to start it.
139+ """
133140 response = cd_signer_request (
134141 method = "POST" ,
135142 path = "/signing_requests" ,
@@ -142,6 +149,9 @@ def cd_signer_create_request(manifest: Any) -> str:
142149
143150
144151def cd_signer_start_request (request_id : str , source_key : str , destination_key : str , signing_data : CdSigningData ):
152+ """
153+ Sends a POST request to start the signing process.
154+ """
145155 response_text = cd_signer_request (
146156 method = "POST" ,
147157 path = f"/signing_requests/{ request_id } /start" ,
@@ -179,21 +189,36 @@ def cd_build_signed_package(file_path: pathlib.Path):
179189 | | ├─ qchat
180190 ```
181191 """
192+ # working_dir = BUILD_DIR / "package"
193+ # shutil.rmtree(working_dir, ignore_errors=True)
194+ # (BUILD_DIR / "package" / "artifact" / "EXECUTABLES_TO_SIGN").mkdir(parents=True)
195+ #
196+ # name = file_path.name
197+ #
198+ # # Write the manifest.yaml
199+ # manifest_template_path = pathlib.Path.cwd() / "build-config" / "signing" / "qchat" / "manifest.yaml.template"
200+ # (working_dir / "manifest.yaml").write_text(manifest_template_path.read_text().replace("__NAME__", name))
201+ #
202+ # shutil.copy2(file_path, working_dir / "artifact" / "EXECUTABLES_TO_SIGN" / file_path.name)
203+ # file_path.unlink()
204+ #
205+ # run_cmd(
206+ # ["gtar", "-czf", BUILD_DIR / "package.tar.gz", "manifest.yaml", "artifact"],
207+ # cwd=working_dir,
208+ # )
209+
210+ # Trying a different format without manifest.yaml and placing EXECUTABLES_TO_SIGN
211+ # at the root.
212+ # The docs contain conflicting information, idk what to even do here
182213 working_dir = BUILD_DIR / "package"
183214 shutil .rmtree (working_dir , ignore_errors = True )
184- (BUILD_DIR / "package" / "artifact" / "EXECUTABLES_TO_SIGN" ).mkdir (parents = True )
185-
186- name = file_path .name
187-
188- # Write the manifest.yaml
189- manifest_template_path = pathlib .Path .cwd () / "build-config" / "signing" / "qchat" / "manifest.yaml.template"
190- (working_dir / "manifest.yaml" ).write_text (manifest_template_path .read_text ().replace ("__NAME__" , name ))
215+ (BUILD_DIR / "package" / "EXECUTABLES_TO_SIGN" ).mkdir (parents = True )
191216
192- shutil .copy2 (file_path , working_dir / "artifact" / " EXECUTABLES_TO_SIGN" / file_path .name )
217+ shutil .copy2 (file_path , working_dir / "EXECUTABLES_TO_SIGN" / file_path .name )
193218 file_path .unlink ()
194219
195220 run_cmd (
196- ["gtar" , "-czf" , BUILD_DIR / "package.tar.gz" , "manifest.yaml" , "artifact " ],
221+ ["gtar" , "-czf" , BUILD_DIR / "package.tar.gz" , ". " ],
197222 cwd = working_dir ,
198223 )
199224
0 commit comments