diff --git a/src/cmd/deploy.rs b/src/cmd/deploy.rs index e8710b6..2eb32c5 100644 --- a/src/cmd/deploy.rs +++ b/src/cmd/deploy.rs @@ -1,17 +1,24 @@ +use std::path::PathBuf; + use crate::adapters::ChiSquareEngine; use crate::adapters::{CloudWatch, MockIngress}; +use crate::config::deploy::DeploySubcommand; use crate::{adapters::Monitor, Pipeline}; use miette::Result; #[derive(Default)] -pub struct Deploy; +pub struct Deploy { + artifact_path: PathBuf, +} impl Deploy { /// initialize the deployment command. Using a constructor here /// is largely to make the look-and-feel of the cmd API similar /// between different commands. - pub fn new() -> Self { - Self + pub fn new(args: DeploySubcommand) -> Self { + Self { + artifact_path: args.artifact_path, + } } /// deploy the canary, monitoring it, and ultimately promoting @@ -19,6 +26,7 @@ impl Deploy { pub async fn dispatch(self) -> Result<()> { // • Load the monitor from the user's config. let monitor = CloudWatch::load_from_conf().await?; + // • TODO: Create the ingress, passing in the path to the deployment artifact. // • Set up our deployment pipeline. Pipeline::builder() .monitor(monitor) diff --git a/src/config/command.rs b/src/config/command.rs index c7b9423..d98be0f 100644 --- a/src/config/command.rs +++ b/src/config/command.rs @@ -2,6 +2,7 @@ use clap::Subcommand; use miette::Result; use crate::cmd::{Deploy, Version}; +use crate::config::deploy::DeploySubcommand; /// one of the top-level commands accepted by /// the canary CLI. @@ -9,7 +10,7 @@ use crate::cmd::{Deploy, Version}; pub enum CanaryCommand { /// Deploy the canary, dynamically ramping traffic up as canary gains statistical /// confidence in the canary. - Deploy, + Deploy(DeploySubcommand), /// Print the CLI version and exit Version, } @@ -18,7 +19,7 @@ impl CanaryCommand { /// dispatch the user-provided arguments to the command handler. pub async fn dispatch(&self) -> Result<()> { match self.clone() { - Self::Deploy => Deploy::new().dispatch().await, + Self::Deploy(args) => Deploy::new(args).dispatch().await, Self::Version => Version::new().dispatch(), } } diff --git a/src/config/deploy/mod.rs b/src/config/deploy/mod.rs new file mode 100644 index 0000000..eacf6b7 --- /dev/null +++ b/src/config/deploy/mod.rs @@ -0,0 +1,10 @@ +use std::path::PathBuf; + +use clap::Args; + +/// Deploy a serverless function with a self-promoting canary. +#[derive(Args, Clone)] +pub struct DeploySubcommand { + #[arg(value_name = "FILE")] + pub artifact_path: PathBuf, +} diff --git a/src/config/mod.rs b/src/config/mod.rs index eb83f75..d8cdce2 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -2,4 +2,6 @@ pub use flags::Flags; mod colors; mod command; +/// Contains the description of the `multi deploy` position arguments and flags. +pub mod deploy; mod flags;