@@ -108,6 +108,9 @@ def get_creds():
108
108
109
109
110
110
def cd_signer_request (method : str , path : str , data : str | None = None ):
111
+ """
112
+ Sends a request to the CD Signer API.
113
+ """
111
114
SigV4Auth = import_module ("botocore.auth" ).SigV4Auth
112
115
AWSRequest = import_module ("botocore.awsrequest" ).AWSRequest
113
116
requests = import_module ("requests" )
@@ -130,6 +133,10 @@ def cd_signer_request(method: str, path: str, data: str | None = None):
130
133
131
134
132
135
def 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
+ """
133
140
response = cd_signer_request (
134
141
method = "POST" ,
135
142
path = "/signing_requests" ,
@@ -142,6 +149,9 @@ def cd_signer_create_request(manifest: Any) -> str:
142
149
143
150
144
151
def 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
+ """
145
155
response_text = cd_signer_request (
146
156
method = "POST" ,
147
157
path = f"/signing_requests/{ request_id } /start" ,
@@ -179,21 +189,36 @@ def cd_build_signed_package(file_path: pathlib.Path):
179
189
| | ├─ qchat
180
190
```
181
191
"""
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
182
213
working_dir = BUILD_DIR / "package"
183
214
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 )
191
216
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 )
193
218
file_path .unlink ()
194
219
195
220
run_cmd (
196
- ["gtar" , "-czf" , BUILD_DIR / "package.tar.gz" , "manifest.yaml" , "artifact " ],
221
+ ["gtar" , "-czf" , BUILD_DIR / "package.tar.gz" , ". " ],
197
222
cwd = working_dir ,
198
223
)
199
224
0 commit comments