Skip to content

Commit

Permalink
Configurable version when installing with coredb-cli (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmiller609 authored Mar 13, 2023
1 parent b9d008f commit dbefc43
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion coredb-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion coredb-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coredb-cli"
version = "0.2.0-alpha"
version = "0.2.0"
edition = "2021"
authors = ["CoreDB.io"]
description = "The CLI for CoreDB"
Expand Down
13 changes: 10 additions & 3 deletions coredb-cli/src/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@ use clap::Args;
use std::process::Command;

#[derive(Args)]
pub struct InstallCommand {}
pub struct InstallCommand {
#[arg(short = 'b', long = "branch", default_value = "main")]
branch: String,
}

impl SubCommand for InstallCommand {
fn execute(&self) {
let output = Command::new("kubectl")
.arg("apply")
.arg("-f")
.arg("https://raw.githubusercontent.com/CoreDB-io/coredb/main/coredb-operator/yaml/crd.yaml")
.arg(
format!("https://raw.githubusercontent.com/CoreDB-io/coredb/{}/coredb-operator/yaml/crd.yaml", self.branch)
)
.output()
.expect("Failed to execute 'kubectl' command.");
println!("{}", String::from_utf8_lossy(&output.stdout));
let output = Command::new("kubectl")
.arg("apply")
.arg("-f")
.arg("https://raw.githubusercontent.com/CoreDB-io/coredb/main/coredb-operator/yaml/install.yaml")
.arg(
format!("https://raw.githubusercontent.com/CoreDB-io/coredb/{}/coredb-operator/yaml/install.yaml", self.branch)
)
.output()
.expect("Failed to execute 'kubectl' command.");
println!("{}", String::from_utf8_lossy(&output.stdout));
Expand Down

0 comments on commit dbefc43

Please sign in to comment.