Added a check on pipeline retry/creation in case the user doesn't have sufficient rights
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
be11082b07
commit
32ef9027fd
@ -121,7 +121,7 @@ pub fn retry_pipeline(host: &str, token: &str, project: &Project) {
|
|||||||
warn!("{:?} has no pipeline, ignoring.", project);
|
warn!("{:?} has no pipeline, ignoring.", project);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let res: Pipeline;
|
let res: Option<Pipeline>;
|
||||||
if pipeline.clone().unwrap().status == "success" {
|
if pipeline.clone().unwrap().status == "success" {
|
||||||
debug!("Latest pipeline for {:?} has a 'success' status, creating another one.",
|
debug!("Latest pipeline for {:?} has a 'success' status, creating another one.",
|
||||||
project);
|
project);
|
||||||
@ -129,7 +129,7 @@ pub fn retry_pipeline(host: &str, token: &str, project: &Project) {
|
|||||||
.project(project.name.clone())
|
.project(project.name.clone())
|
||||||
.ref_(project.ref_.clone())
|
.ref_(project.ref_.clone())
|
||||||
.build().unwrap();
|
.build().unwrap();
|
||||||
res = endpoint.query(&client).unwrap();
|
res = endpoint.query(&client).ok();
|
||||||
} else {
|
} else {
|
||||||
debug!("Latest pipeline status for {:?} wasn't a success, retrying.",
|
debug!("Latest pipeline status for {:?} wasn't a success, retrying.",
|
||||||
project);
|
project);
|
||||||
@ -137,8 +137,12 @@ pub fn retry_pipeline(host: &str, token: &str, project: &Project) {
|
|||||||
.project(project.name.clone())
|
.project(project.name.clone())
|
||||||
.pipeline(pipeline.unwrap().id)
|
.pipeline(pipeline.unwrap().id)
|
||||||
.build().unwrap();
|
.build().unwrap();
|
||||||
res = endpoint.query(&client).unwrap();
|
res = endpoint.query(&client).ok();
|
||||||
|
}
|
||||||
|
if res.is_none() {
|
||||||
|
error!("Could not retry/create a new pipeline for project {:?}. Ignoring.", project);
|
||||||
|
} else {
|
||||||
|
debug!("API answer was {:?}.", res.unwrap());
|
||||||
}
|
}
|
||||||
debug!("API answer was {:?}.", res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user