Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e845318

Browse files
committedMar 15, 2025
Do not error out on missing parent metrics
1 parent b4cccf0 commit e845318

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed
 

‎src/ci/citool/src/main.rs

+18-5
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,24 @@ fn postprocess_metrics(
150150
return Ok(());
151151
};
152152

153-
let parent_metrics =
154-
download_job_metrics(&job_name, &parent).context("cannot download parent metrics")?;
155-
let job_metrics =
156-
HashMap::from([(job_name, JobMetrics { parent: Some(parent_metrics), current: metrics })]);
157-
output_test_diffs(job_metrics);
153+
// This command is executed also on PR builds, which might not have parent metrics
154+
// available, because some PR jobs don't run on auto builds, and PR jobs do not upload metrics
155+
// due to missing permissions.
156+
// To avoid having to detect if this is a PR job, and to avoid having failed steps in PR jobs,
157+
// we simply print an error if the parent metrics were not found, but otherwise exit
158+
// successfully.
159+
match download_job_metrics(&job_name, &parent).context("cannot download parent metrics") {
160+
Ok(parent_metrics) => {
161+
let job_metrics = HashMap::from([(
162+
job_name,
163+
JobMetrics { parent: Some(parent_metrics), current: metrics },
164+
)]);
165+
output_test_diffs(job_metrics);
166+
}
167+
Err(error) => {
168+
eprintln!("Metrics for job `{job_name}` and commit `{parent}` not found: {error:?}");
169+
}
170+
}
158171

159172
Ok(())
160173
}

0 commit comments

Comments
 (0)
Failed to load comments.