Skip to content

Commit

Permalink
feat(dre): Add forum post link to commands for proposal discussion (#830
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sasa-tomic authored Aug 30, 2024
1 parent 5f97beb commit 7c8f4be
Show file tree
Hide file tree
Showing 25 changed files with 98 additions and 23 deletions.
1 change: 1 addition & 0 deletions rs/cli/src/commands/api_boundary_nodes/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl ExecutableCommand for Add {
title: Some(format!("Add {} API boundary node(s)", self.nodes.len())),
summary: Some(format!("Add {} API boundary node(s)", self.nodes.len())),
motivation: self.motivation.clone(),
forum_post_link: ctx.forum_post_link(),
},
)
.await?;
Expand Down
1 change: 1 addition & 0 deletions rs/cli/src/commands/api_boundary_nodes/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ impl ExecutableCommand for Remove {
title: Some(format!("Remove {} API boundary node(s)", self.nodes.len())),
summary: Some(format!("Remove {} API boundary node(s)", self.nodes.len())),
motivation: self.motivation.clone(),
forum_post_link: ctx.forum_post_link(),
},
)
.await?;
Expand Down
1 change: 1 addition & 0 deletions rs/cli/src/commands/api_boundary_nodes/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ impl ExecutableCommand for Update {
title: Some(format!("Update {} API boundary node(s) to {}", self.nodes.len(), &self.version)),
summary: Some(format!("Update {} API boundary node(s) to {}", self.nodes.len(), &self.version)),
motivation: self.motivation.clone(),
forum_post_link: ctx.forum_post_link(),
},
)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion rs/cli/src/commands/heal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl ExecutableCommand for Heal {

async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
let runner = ctx.runner().await;
runner.network_heal().await
runner.network_heal(ctx.forum_post_link()).await
}

fn validate(&self, _cmd: &mut clap::Command) {}
Expand Down
4 changes: 3 additions & 1 deletion rs/cli/src/commands/hostos/rollout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ impl ExecutableCommand for Rollout {

async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
let runner = ctx.runner().await;
runner.hostos_rollout(self.nodes.clone(), &self.version, None).await
runner
.hostos_rollout(self.nodes.clone(), &self.version, None, ctx.forum_post_link())
.await
}

fn validate(&self, _cmd: &mut clap::Command) {}
Expand Down
4 changes: 3 additions & 1 deletion rs/cli/src/commands/hostos/rollout_from_node_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ impl ExecutableCommand for RolloutFromNodeGroup {
.hostos_rollout_nodes(update_group, &self.version, &self.only, &self.exclude)
.await?
{
return runner.hostos_rollout(nodes_to_update, &self.version, Some(summary)).await;
return runner
.hostos_rollout(nodes_to_update, &self.version, Some(summary), ctx.forum_post_link())
.await;
}

Ok(())
Expand Down
4 changes: 4 additions & 0 deletions rs/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ The argument is mandatory for testnets, and is optional for mainnet and staging"
/// Useful for when the nns is unreachable
#[clap(long)]
pub no_sync: bool,

/// Link to the related forum post, where proposal details can be discussed
#[clap(long, global = true, visible_aliases = &["forum-link", "forum"])]
pub forum_post_link: Option<String>,
}

macro_rules! impl_executable_command_for_enums {
Expand Down
1 change: 1 addition & 0 deletions rs/cli/src/commands/nodes/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl ExecutableCommand for Remove {
extra_nodes_filter: self.extra_nodes_filter.clone(),
exclude: Some(self.exclude.clone()),
motivation: self.motivation.clone().unwrap_or_default(),
forum_post_link: ctx.forum_post_link(),
})
.await
}
Expand Down
1 change: 1 addition & 0 deletions rs/cli/src/commands/subnet/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl ExecutableCommand for Create {
include: self.include.clone().into(),
},
motivation.to_string(),
ctx.forum_post_link(),
self.replica_version.clone(),
self.other_args.to_owned(),
self.help_other_args,
Expand Down
2 changes: 1 addition & 1 deletion rs/cli/src/commands/subnet/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl ExecutableCommand for Deploy {

async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
let runner = ctx.runner().await;
runner.deploy(&self.id, &self.version).await
runner.deploy(&self.id, &self.version, ctx.forum_post_link()).await
}

fn validate(&self, _cmd: &mut clap::Command) {}
Expand Down
2 changes: 1 addition & 1 deletion rs/cli/src/commands/subnet/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl ExecutableCommand for Replace {

let runner = ctx.runner().await;

runner.propose_subnet_change(subnet_change_response).await
runner.propose_subnet_change(subnet_change_response, ctx.forum_post_link()).await
}

