gcloud_utils/run/
process.rs

1use tokio::process::Command;
2
3pub async fn process_gcloud_build(project_id: &str, service_name: &str) {
4  let gcr_url = String::from("eu.gcr.io/") + project_id + "/" + service_name;
5  let output = Command::new("gcloud")
6    .args(
7      &[
8        "builds",
9        "submit",
10        "--tag",
11        &gcr_url,
12        "--timeout=80000",
13        "--project",
14        project_id
15        ])
16    .output()
17    .await;
18  println!("output = {:?}", output);
19}
20
21pub async fn process_deploy(project_id: &str, service_name: &str) {
22  let img_url = String::from("eu.gcr.io/") + project_id + "/" + service_name;
23  println!("{}", &img_url);
24  let output = Command::new("gcloud")
25    .args(
26      &[
27        "run",
28        "deploy",
29        "--image",
30        &img_url,
31        "--project",
32        project_id
33        ])
34    .output()
35    .await;
36  println!("output = {:?}", output);
37}