This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved registry cli things to registry cli
Signed-off-by: Brooks Townsend <brooks@cosmonic.com>
- Loading branch information
1 parent
f48daa0
commit 1172806
Showing
5 changed files
with
104 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters