File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,18 @@ def upload_from_directory(
192192 "paths" : [],
193193 }
194194
195+ # Catch any invalid artifacts
196+ bad_files = [
197+ f
198+ for f in artifacts_dir .iterdir ()
199+ if not f .name .startswith (cname )
200+ and f .suffix not in [".release" , ".requirements" ]
201+ ]
202+ if bad_files :
203+ raise RuntimeError (
204+ f"Artifact name '{ bad_files [0 ].name } ' does not start with cname '{ cname } '"
205+ )
206+
195207 for artifact in artifacts_dir .iterdir ():
196208 if not artifact .match (f"{ cname } *" ):
197209 continue
Original file line number Diff line number Diff line change @@ -260,6 +260,8 @@ def test_upload_from_directory_commit_mismatch_raises(s3_setup):
260260 bad_data = RELEASE_DATA .replace ("abc123" , "wrong" )
261261 release_path .write_text (bad_data )
262262 artifacts = S3Artifacts (env .bucket_name )
263+
264+ # Act / Assert
263265 with pytest .raises (RuntimeError , match = "Commit ID" ):
264266 artifacts .upload_from_directory (env .cname , env .tmp_path )
265267
You can’t perform that action at this time.
0 commit comments