Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -38,88 +38,18 @@ async fn main() -> eyre::Result<()> {
|
|||||||
.with_mold("2.3.3")
|
.with_mold("2.3.3")
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
let render = &RustServiceRender {
|
|
||||||
service: cuddle_file.vars.service.clone(),
|
|
||||||
//registry: "http://127.0.0.1:7900".into(),
|
|
||||||
//registry: "http://10.0.11.19:7900".into(),
|
|
||||||
registry: "https://releaser.i.kjuulh.io:443".into(),
|
|
||||||
};
|
|
||||||
let deployment = &CuddleReleaser::new(client.clone()).await?;
|
let deployment = &CuddleReleaser::new(client.clone()).await?;
|
||||||
|
|
||||||
let mut ci = CuddleCI::default();
|
let mut ci = CuddleCI::default();
|
||||||
ci.with_pull_request(service)
|
ci.with_pull_request(service)
|
||||||
.with_pull_request(render)
|
|
||||||
.with_main(service)
|
.with_main(service)
|
||||||
.with_main(render)
|
.with_main(deployment);
|
||||||
.with_main(deployment)
|
|
||||||
.with_release(service);
|
|
||||||
|
|
||||||
if cuddle_file.please.is_some() {
|
if cuddle_file.please.is_some() {
|
||||||
ci.with_main(&CuddlePlease::new(client.clone()));
|
ci.with_main(&CuddlePlease::new(client.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = cuddle_file.vars.service.clone();
|
ci.execute(std::env::args()).await?;
|
||||||
let system_time = SystemTime::now().duration_since(UNIX_EPOCH)?;
|
|
||||||
let build_notifications = client
|
|
||||||
.container()
|
|
||||||
.from("docker.io/kasperhermansen/build-notifications:main-1731768496")
|
|
||||||
.with_env_variable("TIME", system_time.as_secs().to_string())
|
|
||||||
.with_env_variable(
|
|
||||||
"SERVICE_HOST",
|
|
||||||
"https://build-notifications.prod.internal.kjuulh.app",
|
|
||||||
)
|
|
||||||
.with_env_variable(
|
|
||||||
"SERVICE_GRPC_HOST",
|
|
||||||
"https://grpc.build-notifications.prod.internal.kjuulh.app",
|
|
||||||
);
|
|
||||||
|
|
||||||
if let Err(e) = build_notifications
|
|
||||||
.with_exec(vec![
|
|
||||||
"build-notifications",
|
|
||||||
"build-started",
|
|
||||||
"--project-name",
|
|
||||||
&name,
|
|
||||||
])
|
|
||||||
.sync()
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
tracing::warn!("failed to send start notification: {}", e.to_string())
|
|
||||||
}
|
|
||||||
|
|
||||||
match ci.execute(std::env::args()).await {
|
|
||||||
Ok(()) => {
|
|
||||||
if let Err(e) = build_notifications
|
|
||||||
.with_exec(vec![
|
|
||||||
"build-notifications",
|
|
||||||
"build-success",
|
|
||||||
"--project-name",
|
|
||||||
&name,
|
|
||||||
])
|
|
||||||
.sync()
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
tracing::warn!("failed to send success notification: {}", e.to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
if let Err(e) = build_notifications
|
|
||||||
.with_exec(vec![
|
|
||||||
"build-notifications",
|
|
||||||
"build-failure",
|
|
||||||
"--project-name",
|
|
||||||
&name,
|
|
||||||
"--error",
|
|
||||||
&e.to_string(),
|
|
||||||
])
|
|
||||||
.sync()
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
tracing::warn!("failed to send failure notification: {}", e.to_string())
|
|
||||||
}
|
|
||||||
|
|
||||||
return Err(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user