Skip to content

Commit 805e229

Browse files
lcianclaude
andcommitted
fix(snapshots): Use org/project-scoped object keys for snapshot uploads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 850c177 commit 805e229

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/commands/build/snapshots.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,22 @@ fn upload_images(
267267
.build()?;
268268

269269
let mut scope = Usecase::new("preprod").scope();
270-
for (key, value) in &options.objectstore.scopes {
271-
scope = scope.push(key, value);
270+
let (mut org_id, mut project_id): (Option<String>, Option<String>) = (None, None);
271+
for (key, value) in options.objectstore.scopes.into_iter() {
272+
scope = scope.push(&key, value.clone());
273+
if key == "org" {
274+
org_id = Some(value);
275+
} else if key == "project" {
276+
project_id = Some(value);
277+
}
272278
}
279+
let Some(org_id) = org_id else {
280+
anyhow::bail!("Missing org in UploadOptions scope");
281+
};
282+
let Some(project_id) = project_id else {
283+
anyhow::bail!("Missing project in UploadOptions scope");
284+
};
285+
273286
let session = scope.session(&client)?;
274287

275288
let runtime = tokio::runtime::Builder::new_current_thread()
@@ -289,12 +302,13 @@ fn upload_images(
289302
format!("Failed to open image for upload: {}", image.path.display())
290303
})?;
291304

292-
info!("Queueing {} as {hash}", image.relative_path.display());
305+
let key = format!("{org_id}/{project_id}/{hash}");
306+
info!("Queueing {} as {key}", image.relative_path.display());
293307

294308
many_builder = many_builder.push(
295309
session
296310
.put_file(file)
297-
.key(&hash)
311+
.key(&key)
298312
.expiration_policy(expiration),
299313
);
300314

0 commit comments

Comments
 (0)