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:
parent
32ef9027fd
commit
a1d8d1f0ff
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user