From acf02da383a15f1c8b6179722a3b651345ea17b3 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Fri, 10 May 2024 12:39:05 +0200 Subject: [PATCH 1/5] feat(cli): Make user login while deploying when unauthentiticated + `quiet` flag --- lib/cli/src/commands/app/create.rs | 1 + lib/cli/src/commands/app/deploy.rs | 123 +++++++++++++-------- lib/cli/src/commands/app/util.rs | 60 ++++++++++ lib/cli/src/commands/package/common/mod.rs | 2 +- 4 files changed, 141 insertions(+), 45 deletions(-) diff --git a/lib/cli/src/commands/app/create.rs b/lib/cli/src/commands/app/create.rs index f7045498898..4a3299b1cf8 100644 --- a/lib/cli/src/commands/app/create.rs +++ b/lib/cli/src/commands/app/create.rs @@ -366,6 +366,7 @@ impl CmdAppCreate { .interact()?) { let cmd_deploy = CmdAppDeploy { + quiet: false, api: self.api.clone(), env: self.env.clone(), fmt: ItemFormatOpts { diff --git a/lib/cli/src/commands/app/deploy.rs b/lib/cli/src/commands/app/deploy.rs index 450d9012a6b..5a825ced171 100644 --- a/lib/cli/src/commands/app/deploy.rs +++ b/lib/cli/src/commands/app/deploy.rs @@ -1,4 +1,4 @@ -use super::AsyncCliCommand; +use super::{util::login_user, AsyncCliCommand}; use crate::{ commands::{app::create::CmdAppCreate, package::publish::PackagePublish, PublishWait}, opts::{ApiOpts, ItemFormatOpts, WasmerEnv}, @@ -82,6 +82,13 @@ pub struct CmdAppDeploy { /// Whether or not to automatically bump the package version if publishing. #[clap(long)] pub bump: bool, + + /// Don't print any message. + /// + /// The only message that will be printed is the one signaling the successfullness of the + /// operation. + #[clap(long)] + pub quiet: bool, } impl CmdAppDeploy { @@ -102,7 +109,7 @@ impl CmdAppDeploy { let publish_cmd = PackagePublish { env: self.env.clone(), dry_run: false, - quiet: false, + quiet: self.quiet, package_name: None, package_version: None, no_validate: false, @@ -146,7 +153,7 @@ impl CmdAppDeploy { anyhow::bail!("No owner specified: use --owner XXX"); } - match self.api.client() { + match login_user(&self.api, &self.env, !self.non_interactive, "deploy an app").await { Ok(client) => { let user = wasmer_api::query::current_user_with_namespaces(&client, None).await?; let owner = crate::utils::prompts::prompt_for_namespace( @@ -272,8 +279,12 @@ impl AsyncCliCommand for CmdAppDeploy { format!("Could not read file '{}'", &app_config_path.display()) })?; } else { - eprintln!("The app.yaml does not specify any app name."); - eprintln!("Please, use the --app_name to specify the name of the app."); + if !self.quiet { + eprintln!("The app.yaml does not specify any app name."); + eprintln!( + "Please, use the --app_name to specify the name of the app." + ); + } anyhow::bail!( "Cannot proceed with the deployment as the app spec in path {} does not have @@ -297,17 +308,19 @@ impl AsyncCliCommand for CmdAppDeploy { let mut app_cfg_new = app_config.clone(); let opts = match &app_cfg_new.package { PackageSource::Path(ref path) => { - eprintln!( - "Loading local package (manifest path: {})", - PathBuf::from(path) - .canonicalize()? - .join("wasmer.toml") - .display() - ); - - let package_id = self - .publish(&client, owner.clone(), PathBuf::from(path)) - .await?; + let path = PathBuf::from(path); + + let path = if path.is_absolute() { + path + } else { + app_config_path.parent().unwrap().join(path) + }; + + if !self.quiet { + eprintln!("Loading local package (manifest path: {})", path.display()); + } + + let package_id = self.publish(&client, owner.clone(), path).await?; app_cfg_new.package = package_id.into(); @@ -331,16 +344,20 @@ impl AsyncCliCommand for CmdAppDeploy { if let Some(package) = &manifest.package { if let Some(name) = &package.name { if name == &n.full_name() { - eprintln!( - "Found local package (manifest path: {}).", - manifest_path.display() - ); - eprintln!("The `package` field in `app.yaml` specified the same named package ({}).", name); - eprintln!("This behaviour is deprecated."); + if !self.quiet { + eprintln!( + "Found local package (manifest path: {}).", + manifest_path.display() + ); + eprintln!("The `package` field in `app.yaml` specified the same named package ({}).", name); + eprintln!("This behaviour is deprecated."); + } let theme = dialoguer::theme::ColorfulTheme::default(); if self.non_interactive { - eprintln!("Hint: replace `package: {}` with `package: .` to replicate the intended behaviour.", n); + if !self.quiet { + eprintln!("Hint: replace `package: {}` with `package: .` to replicate the intended behaviour.", n); + } anyhow::bail!("deprecated deploy behaviour") } else if Confirm::with_theme(&theme) .with_prompt("Change package to '.' in app.yaml?") @@ -380,10 +397,11 @@ impl AsyncCliCommand for CmdAppDeploy { wait, } } else { - eprintln!( + if !self.quiet { + eprintln!( "{}: the package will not be published and the deployment will fail if the package does not already exist.", - "Warning".yellow().bold() - ); + "Warning".yellow().bold()); + } DeployAppOpts { app: &app_config, original_config: Some( @@ -461,7 +479,9 @@ impl AsyncCliCommand for CmdAppDeploy { app.name.bold().to_string() }; - eprintln!("\nDeploying app {} to Wasmer Edge...\n", pretty_name); + if !self.quiet { + eprintln!("\nDeploying app {} to Wasmer Edge...\n", pretty_name); + } let app_version = deploy_app(&client, opts.clone()).await?; @@ -490,7 +510,7 @@ impl AsyncCliCommand for CmdAppDeploy { })?; } - wait_app(&client, opts.clone(), app_version.clone()).await?; + wait_app(&client, opts.clone(), app_version.clone(), self.quiet).await?; if self.fmt.format == crate::utils::render::ItemFormat::Json { println!("{}", serde_json::to_string_pretty(&app_version)?); @@ -558,6 +578,7 @@ pub async fn wait_app( client: &WasmerClient, opts: DeployAppOpts<'_>, version: DeployAppVersion, + quiet: bool, ) -> Result<(DeployApp, DeployAppVersion), anyhow::Error> { let wait = opts.wait; let make_default = opts.make_default; @@ -574,22 +595,26 @@ pub async fn wait_app( .await .context("could not fetch app from backend")?; - eprintln!( - "App {} ({}) was successfully deployed 🚀", - app.name.bold(), - app.owner.global_name.bold() - ); - eprintln!("{}", app.url.blue().bold().underline()); - eprintln!(); - eprintln!("→ Unique URL: {}", version.url); - eprintln!("→ Dashboard: {}", app.admin_url); + if !quiet { + eprintln!( + "App {} ({}) was successfully deployed 🚀", + app.name.bold(), + app.owner.global_name.bold() + ); + eprintln!("{}", app.url.blue().bold().underline()); + eprintln!(); + eprintln!("→ Unique URL: {}", version.url); + eprintln!("→ Dashboard: {}", app.admin_url); + } match wait { WaitMode::Deployed => {} WaitMode::Reachable => { - eprintln!(); - eprintln!("Waiting for new deployment to become available..."); - eprintln!("(You can safely stop waiting now with CTRL-C)"); + if !quiet { + eprintln!(); + eprintln!("Waiting for new deployment to become available..."); + eprintln!("(You can safely stop waiting now with CTRL-C)"); + } let stderr = std::io::stderr(); @@ -604,13 +629,18 @@ pub async fn wait_app( loop { let total_elapsed = start.elapsed(); if total_elapsed > Duration::from_secs(60 * 5) { - eprintln!(); + if !quiet { + eprintln!(); + } anyhow::bail!("\nApp still not reachable after 5 minutes..."); } { let mut lock = stderr.lock(); - write!(&mut lock, ".").unwrap(); + + if !quiet { + write!(&mut lock, ".").unwrap(); + } lock.flush().unwrap(); } @@ -625,8 +655,13 @@ pub async fn wait_app( .unwrap_or_default(); if header == version.id.inner() { - eprintln!("\nNew version is now reachable at {check_url}"); - eprintln!("{} Deployment complete", "✔".green().bold()); + if !quiet { + eprintln!(); + } + eprintln!( + "{} Deployment complete, new version reachable at {check_url}", + "𖥔".yellow().bold() + ); break; } diff --git a/lib/cli/src/commands/app/util.rs b/lib/cli/src/commands/app/util.rs index 8496e7a8898..04d504eb005 100644 --- a/lib/cli/src/commands/app/util.rs +++ b/lib/cli/src/commands/app/util.rs @@ -1,4 +1,6 @@ use anyhow::{bail, Context}; +use colored::Colorize; +use dialoguer::Confirm; use wasmer_api::{ global_id::{GlobalId, NodeKind}, types::DeployApp, @@ -6,6 +8,11 @@ use wasmer_api::{ }; use wasmer_config::app::AppConfigV1; +use crate::{ + commands::Login, + opts::{ApiOpts, WasmerEnv}, +}; + /// App identifier. /// /// Can be either a namespace/name a plain name or an app id. @@ -184,3 +191,56 @@ mod tests { ); } } + +pub(super) async fn login_user( + api: &ApiOpts, + env: &WasmerEnv, + interactive: bool, + msg: &str, +) -> anyhow::Result { + if let Ok(client) = api.client() { + return Ok(client); + } + + let theme = dialoguer::theme::ColorfulTheme::default(); + + if api.token.is_none() { + if interactive { + eprintln!( + "{}: You need to be logged in to {msg}.", + "WARN".yellow().bold() + ); + + if Confirm::with_theme(&theme) + .with_prompt("Do you want to login now?") + .interact()? + { + Login { + no_browser: false, + wasmer_dir: env.wasmer_dir.clone(), + registry: api + .registry + .clone() + .map(|l| wasmer_registry::wasmer_env::Registry::from(l.to_string())), + token: api.token.clone(), + cache_dir: Some(env.cache_dir.clone()), + } + .run_async() + .await?; + // self.api = ApiOpts::default(); + } else { + anyhow::bail!("Stopping the flow as the user is not logged in.") + } + } else { + let bin_name = match std::env::args().nth(0) { + Some(n) => n, + None => String::from("wasmer"), + }; + eprintln!("You are not logged in. Use the `--token` flag or log in (use `{bin_name} login`) to {msg}."); + + anyhow::bail!("Stopping execution as the user is not logged in.") + } + } + + api.client() +} diff --git a/lib/cli/src/commands/package/common/mod.rs b/lib/cli/src/commands/package/common/mod.rs index 552ea9a9e7e..842df8a34e1 100644 --- a/lib/cli/src/commands/package/common/mod.rs +++ b/lib/cli/src/commands/package/common/mod.rs @@ -196,7 +196,7 @@ pub(super) async fn login_user( .await?; // self.api = ApiOpts::default(); } else { - anyhow::bail!("Stopping the push flow as the user is not logged in.") + anyhow::bail!("Stopping the flow as the user is not logged in.") } } else { let bin_name = self::macros::bin_name!(); From 4b6d790edcd1884e9ade4a71646b60ae45904c06 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Fri, 10 May 2024 12:48:55 +0200 Subject: [PATCH 2/5] fix(cli): move around client resolution in deploy --- lib/cli/src/commands/app/deploy.rs | 38 +++++++++++------------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/lib/cli/src/commands/app/deploy.rs b/lib/cli/src/commands/app/deploy.rs index 5a825ced171..52c7c8787ef 100644 --- a/lib/cli/src/commands/app/deploy.rs +++ b/lib/cli/src/commands/app/deploy.rs @@ -135,6 +135,7 @@ impl CmdAppDeploy { async fn get_owner( &self, + client: &WasmerClient, app: &serde_yaml::Value, app_config_path: &PathBuf, ) -> anyhow::Result<(String, String)> { @@ -153,28 +154,19 @@ impl CmdAppDeploy { anyhow::bail!("No owner specified: use --owner XXX"); } - match login_user(&self.api, &self.env, !self.non_interactive, "deploy an app").await { - Ok(client) => { - let user = wasmer_api::query::current_user_with_namespaces(&client, None).await?; - let owner = crate::utils::prompts::prompt_for_namespace( - "Who should own this app?", - None, - Some(&user), - )?; - - let new_raw_config = format!("owner: {owner}\n{r_ret}"); + let user = wasmer_api::query::current_user_with_namespaces(&client, None).await?; + let owner = crate::utils::prompts::prompt_for_namespace( + "Who should own this app?", + None, + Some(&user), + )?; - std::fs::write(app_config_path, &new_raw_config).with_context(|| { - format!("Could not write file: '{}'", app_config_path.display()) - })?; + let new_raw_config = format!("owner: {owner}\n{r_ret}"); - Ok((owner.clone(), new_raw_config)) + std::fs::write(app_config_path, &new_raw_config) + .with_context(|| format!("Could not write file: '{}'", app_config_path.display()))?; - } - Err(e) => anyhow::bail!( - "Can't determine user info: {e}. Please, user `wasmer login` before deploying an app or use the --owner flag to signal the owner of the app to deploy." - ), - } + Ok((owner.clone(), new_raw_config)) } async fn create(&self) -> anyhow::Result<()> { eprintln!("It seems you are trying to create a new app!"); @@ -208,10 +200,8 @@ impl AsyncCliCommand for CmdAppDeploy { type Output = (); async fn run_async(self) -> Result { - let client = self - .api - .client() - .with_context(|| "Can't begin deploy flow")?; + let client = + login_user(&self.api, &self.env, !self.non_interactive, "deploy an app").await?; let base_dir_path = self.path.clone().unwrap_or(std::env::current_dir()?); let (app_config_path, base_dir_path) = { @@ -248,7 +238,7 @@ impl AsyncCliCommand for CmdAppDeploy { // We want to allow the user to specify the app name interactively. let app_yaml: serde_yaml::Value = serde_yaml::from_str(&config_str)?; - let (owner, mut config_str) = self.get_owner(&app_yaml, &app_config_path).await?; + let (owner, mut config_str) = self.get_owner(&client, &app_yaml, &app_config_path).await?; // We want to allow the user to specify the app name interactively. let app_yaml: serde_yaml::Value = serde_yaml::from_str(&config_str)?; From 25586e7b34a1924b78de190b7279e77f76bbb644 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Fri, 10 May 2024 14:08:29 +0200 Subject: [PATCH 3/5] feat(cli): php and static website deployment integration tests --- tests/integration/cli/tests/deploy.rs | 177 ++++++++++++++++++ .../cli/tests/packages/php/app.yaml | 2 + .../cli/tests/packages/php/app/index.php | 3 + .../tests/packages/static_website/app.yaml | 3 + .../packages/static_website/public/index.html | 1 + 5 files changed, 186 insertions(+) create mode 100644 tests/integration/cli/tests/deploy.rs create mode 100644 tests/integration/cli/tests/packages/php/app.yaml create mode 100644 tests/integration/cli/tests/packages/php/app/index.php create mode 100644 tests/integration/cli/tests/packages/static_website/app.yaml create mode 100644 tests/integration/cli/tests/packages/static_website/public/index.html diff --git a/tests/integration/cli/tests/deploy.rs b/tests/integration/cli/tests/deploy.rs new file mode 100644 index 00000000000..99dba780725 --- /dev/null +++ b/tests/integration/cli/tests/deploy.rs @@ -0,0 +1,177 @@ +use assert_cmd::prelude::OutputAssertExt; +use std::{ + fs::OpenOptions, + path::{Path, PathBuf}, +}; +use wasmer_integration_tests_cli::get_wasmer_path; + +fn project_root() -> &'static Path { + Path::new(env!("CARGO_MANIFEST_DIR")) + .ancestors() + .nth(3) + .unwrap() +} + +fn copy_dir_all(src: impl AsRef, dst: impl AsRef) -> std::io::Result<()> { + std::fs::create_dir_all(&dst)?; + for entry in std::fs::read_dir(src)? { + let entry = entry?; + let ty = entry.file_type()?; + if ty.is_dir() { + copy_dir_all(entry.path(), dst.as_ref().join(entry.file_name()))?; + } else { + std::fs::copy(entry.path(), dst.as_ref().join(entry.file_name()))?; + } + } + Ok(()) +} + +#[test] +fn wasmer_deploy_php() -> anyhow::Result<()> { + // Only run this test in the CI + // if std::env::var("GITHUB_TOKEN").is_err() { + // return Ok(()); + // } + + let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").ok(); + + let username = "ciuser"; + let app_name = format!("ci-php-replica-{}", rand::random::()); + let random3 = format!("{}", rand::random::()); + + let php_app_dir = project_root() + .join("tests") + .join("integration") + .join("cli") + .join("tests") + .join("packages") + .join("php"); + + let tempdir = tempfile::tempdir()?; + let app_dir = tempdir.path(); + + let mut cmd = std::process::Command::new("cp"); + cmd.arg("-r") + .arg(format!("{}", php_app_dir.display())) + .arg(format!("{}", app_dir.display())) + .output()?; + + let app_dir = app_dir.join("php"); + + let mut cmd = std::process::Command::new(get_wasmer_path()); + cmd.arg("deploy") + .arg("--quiet") + .arg(format!("--app-name={app_name}")) + .arg(format!("--owner={username}")) + .arg(format!("--path={}", app_dir.display())) + .arg("--registry=https://registry.wasmer.wtf/graphql"); + + if let Some(token) = wapm_dev_token { + // Special case: GitHub secrets aren't visible to outside collaborators + if token.is_empty() { + return Ok(()); + } + cmd.arg("--token").arg(token); + } + + let app_url = format!("https://{app_name}-{username}.wasmer.dev"); + + cmd.assert() + .success() + .stderr(predicates::boolean::AndPredicate::new( + predicates::str::contains("Deployment complete"), + predicates::str::contains(&app_url), + )); + + let r = reqwest::blocking::Client::new(); + let r = r.get(app_url).query(&[("ci_rand", &random3)]).send()?; + let r = r.text()?; + + assert!(r.contains(&random3)); + + Ok(()) +} + +#[test] +fn wasmer_deploy_static_website() -> anyhow::Result<()> { + // Only run this test in the CI + //if std::env::var("GITHUB_TOKEN").is_err() { + // return Ok(()); + //} + + let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").ok(); + + let username = "ciuser"; + let app_name = format!("ci-static-website-replica-{}", rand::random::()); + let random3 = format!("{}", rand::random::()); + + let src_app_dir = project_root() + .join("tests") + .join("integration") + .join("cli") + .join("tests") + .join("packages") + .join("static_website"); + + let tempdir = tempfile::tempdir()?; + let app_dir = tempdir.path(); + + let mut cmd = std::process::Command::new("cp"); + cmd.arg("-r") + .arg(format!("{}", src_app_dir.display())) + .arg(format!("{}", app_dir.display())) + .output()?; + + let app_dir = app_dir.join("static_website"); + + let mut cmd = std::process::Command::new("sed"); + cmd.arg("-r") + .arg(format!("{}", src_app_dir.display())) + .arg(format!("{}", app_dir.display())) + .output()?; + + let index_file_path = app_dir.join("public").join("index.html"); + let contents = std::fs::read_to_string(&index_file_path)?; + let new = contents.replace("RANDOM_NUMBER", &random3); + + let mut file = OpenOptions::new() + .write(true) + .truncate(true) + .open(index_file_path)?; + + std::io::Write::write(&mut file, new.as_bytes())?; + + let mut cmd = std::process::Command::new(get_wasmer_path()); + cmd.arg("deploy") + // .arg("--quiet") + .arg("-vvvvv") + .arg(format!("--app-name={app_name}")) + .arg(format!("--owner={username}")) + .arg(format!("--path={}", app_dir.display())) + .arg("--registry=https://registry.wasmer.wtf/graphql"); + + if let Some(token) = wapm_dev_token { + // Special case: GitHub secrets aren't visible to outside collaborators + if token.is_empty() { + return Ok(()); + } + cmd.arg("--token").arg(token); + } + + let app_url = format!("https://{app_name}-{username}.wasmer.dev"); + + cmd.assert() + .success() + .stderr(predicates::boolean::AndPredicate::new( + predicates::str::contains("Deployment complete"), + predicates::str::contains(&app_url), + )); + + let r = reqwest::blocking::Client::new(); + let r = r.get(app_url).send()?; + let r = r.text()?; + + assert!(r.contains(&random3)); + + Ok(()) +} diff --git a/tests/integration/cli/tests/packages/php/app.yaml b/tests/integration/cli/tests/packages/php/app.yaml new file mode 100644 index 00000000000..73a43009264 --- /dev/null +++ b/tests/integration/cli/tests/packages/php/app.yaml @@ -0,0 +1,2 @@ +kind: wasmer.io/App.v0 +package: . diff --git a/tests/integration/cli/tests/packages/php/app/index.php b/tests/integration/cli/tests/packages/php/app/index.php new file mode 100644 index 00000000000..f581aba36ae --- /dev/null +++ b/tests/integration/cli/tests/packages/php/app/index.php @@ -0,0 +1,3 @@ + diff --git a/tests/integration/cli/tests/packages/static_website/app.yaml b/tests/integration/cli/tests/packages/static_website/app.yaml new file mode 100644 index 00000000000..3685ae8212e --- /dev/null +++ b/tests/integration/cli/tests/packages/static_website/app.yaml @@ -0,0 +1,3 @@ +kind: wasmer.io/App.v0 +package: . +debug: false diff --git a/tests/integration/cli/tests/packages/static_website/public/index.html b/tests/integration/cli/tests/packages/static_website/public/index.html new file mode 100644 index 00000000000..b74845c5ea3 --- /dev/null +++ b/tests/integration/cli/tests/packages/static_website/public/index.html @@ -0,0 +1 @@ +RANDOM_NUMBER From d12c6cd21d045cbf09a3f367c3c4e2980295909f Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Fri, 10 May 2024 14:09:12 +0200 Subject: [PATCH 4/5] fix(cli): run deploy integration tests only in gh --- tests/integration/cli/tests/deploy.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integration/cli/tests/deploy.rs b/tests/integration/cli/tests/deploy.rs index 99dba780725..5663042a15e 100644 --- a/tests/integration/cli/tests/deploy.rs +++ b/tests/integration/cli/tests/deploy.rs @@ -29,9 +29,9 @@ fn copy_dir_all(src: impl AsRef, dst: impl AsRef) -> std::io::Result #[test] fn wasmer_deploy_php() -> anyhow::Result<()> { // Only run this test in the CI - // if std::env::var("GITHUB_TOKEN").is_err() { - // return Ok(()); - // } + if std::env::var("GITHUB_TOKEN").is_err() { + return Ok(()); + } let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").ok(); @@ -94,10 +94,10 @@ fn wasmer_deploy_php() -> anyhow::Result<()> { #[test] fn wasmer_deploy_static_website() -> anyhow::Result<()> { - // Only run this test in the CI - //if std::env::var("GITHUB_TOKEN").is_err() { - // return Ok(()); - //} + Only run this test in the CI + if std::env::var("GITHUB_TOKEN").is_err() { + return Ok(()); + } let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").ok(); From c98f060c8a2ee8aa38004d2c4b9a8e4a1202367a Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Fri, 10 May 2024 14:14:30 +0200 Subject: [PATCH 5/5] fix(cli): make linter happy --- lib/cli/src/commands/app/deploy.rs | 2 +- lib/cli/src/commands/app/util.rs | 2 +- tests/integration/cli/tests/deploy.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cli/src/commands/app/deploy.rs b/lib/cli/src/commands/app/deploy.rs index 52c7c8787ef..3e42f5a834b 100644 --- a/lib/cli/src/commands/app/deploy.rs +++ b/lib/cli/src/commands/app/deploy.rs @@ -154,7 +154,7 @@ impl CmdAppDeploy { anyhow::bail!("No owner specified: use --owner XXX"); } - let user = wasmer_api::query::current_user_with_namespaces(&client, None).await?; + let user = wasmer_api::query::current_user_with_namespaces(client, None).await?; let owner = crate::utils::prompts::prompt_for_namespace( "Who should own this app?", None, diff --git a/lib/cli/src/commands/app/util.rs b/lib/cli/src/commands/app/util.rs index 04d504eb005..c9b110c13a0 100644 --- a/lib/cli/src/commands/app/util.rs +++ b/lib/cli/src/commands/app/util.rs @@ -232,7 +232,7 @@ pub(super) async fn login_user( anyhow::bail!("Stopping the flow as the user is not logged in.") } } else { - let bin_name = match std::env::args().nth(0) { + let bin_name = match std::env::args().next() { Some(n) => n, None => String::from("wasmer"), }; diff --git a/tests/integration/cli/tests/deploy.rs b/tests/integration/cli/tests/deploy.rs index 5663042a15e..ad98b4abbc9 100644 --- a/tests/integration/cli/tests/deploy.rs +++ b/tests/integration/cli/tests/deploy.rs @@ -94,7 +94,7 @@ fn wasmer_deploy_php() -> anyhow::Result<()> { #[test] fn wasmer_deploy_static_website() -> anyhow::Result<()> { - Only run this test in the CI + // Only run this test in the CI if std::env::var("GITHUB_TOKEN").is_err() { return Ok(()); }