1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use tokio::process::Command;

pub async fn process_gcloud_build(project_id: &str, service_name: &str, gcr_region: &str) {
  let gcr_url = String::from(gcr_region) + "/" + project_id + "/" + service_name;
  let output = Command::new("gcloud")
    .args(
      &[
        "builds",
        "submit",
        "--tag",
        &gcr_url,
        "--timeout=80000",
        "--project",
        project_id
        ])
    .output()
    .await;
  println!("output = {:?}", output);
}

pub async fn process_deploy(project_id: &str, service_name: &str, gcr_region: &str) {
  let img_url = String::from(gcr_region) + "/" + project_id + "/" + service_name;
  println!("{}", &img_url);
  let output = Command::new("gcloud")
    .args(
      &[
        "run",
        "deploy",
        "--image",
        &img_url,
        "--project",
        project_id
        ])
    .output()
    .await;
  println!("output = {:?}", output);
}