Order latest commits by id instead of by updated_at, as it could screw up the ordering for getting the latest pipeline

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2022-06-04 17:24:07 +02:00
parent 32ef9027fd
commit a1d8d1f0ff
No known key found for this signature in database
GPG Key ID: 0C87282F76E61283

View File

@ -100,14 +100,14 @@ pub fn get_latest_pipelines(client: &Gitlab, project: &Project) -> Option<Pipeli
trace!("Getting latest pipeline for project {:?}.", project);
let endpoint = Pipelines::builder()
.project(project.name.as_str()).ref_(project.ref_.as_str())
.order_by(PipelineOrderBy::UpdatedAt).build().unwrap();
.order_by(PipelineOrderBy::Id).build().unwrap();
let pipelines: Vec<Pipeline> = endpoint.query(client).unwrap_or(vec![]);
if pipelines.is_empty() {
warn!("No pipeline found for project {:?}.", project);
return None;
} else {
let pipeline = pipelines.first().unwrap().to_owned();
debug!("Found pipeline {:?} as latest pipeline for project {:?}.",
debug!("Found {:?} as latest pipeline for project {:?}.",
pipeline, project);
return Some(pipeline);
}