Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Release v0.18.0 #614

Merged
merged 5 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: release/windows/wash.exe
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
generate_release_notes: true
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: true
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wash-cli"
version = "0.18.0-alpha.3"
version = "0.18.0"
authors = ["wasmCloud Team"]
categories = ["wasm", "command-line-utilities"]
description = "wasmcloud Shell (wash) CLI tool"
Expand Down Expand Up @@ -140,7 +140,7 @@ toml = "0.7.4"
wadm = "0.4.0"
walkdir = "2.3"
wascap = "0.10.1"
wash-lib = { version = "0.9.0-alpha.3", path = "./crates/wash-lib" }
wash-lib = { version = "0.9.0", path = "./crates/wash-lib" }
wasmbus-rpc = "0.13.0"
wasmcloud-control-interface = "0.25"
wasmcloud-test-util = "0.6.4"
Expand Down
2 changes: 1 addition & 1 deletion crates/wash-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wash-lib"
version = "0.9.0-alpha.3"
version = "0.9.0"
authors = ["wasmCloud Team"]
categories = ["wasm", "wasmcloud"]
description = "wasmcloud Shell (wash) libraries"
Expand Down
1 change: 1 addition & 0 deletions crates/wash-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub mod get;
pub mod inspect;
pub mod link;
pub mod output;
pub mod registry;
pub mod spy;
pub mod start;
pub mod stop;
Expand Down
97 changes: 97 additions & 0 deletions crates/wash-lib/src/cli/registry.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
use clap::{Parser, Subcommand};

#[derive(Parser, Debug, Clone)]
pub struct AuthOpts {
/// OCI username, if omitted anonymous authentication will be used
#[clap(
short = 'u',
long = "user",
env = "WASH_REG_USER",
hide_env_values = true
)]
pub user: Option<String>,

/// OCI password, if omitted anonymous authentication will be used
#[clap(
short = 'p',
long = "password",
env = "WASH_REG_PASSWORD",
hide_env_values = true
)]
pub password: Option<String>,

/// Allow insecure (HTTP) registry connections
#[clap(long = "insecure")]
pub insecure: bool,
}

#[derive(Debug, Clone, Subcommand)]
pub enum RegistryCommand {
/// Pull an artifact from an OCI compliant registry
#[clap(name = "pull")]
Pull(RegistryPullCommand),
/// Push an artifact to an OCI compliant registry
#[clap(name = "push")]
Push(RegistryPushCommand),
/// Ping (test url) to see if the OCI url has an artifact
#[clap(name = "ping")]
Ping(RegistryPingCommand),
}

#[derive(Parser, Debug, Clone)]
pub struct RegistryPullCommand {
/// URL of artifact
#[clap(name = "url")]
pub url: String,

/// File destination of artifact
#[clap(long = "destination")]
pub destination: Option<String>,

/// Digest to verify artifact against
#[clap(short = 'd', long = "digest")]
pub digest: Option<String>,

/// Allow latest artifact tags
#[clap(long = "allow-latest")]
pub allow_latest: bool,

#[clap(flatten)]
pub opts: AuthOpts,
}

#[derive(Parser, Debug, Clone)]
pub struct RegistryPushCommand {
/// URL to push artifact to
#[clap(name = "url")]
pub url: String,

/// Path to artifact to push
#[clap(name = "artifact")]
pub artifact: String,

/// Path to config file, if omitted will default to a blank configuration
#[clap(short = 'c', long = "config")]
pub config: Option<String>,

/// Allow latest artifact tags
#[clap(long = "allow-latest")]
pub allow_latest: bool,

/// Optional set of annotations to apply to the OCI artifact manifest
#[clap(short = 'a', long = "annotation", name = "annotations")]
pub annotations: Option<Vec<String>>,

#[clap(flatten)]
pub opts: AuthOpts,
}

#[derive(Parser, Debug, Clone)]
pub struct RegistryPingCommand {
/// URL of artifact
#[clap(name = "url")]
pub url: String,

#[clap(flatten)]
pub opts: AuthOpts,
}
98 changes: 0 additions & 98 deletions crates/wash-lib/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use std::{
};

