Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,15 @@ pub async fn run(
};

if !config.skip_upload {
if provider.get_run_environment() != RunEnvironment::Local {
// If relevant, set the OIDC token for authentication
// Note: OIDC tokens can expire quickly, so we set it just before the upload
provider.set_oidc_token(&mut config).await?;
}

start_group!("Uploading performance data");
let upload_result =
uploader::upload(&config, &system_info, &provider, &run_data, executor.name()).await?;
let upload_result = uploader::upload(
&mut config,
&system_info,
&provider,
&run_data,
executor.name(),
)
.await?;
end_group!();

if provider.get_run_environment() == RunEnvironment::Local {
Expand Down
12 changes: 9 additions & 3 deletions src/run/uploader/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ pub struct UploadResult {

#[allow(clippy::borrowed_box)]
pub async fn upload(
config: &Config,
config: &mut Config,
system_info: &SystemInfo,
provider: &Box<dyn RunEnvironmentProvider>,
run_data: &RunData,
Expand All @@ -253,6 +253,12 @@ pub async fn upload(
provider.get_run_environment()
);

if provider.get_run_environment() != RunEnvironment::Local {
// If relevant, set the OIDC token for authentication
// Note: OIDC tokens can expire quickly, so we set it just before the upload
provider.set_oidc_token(config).await?;
}

let upload_metadata =
provider.get_upload_metadata(config, system_info, &profile_archive, executor_name)?;
debug!("Upload metadata: {upload_metadata:#?}");
Expand Down Expand Up @@ -299,7 +305,7 @@ mod tests {
#[ignore]
#[tokio::test]
async fn test_upload() {
let config = Config {
let mut config = Config {
command: "pytest tests/ --codspeed".into(),
upload_url: Url::parse("change me").unwrap(),
token: Some("change me".into()),
Expand Down Expand Up @@ -343,7 +349,7 @@ mod tests {
async {
let provider = crate::run::run_environment::get_provider(&config).unwrap();
upload(
&config,
&mut config,
&system_info,
&provider,
&run_data,
Expand Down
Loading