MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / upload

Function upload

src/upload/uploader.rs:302–349  ·  view source on GitHub ↗
(
    orchestrator: &Orchestrator,
    api_client: &CodSpeedAPIClient,
    execution_context: &ExecutionContext,
    executor_name: ExecutorName,
    run_part_suffix: BTreeMap<String, Value>,
)

Source from the content-addressed store, hash-verified

300}
301
302pub async fn upload(
303 orchestrator: &Orchestrator,
304 api_client: &CodSpeedAPIClient,
305 execution_context: &ExecutionContext,
306 executor_name: ExecutorName,
307 run_part_suffix: BTreeMap<String, Value>,
308) -> Result<UploadResult> {
309 let profile_archive =
310 create_profile_archive(&execution_context.profile_folder, executor_name.clone()).await?;
311
312 debug!(
313 "Run Environment provider detected: {:?}",
314 orchestrator.provider.get_run_environment()
315 );
316
317 let upload_metadata = orchestrator
318 .provider
319 .get_upload_metadata(
320 &execution_context.config,
321 api_client,
322 &orchestrator.system_info,
323 &profile_archive,
324 executor_name,
325 run_part_suffix,
326 )
327 .await?;
328 debug!("Upload metadata: {upload_metadata:#?}");
329 if upload_metadata.tokenless {
330 let hash = upload_metadata.get_hash();
331 info!("CodSpeed Run Hash: \"{hash}\"");
332 }
333
334 debug!("Preparing upload...");
335 let upload_data = retrieve_upload_data(orchestrator, api_client, &upload_metadata).await?;
336 debug!("runId: {}", upload_data.run_id);
337
338 debug!(
339 "Uploading {} bytes...",
340 profile_archive.content.size().await?
341 );
342 upload_profile_archive(&upload_data, profile_archive).await?;
343
344 Ok(UploadResult {
345 run_id: upload_data.run_id,
346 owner: upload_metadata.run_environment_metadata.owner.clone(),
347 repository: upload_metadata.run_environment_metadata.repository.clone(),
348 })
349}
350
351#[cfg(test)]
352mod tests {

Callers 2

upload_allMethod · 0.85
test_uploadFunction · 0.85

Calls 5

create_profile_archiveFunction · 0.85
retrieve_upload_dataFunction · 0.85
upload_profile_archiveFunction · 0.85
get_upload_metadataMethod · 0.80
get_hashMethod · 0.80

Tested by 1

test_uploadFunction · 0.68