Skip to content

Commit

Permalink
Removes hab bldr job commands from hab binary
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Heath <[email protected]>
  • Loading branch information
jasonheath committed Jul 9, 2024
1 parent b4e7dd3 commit ec4f882
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 155 deletions.
18 changes: 0 additions & 18 deletions components/hab/src/cli/hab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ pub enum Hab {
pub enum Bldr {
#[structopt(no_version)]
Channel(Channel),
#[structopt(no_version)]
Job(Job),
}

#[derive(ConfigOpt, StructOpt)]
Expand All @@ -160,22 +158,6 @@ pub enum Channel {
Promote(ChannelPromote),
}

#[derive(ConfigOpt, StructOpt)]
#[structopt(no_version, aliases = &["j", "jo"], settings = &[AppSettings::ArgRequiredElseHelp, AppSettings::SubcommandRequiredElseHelp])]
/// Commands relating to Habitat Builder jobs
pub enum Job {
#[structopt(no_version, aliases = &["c", "ca", "can", "cance"])]
Cancel(JobCancel),
#[structopt(no_version, aliases = &["d", "de", "dem", "demo", "demot"])]
Demote(JobDemote),
#[structopt(no_version, aliases = &["p", "pr", "pro", "prom", "promo", "promot"])]
Promote(JobPromote),
#[structopt(no_version, aliases = &["s", "st", "sta", "star"])]
Start(JobStart),
#[structopt(no_version, aliases = &["stat", "statu"])]
Status(JobStatus),
}

#[derive(ConfigOpt, StructOpt)]
#[structopt(no_version, aliases = &["cl"], settings = &[AppSettings::ArgRequiredElseHelp, AppSettings::SubcommandRequiredElseHelp])]
/// Commands relating to Habitat runtime config
Expand Down
139 changes: 2 additions & 137 deletions components/hab/src/cli/hab/bldr.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
use super::util::{AuthToken,
BldrUrl,
ConfigOptAuthToken,
ConfigOptBldrUrl,
ConfigOptPkgIdent,
PkgIdent};
ConfigOptBldrUrl};
use crate::cli::valid_origin;
use configopt::ConfigOpt;
use habitat_common::cli::PACKAGE_TARGET_ENVVAR;
use habitat_core::package::PackageTarget;
use serde::Serialize;
use structopt::{clap::ArgGroup,
StructOpt};
use structopt::StructOpt;

#[derive(ConfigOpt, StructOpt)]
#[structopt(no_version)]
/// Commands relating to Habitat Builder
pub enum Bldr {
#[structopt(no_version)]
Channel(Channel),
#[structopt(no_version)]
Job(Job),
}

#[derive(ConfigOpt, StructOpt)]
Expand All @@ -33,133 +25,6 @@ pub enum Channel {
Promote(ChannelPromote),
}

#[derive(ConfigOpt, StructOpt, Debug)]
#[configopt(derive(Serialize))]
#[structopt(group = ArgGroup::with_name("status").required(true), no_version)]
pub struct BldrJobStatusSourceGroup {
/// The job group id that was returned from "hab bldr job start" (ex: 771100000000000000)
#[structopt(name = "GROUP_ID", group = "status")]
group_id: Option<String>,
/// Show the status of recent job groups created in this origin (default: 10 most recent)
#[structopt(name = "ORIGIN",
short = "o",
long = "origin",
validator = valid_origin,
group = "status")]
origin: Option<String>,
}

#[derive(ConfigOpt, StructOpt)]
#[structopt(no_version)]
/// Commands relating to Habitat Builder jobs
pub enum Job {
Cancel(JobCancel),
Demote(JobDemote),
Promote(JobPromote),
Start(JobStart),
Status(JobStatus),
}

/// Get the status of one or more job groups
#[derive(ConfigOpt, StructOpt)]
#[structopt(name = "status", no_version)]
pub struct JobStatus {
#[structopt(flatten)]
source: BldrJobStatusSourceGroup,
/// Limit how many job groups to retrieve, ordered by most recent (default: 10)
#[structopt(name = "LIMIT", short = "l", long = "limit")]
limit: Option<usize>,
/// Show the status of all build jobs for a retrieved job group
#[structopt(name = "SHOW_JOBS", short = "s", long = "showjobs")]
show_jobs: bool,
#[structopt(flatten)]
bldr_url: BldrUrl,
}

/// Cancel a build job group and any in-progress builds
#[derive(ConfigOpt, StructOpt)]
#[structopt(name = "cancel", no_version)]
pub struct JobCancel {
/// The job group id that was returned from "hab bldr job start" (ex: 771100000000000000)
#[structopt(name = "GROUP_ID")]
group_id: String,
#[structopt(flatten)]
bldr_url: BldrUrl,
/// Don't prompt for confirmation
#[structopt(name = "FORCE", short = "f", long = "force")]
force: bool,
#[structopt(flatten)]
auth_token: AuthToken,
}

/// Demote packages from a completed build job from a specified channel
#[derive(ConfigOpt, StructOpt)]
#[structopt(name = "demote", no_version)]
pub struct JobDemote {
/// The job group id that was returned from "hab bldr job start" (ex: 771100000000000000)
#[structopt(name = "GROUP_ID")]
group_id: String,
/// The name of the channel to demote from
#[structopt(name = "CHANNEL")]
channel: String,
/// Limit the demotable packages to the specified origin
#[structopt(name = "ORIGIN",
short = "o",
long = "origin",
validator = valid_origin)]
origin: Option<String>,
/// Allow editing the list of demotable packages
#[structopt(name = "INTERACTIVE", short = "i", long = "interactive")]
interactive: bool,
#[structopt(flatten)]
bldr_url: BldrUrl,
#[structopt(flatten)]
auth_token: AuthToken,
}

/// Promote packages from a completed build job to a specified channel
#[derive(ConfigOpt, StructOpt)]
#[structopt(name = "promote", no_version)]
pub struct JobPromote {
/// The job group id that was returned from "hab bldr job start" (ex: 771100000000000000)
#[structopt(name = "GROUP_ID")]
group_id: String,
/// The target channel name
#[structopt(name = "CHANNEL")]
channel: String,
/// Limit the promotable packages to the specified origin
#[structopt(name = "ORIGIN",
short = "o",
long = "origin",
validator = valid_origin)]
origin: Option<String>,
/// Allow editing the list of promotable packages
#[structopt(name = "INTERACTIVE", short = "i", long = "interactive")]
interactive: bool,
#[structopt(flatten)]
bldr_url: BldrUrl,
#[structopt(flatten)]
auth_token: AuthToken,
}

/// Schedule a build job or group of jobs
#[derive(ConfigOpt, StructOpt)]
#[structopt(name = "start", no_version)]
pub struct JobStart {
#[structopt(flatten)]
pkg_ident: PkgIdent,
/// A package target (ex: x86_64-windows) (default: system appropriate target)
#[structopt(name = "PKG_TARGET", env = PACKAGE_TARGET_ENVVAR)]
pkg_target: Option<PackageTarget>,
#[structopt(flatten)]
bldr_url: BldrUrl,
#[structopt(flatten)]
auth_token: AuthToken,
/// Schedule jobs for this package and all of its reverse dependencies
#[structopt(name = "GROUP", short = "g", long = "group")]
group: bool,
}

/// Creates a new channel
#[derive(ConfigOpt, StructOpt)]
#[structopt(name = "create", no_version)]
Expand Down

0 comments on commit ec4f882

Please sign in to comment.