diff --git a/rs/cli/src/cli.rs b/rs/cli/src/cli.rs index 3eb58c24..11b9dcc9 100644 --- a/rs/cli/src/cli.rs +++ b/rs/cli/src/cli.rs @@ -293,6 +293,10 @@ pub(crate) mod version { /// Git tag for the release. release_tag: String, + + /// Force proposal submission, ignoring missing download URLs + #[clap(long)] + force: bool, }, /// Update the elected/blessed HostOS versions in the registry /// by adding a new version and potentially removing obsolete versions @@ -302,6 +306,10 @@ pub(crate) mod version { /// Git tag for the release. release_tag: String, + + /// Force proposal submission, ignoring missing download URLs + #[clap(long)] + force: bool, }, } impl From for Artifact { diff --git a/rs/cli/src/ic_admin.rs b/rs/cli/src/ic_admin.rs index 2719ce16..5e182c46 100644 --- a/rs/cli/src/ic_admin.rs +++ b/rs/cli/src/ic_admin.rs @@ -500,6 +500,7 @@ impl IcAdminWrapper { async fn download_images_and_validate_sha256( image: &Artifact, version: &String, + ignore_missing_urls: bool, ) -> anyhow::Result<(Vec, String)> { let update_urls = vec![ Self::get_s3_cdn_image_url(version, &image.s3_folder()), @@ -560,7 +561,13 @@ impl IcAdminWrapper { update_urls.join(", ") )); } else if update_urls.len() == 1 { - warn!("Only 1 update image is available. At least 2 should be present in the proposal"); + if ignore_missing_urls { + warn!("Only 1 update image is available. At least 2 should be present in the proposal"); + } else { + return Err(anyhow::anyhow!( + "Only 1 update image is available. At least 2 should be present in the proposal" + )); + } } Ok((update_urls, expected_hash)) } @@ -569,9 +576,11 @@ impl IcAdminWrapper { release_artifact: &Artifact, version: &String, release_tag: &String, + force: bool, retire_versions: Option>, ) -> anyhow::Result { - let (update_urls, expected_hash) = Self::download_images_and_validate_sha256(release_artifact, version).await?; + let (update_urls, expected_hash) = + Self::download_images_and_validate_sha256(release_artifact, version, force).await?; let template = format!( r#"Elect new {release_artifact} binary revision [{version}](https://github.com/dfinity/ic/tree/{release_tag}) diff --git a/rs/cli/src/main.rs b/rs/cli/src/main.rs index 84e4d880..d35119df 100644 --- a/rs/cli/src/main.rs +++ b/rs/cli/src/main.rs @@ -221,11 +221,12 @@ async fn main() -> Result<(), anyhow::Error> { let release_artifact: &Artifact = &update_command.subcommand.clone().into(); let update_version = match &update_command.subcommand { - cli::version::UpdateCommands::Replica { version, release_tag} | cli::version::UpdateCommands::HostOS { version, release_tag} => { + cli::version::UpdateCommands::Replica { version, release_tag, force} | cli::version::UpdateCommands::HostOS { version, release_tag, force} => { ic_admin::IcAdminWrapper::prepare_to_propose_to_update_elected_versions( release_artifact, version, release_tag, + *force, runner.prepare_versions_to_retire(release_artifact, false).await.map(|res| res.1)?, ) }