Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move deploy and login to spin cloud #1139

Merged
merged 3 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/bin/spin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use lazy_static::lazy_static;
use spin_cli::commands::{
bindle::BindleCommands,
build::BuildCommand,
cloud::CloudCommands,
deploy::DeployCommand,
external::execute_external_subcommand,
login::LoginCommand,
Expand Down Expand Up @@ -52,11 +53,17 @@ enum SpinApp {
Up(UpCommand),
#[clap(subcommand)]
Bindle(BindleCommands),
#[clap(subcommand)]
Cloud(CloudCommands),
// hidden to "work" as a cross-level subcommand alias -> `spin cloud deploy`
#[clap(hide = true)]
Deploy(DeployCommand),
// hidden to "work" as a cross-level subcommand alias -> `spin cloud login`
#[clap(hide = true)]
Login(LoginCommand),
#[clap(subcommand, alias = "oci")]
Registry(RegistryCommands),
Deploy(DeployCommand),
Build(BuildCommand),
Login(LoginCommand),
#[clap(subcommand, alias = "plugin")]
Plugins(PluginCommands),
#[clap(subcommand, hide = true)]
Expand All @@ -82,13 +89,14 @@ impl SpinApp {
Self::New(cmd) => cmd.run().await,
Self::Add(cmd) => cmd.run().await,
Self::Bindle(cmd) => cmd.run().await,
Self::Registry(cmd) => cmd.run().await,
Self::Cloud(cmd) => cmd.run().await,
Self::Deploy(cmd) => cmd.run().await,
Self::Login(cmd) => cmd.run().await,
Self::Registry(cmd) => cmd.run().await,
Self::Build(cmd) => cmd.run().await,
Self::Trigger(TriggerCommands::Http(cmd)) => cmd.run().await,
Self::Trigger(TriggerCommands::Redis(cmd)) => cmd.run().await,
Self::Trigger(TriggerCommands::HelpArgsOnly(cmd)) => cmd.run().await,
Self::Login(cmd) => cmd.run().await,
Self::Plugins(cmd) => cmd.run().await,
Self::External(cmd) => execute_external_subcommand(cmd, SpinApp::command()).await,
}
Expand Down
6 changes: 4 additions & 2 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
pub mod bindle;
/// Commands for building Spin applications.
pub mod build;
/// Command for deploying a Spin app to Hippo
/// Commands for publishing applications to the Fermyon Platform.
bacongobbler marked this conversation as resolved.
Show resolved Hide resolved
pub mod cloud;
/// Command to package and upload an application to the Fermyon Platform.
pub mod deploy;
/// Commands for external subcommands (i.e. plugins)
pub mod external;
// Command for logging into the server
/// Command for logging into the Fermyon Platform.
pub mod login;
/// Command for creating a new application.
pub mod new;
Expand Down
24 changes: 24 additions & 0 deletions src/commands/cloud.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use anyhow::Result;
use clap::Subcommand;

use super::deploy::DeployCommand;
use super::login::LoginCommand;

/// Commands for publishing applications to the Fermyon Platform.
#[derive(Subcommand, Debug)]
pub enum CloudCommands {
/// Package and upload an application to the Fermyon Platform.
Deploy(DeployCommand),

/// Log into the Fermyon Platform.
Login(LoginCommand),
}

impl CloudCommands {
pub async fn run(self) -> Result<()> {
match self {
Self::Deploy(cmd) => cmd.run().await,
Self::Login(cmd) => cmd.run().await,
}
}
}
2 changes: 1 addition & 1 deletion src/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SPIN_DEPLOY_CHANNEL_NAME: &str = "spin-deploy";

const BINDLE_REGISTRY_URL_PATH: &str = "api/registry";

/// Package and upload Spin artifacts, notifying Hippo
/// Package and upload an application to the Fermyon Platform.
#[derive(Parser, Debug)]
#[clap(about = "Deploy a Spin application")]
pub struct DeployCommand {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const SPIN_CLIENT_ID: &str = "583e63e9-461f-4fbe-a246-23e0fb1cad10";

const DEFAULT_CLOUD_URL: &str = "https://cloud.fermyon.com/";

/// Log into the server
/// Log into the Fermyon Platform.
#[derive(Parser, Debug)]
#[clap(about = "Log into the server")]
pub struct LoginCommand {
Expand Down