use anyhow::{anyhow, bail, Result};
#[cfg(feature = "cli")]
use clap::{Parser, Subcommand};
use oci_distribution::manifest::OciImageManifest;
use oci_distribution::{
client::{Client, ClientConfig, ClientProtocol, Config, ImageLayer},
Expand Down Expand Up @@ -69,102 +67,6 @@ pub enum SupportedArtifacts {
Wasm,
}

#[derive(Parser, Debug, Clone)]
pub struct AuthOpts {
/// OCI username, if omitted anonymous authentication will be used
#[clap(
short = 'u',
long = "user",
env = "WASH_REG_USER",
hide_env_values = true
)]
pub user: Option<String>,

/// OCI password, if omitted anonymous authentication will be used
#[clap(
short = 'p',
long = "password",
env = "WASH_REG_PASSWORD",
hide_env_values = true
)]
pub password: Option<String>,

/// Allow insecure (HTTP) registry connections
#[clap(long = "insecure")]
pub insecure: bool,
}

#[derive(Debug, Clone, Subcommand)]
pub enum RegistryCommand {
/// Pull an artifact from an OCI compliant registry
#[clap(name = "pull")]
Pull(RegistryPullCommand),
/// Push an artifact to an OCI compliant registry
#[clap(name = "push")]
Push(RegistryPushCommand),
/// Ping (test url) to see if the OCI url has an artifact
#[clap(name = "ping")]
Ping(RegistryPingCommand),
}

#[derive(Parser, Debug, Clone)]
pub struct RegistryPullCommand {
/// URL of artifact
#[clap(name = "url")]
pub url: String,

/// File destination of artifact
#[clap(long = "destination")]
pub destination: Option<String>,

/// Digest to verify artifact against
#[clap(short = 'd', long = "digest")]
pub digest: Option<String>,

/// Allow latest artifact tags
#[clap(long = "allow-latest")]
pub allow_latest: bool,

#[clap(flatten)]
pub opts: AuthOpts,
}

#[derive(Parser, Debug, Clone)]
pub struct RegistryPushCommand {
/// URL to push artifact to
#[clap(name = "url")]
pub url: String,

/// Path to artifact to push
#[clap(name = "artifact")]
pub artifact: String,

/// Path to config file, if omitted will default to a blank configuration
#[clap(short = 'c', long = "config")]
pub config: Option<String>,

/// Allow latest artifact tags
#[clap(long = "allow-latest")]
pub allow_latest: bool,

/// Optional set of annotations to apply to the OCI artifact manifest
#[clap(short = 'a', long = "annotation", name = "annotations")]
pub annotations: Option<Vec<String>>,

#[clap(flatten)]
pub opts: AuthOpts,
}

#[derive(Parser, Debug, Clone)]
pub struct RegistryPingCommand {
/// URL of artifact
#[clap(name = "url")]
pub url: String,

#[clap(flatten)]
pub opts: AuthOpts,
}

// NOTE(thomastaylor312): In later refactors, we might want to consider making some sort of puller
// and pusher structs that can take optional implementations of a `Cache` trait that does all the
// cached file handling. But for now, this should be good enough
Expand Down
9 changes: 5 additions & 4 deletions src/common/registry_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ use oci_distribution::{
use serde_json::json;
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
use wash_lib::cli::{
labels_vec_to_hashmap,
registry::{RegistryCommand, RegistryPingCommand, RegistryPullCommand, RegistryPushCommand},
CommandOutput, OutputKind,
};
use wash_lib::registry::{
pull_oci_artifact, push_oci_artifact, validate_artifact, OciPullOptions, OciPushOptions,
SupportedArtifacts,
};
use wash_lib::{
cli::{labels_vec_to_hashmap, CommandOutput, OutputKind},
registry::{RegistryCommand, RegistryPingCommand, RegistryPullCommand, RegistryPushCommand},
};

use crate::appearance::spinner::Spinner;

Expand Down
4 changes: 3 additions & 1 deletion src/down/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ where
let signal = if pid_file.is_file() {
format!("stop={}", &pid_file.display())
} else {
"stop".into()
return Err(anyhow::anyhow!(
"No pidfile found for nats-server, assuming it's managed externally"
));
};
let output = Command::new(bin_path)
.arg("--signal")
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ use wash_lib::{
get::GetCommand,
inspect::InspectCliCommand,
link::LinkCommand,
registry::{RegistryCommand, RegistryPullCommand, RegistryPushCommand},
spy::SpyCommand,
start::StartCommand,
stop::StopCommand,
CommandOutput, OutputKind,
},
drain::Drain as DrainSelection,
registry::{RegistryCommand, RegistryPullCommand, RegistryPushCommand},
};

use app::AppCliCommand;
Expand Down