fn validate(&self, cmd: &mut clap::Command) {
Expand Down
2 changes: 1 addition & 1 deletion rs/cli/src/commands/subnet/rescue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl ExecutableCommand for Rescue {
async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
let runner = ctx.runner().await;

runner.subnet_rescue(&self.id, self.keep_nodes.clone()).await
runner.subnet_rescue(&self.id, self.keep_nodes.clone(), ctx.forum_post_link()).await
}

fn validate(&self, _cmd: &mut clap::Command) {}
Expand Down
1 change: 1 addition & 0 deletions rs/cli/src/commands/subnet/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl ExecutableCommand for Resize {
include: self.include.clone().into(),
},
self.motivation.clone(),
ctx.forum_post_link(),
&runner.health_of_nodes().await?,
)
.await
Expand Down
1 change: 1 addition & 0 deletions rs/cli/src/commands/update_authorized_subnets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl ExecutableCommand for UpdateAuthorizedSubnets {
title: Some("Update list of public subnets".to_string()),
summary: Some(summary),
motivation: None,
forum_post_link: ctx.forum_post_link(),
},
)
.await?;
Expand Down
4 changes: 3 additions & 1 deletion rs/cli/src/commands/update_unassigned_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ impl ExecutableCommand for UpdateUnassignedNodes {
}
};

runner.update_unassigned_nodes(&PrincipalId::from_str(&nns_subnet_id)?).await
runner
.update_unassigned_nodes(&PrincipalId::from_str(&nns_subnet_id)?, ctx.forum_post_link())
.await
}

fn validate(&self, _cmd: &mut clap::Command) {}
Expand Down
8 changes: 7 additions & 1 deletion rs/cli/src/commands/version/revise/guest_os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ impl ExecutableCommand for GuestOs {
async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
let runner = ctx.runner().await;
runner
.do_revise_elected_replica_versions(&ic_management_types::Artifact::GuestOs, &self.version, &self.release_tag, self.force)
.do_revise_elected_replica_versions(
&ic_management_types::Artifact::GuestOs,
&self.version,
&self.release_tag,
self.force,
ctx.forum_post_link(),
)
.await
}

Expand Down
8 changes: 7 additions & 1 deletion rs/cli/src/commands/version/revise/host_os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ impl ExecutableCommand for HostOs {
async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
let runner = ctx.runner().await;
runner
.do_revise_elected_replica_versions(&ic_management_types::Artifact::HostOs, &self.version, &self.release_tag, self.force)
.do_revise_elected_replica_versions(
&ic_management_types::Artifact::HostOs,
&self.version,
&self.release_tag,
self.force,
ctx.forum_post_link(),
)
.await
}

Expand Down
6 changes: 6 additions & 0 deletions rs/cli/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct DreContext {
verbose_runner: bool,
skip_sync: bool,
ic_admin_path: Option<String>,
forum_post_link: Option<String>,
}

impl DreContext {
Expand Down Expand Up @@ -83,6 +84,7 @@ impl DreContext {
verbose_runner: args.verbose,
skip_sync: args.no_sync,
ic_admin_path,
forum_post_link: args.forum_post_link.clone(),
})
}

Expand Down Expand Up @@ -234,4 +236,8 @@ impl DreContext {
*self.runner.borrow_mut() = Some(runner.clone());
runner
}

pub fn forum_post_link(&self) -> Option<String> {
self.forum_post_link.clone()
}
}
15 changes: 14 additions & 1 deletion rs/cli/src/ic_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,19 @@ impl IcAdminWrapper {
.map(|s| {
vec![
"--summary".to_string(),
format!("{}{}", s, opts.motivation.map(|m| format!("\n\nMotivation: {m}")).unwrap_or_default(),),
format!(
"{}{}",
s,
opts.motivation
.map(|m| format!(
"\n\nMotivation: {m}{}",
match opts.forum_post_link {
Some(link) => format!("\nForum post link: {}\n", link),
None => "".to_string(),
}
))
.unwrap_or_default(),
),
]
})
.unwrap_or_default(),
Expand Down Expand Up @@ -720,6 +732,7 @@ pub struct ProposeOptions {
pub title: Option<String>,
pub summary: Option<String>,
pub motivation: Option<String>,
pub forum_post_link: Option<String>,
}
const DEFAULT_IC_ADMIN_VERSION: &str = "26d5f9d0bdca0a817c236134dc9c7317b32c69a5";

Expand Down
1 change: 1 addition & 0 deletions rs/cli/src/qualification/retire_blessed_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl Step for RetireBlessedVersions {
title: Some("Retire replica versions".to_string()),
summary: Some("Unelecting a version".to_string()),
motivation: Some("Unelecting a version".to_string()),
forum_post_link: None,
},
)
.await
Expand Down
2 changes: 2 additions & 0 deletions rs/cli/src/qualification/upgrade_subnets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ impl Step for UpgradeSubnets {
title: Some(format!("Propose to upgrade subnet {} to {}", subnet.principal, &self.to_version)),
summary: Some("Qualification testing".to_string()),
motivation: Some("Qualification testing".to_string()),
forum_post_link: None,
},
)
.await
Expand Down Expand Up @@ -140,6 +141,7 @@ impl Step for UpgradeSubnets {
title: Some("Upgrading unassigned nodes".to_string()),
summary: Some("Upgrading unassigned nodes".to_string()),
motivation: Some("Upgrading unassigned nodes".to_string()),
forum_post_link: None,
},
)
.await
Expand Down
Loading

0 comments on commit 7c8f4be

Please sign in to comment.