Loading tools/publisher/src/subcommand/generate_version_manifest.rs +87 −33 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ pub async fn subcommand_generate_version_manifest( let mut versions_manifest = VersionsManifest { smithy_rs_revision: smithy_rs_revision.to_string(), aws_doc_sdk_examples_revision: examples_revision.to_string(), manual_interventions: Default::default(), crates, release: None, }; Loading Loading @@ -161,8 +162,11 @@ fn find_released_versions( } } // Sanity check: If a crate was previously included, but no longer is, we probably want to know about it let crates_to_remove = &unrecent_versions.manual_interventions.crates_to_remove; for unrecent_crate_name in unrecent_versions.crates.keys() { if !recent_versions.crates.contains_key(unrecent_crate_name) { if !recent_versions.crates.contains_key(unrecent_crate_name) && !crates_to_remove.contains(unrecent_crate_name) { bail!( "Crate `{}` was included in the previous release's `versions.toml`, \ but is not included in the upcoming release. If this is expected, update the \ Loading Loading @@ -230,13 +234,18 @@ struct SmithyBuildProjection { mod tests { use super::*; use smithy_rs_tool_common::package::PackageCategory; use smithy_rs_tool_common::versions_manifest::ManualInterventions; use std::fs; use tempfile::TempDir; fn fake_manifest(crates: &[(&str, &str)]) -> VersionsManifest { fn fake_manifest( crates: &[(&str, &str)], manual_interventions: Option<ManualInterventions>, ) -> VersionsManifest { VersionsManifest { smithy_rs_revision: "dontcare".into(), aws_doc_sdk_examples_revision: "dontcare".into(), manual_interventions: manual_interventions.unwrap_or_default(), crates: crates .iter() .map(|(name, version)| (name.to_string(), fake_version(version))) Loading @@ -256,16 +265,22 @@ mod tests { #[test] fn test_find_released_versions_dropped_crate_sanity_check() { let result = find_released_versions( &fake_manifest(&[ &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), &fake_manifest(&[ ], None, ), &fake_manifest( &[ // oops, we lost aws-config ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), ], None, ), ); assert!(result.is_err()); let error = format!("{}", result.err().unwrap()); Loading @@ -276,19 +291,52 @@ mod tests { ); } #[test] fn test_find_released_versions_dropped_crate_sanity_check_manual_intervention() { let result = find_released_versions( &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-redshiftserverless", "0.13.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ], Some(ManualInterventions { crates_to_remove: vec!["aws-sdk-redshiftserverless".to_string()], }), ), &fake_manifest( &[ ("aws-config", "0.11.0"), // we intentionally dropped aws-sdk-redshiftserverless ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ], None, ), ); assert!(result.is_ok()); } #[test] fn test_find_released_versions_decreased_version_number_sanity_check() { let result = find_released_versions( &fake_manifest(&[ &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), &fake_manifest(&[ ], None, ), &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.12.0"), // oops, S3 went backwards ("aws-sdk-dynamodb", "0.12.0"), ]), ], None, ), ); assert!(result.is_err()); let error = format!("{}", result.err().unwrap()); Loading @@ -302,17 +350,23 @@ mod tests { #[test] fn test_find_released_versions() { let result = find_released_versions( &fake_manifest(&[ &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), &fake_manifest(&[ ], None, ), &fake_manifest( &[ ("aws-config", "0.12.0"), // updated ("aws-sdk-s3", "0.14.0"), // updated ("aws-sdk-dynamodb", "0.12.0"), // same ("aws-sdk-somethingnew", "0.1.0"), // new ]), ], None, ), ) .unwrap(); Loading tools/publisher/src/subcommand/tag_versions_manifest.rs +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ mod tests { let original = VersionsManifest { smithy_rs_revision: "some-revision-smithy-rs".into(), aws_doc_sdk_examples_revision: "some-revision-docs".into(), manual_interventions: Default::default(), crates: [ ( "aws-config".to_string(), Loading tools/publisher/tests/hydrate_readme_e2e_test.rs +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ fn test_hydrate_readme() { VersionsManifest { smithy_rs_revision: "dontcare".into(), aws_doc_sdk_examples_revision: "dontcare".into(), manual_interventions: Default::default(), crates: [ ( "aws-config".to_string(), Loading tools/sdk-versioner/src/main.rs +1 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ mod tests { VersionsManifest { smithy_rs_revision: "doesntmatter".into(), aws_doc_sdk_examples_revision: "doesntmatter".into(), manual_interventions: Default::default(), crates: crates .iter() .map(|&(name, version)| { Loading tools/smithy-rs-tool-common/src/versions_manifest.rs +21 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,12 @@ pub struct VersionsManifest { /// Git commit hash of the `aws-doc-sdk-examples` repository that was synced into this SDK pub aws_doc_sdk_examples_revision: String, /// Optional manual interventions to apply to the next release. /// These are intended to be filled out manually in the `versions.toml` via pull request /// to `aws-sdk-rust`. #[serde(default)] pub manual_interventions: ManualInterventions, /// All SDK crate version metadata pub crates: BTreeMap<String, CrateVersion>, Loading Loading @@ -60,6 +66,21 @@ impl FromStr for VersionsManifest { } } /// The SDK release process has sanity checks sprinkled throughout it to make sure /// a release is done correctly. Sometimes, manual intervention is required to bypass /// these sanity checks. For example, when a service model is intentionally removed, /// without manual intervention, there would be no way to release that removal. #[derive(Clone, Debug, Default, Deserialize, Serialize, Eq, PartialEq)] pub struct ManualInterventions { /// List of crate names that are being removed from the SDK in the next release. /// /// __Note:__ this only bypasses a release-time sanity check. The models for these crates /// (if they're generated) need to be manually deleted, and the crates must be manually /// yanked after the release (if necessary). #[serde(default)] pub crates_to_remove: Vec<String>, } /// Release metadata #[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] pub struct Release { Loading Loading
tools/publisher/src/subcommand/generate_version_manifest.rs +87 −33 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ pub async fn subcommand_generate_version_manifest( let mut versions_manifest = VersionsManifest { smithy_rs_revision: smithy_rs_revision.to_string(), aws_doc_sdk_examples_revision: examples_revision.to_string(), manual_interventions: Default::default(), crates, release: None, }; Loading Loading @@ -161,8 +162,11 @@ fn find_released_versions( } } // Sanity check: If a crate was previously included, but no longer is, we probably want to know about it let crates_to_remove = &unrecent_versions.manual_interventions.crates_to_remove; for unrecent_crate_name in unrecent_versions.crates.keys() { if !recent_versions.crates.contains_key(unrecent_crate_name) { if !recent_versions.crates.contains_key(unrecent_crate_name) && !crates_to_remove.contains(unrecent_crate_name) { bail!( "Crate `{}` was included in the previous release's `versions.toml`, \ but is not included in the upcoming release. If this is expected, update the \ Loading Loading @@ -230,13 +234,18 @@ struct SmithyBuildProjection { mod tests { use super::*; use smithy_rs_tool_common::package::PackageCategory; use smithy_rs_tool_common::versions_manifest::ManualInterventions; use std::fs; use tempfile::TempDir; fn fake_manifest(crates: &[(&str, &str)]) -> VersionsManifest { fn fake_manifest( crates: &[(&str, &str)], manual_interventions: Option<ManualInterventions>, ) -> VersionsManifest { VersionsManifest { smithy_rs_revision: "dontcare".into(), aws_doc_sdk_examples_revision: "dontcare".into(), manual_interventions: manual_interventions.unwrap_or_default(), crates: crates .iter() .map(|(name, version)| (name.to_string(), fake_version(version))) Loading @@ -256,16 +265,22 @@ mod tests { #[test] fn test_find_released_versions_dropped_crate_sanity_check() { let result = find_released_versions( &fake_manifest(&[ &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), &fake_manifest(&[ ], None, ), &fake_manifest( &[ // oops, we lost aws-config ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), ], None, ), ); assert!(result.is_err()); let error = format!("{}", result.err().unwrap()); Loading @@ -276,19 +291,52 @@ mod tests { ); } #[test] fn test_find_released_versions_dropped_crate_sanity_check_manual_intervention() { let result = find_released_versions( &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-redshiftserverless", "0.13.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ], Some(ManualInterventions { crates_to_remove: vec!["aws-sdk-redshiftserverless".to_string()], }), ), &fake_manifest( &[ ("aws-config", "0.11.0"), // we intentionally dropped aws-sdk-redshiftserverless ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ], None, ), ); assert!(result.is_ok()); } #[test] fn test_find_released_versions_decreased_version_number_sanity_check() { let result = find_released_versions( &fake_manifest(&[ &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), &fake_manifest(&[ ], None, ), &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.12.0"), // oops, S3 went backwards ("aws-sdk-dynamodb", "0.12.0"), ]), ], None, ), ); assert!(result.is_err()); let error = format!("{}", result.err().unwrap()); Loading @@ -302,17 +350,23 @@ mod tests { #[test] fn test_find_released_versions() { let result = find_released_versions( &fake_manifest(&[ &fake_manifest( &[ ("aws-config", "0.11.0"), ("aws-sdk-s3", "0.13.0"), ("aws-sdk-dynamodb", "0.12.0"), ]), &fake_manifest(&[ ], None, ), &fake_manifest( &[ ("aws-config", "0.12.0"), // updated ("aws-sdk-s3", "0.14.0"), // updated ("aws-sdk-dynamodb", "0.12.0"), // same ("aws-sdk-somethingnew", "0.1.0"), // new ]), ], None, ), ) .unwrap(); Loading
tools/publisher/src/subcommand/tag_versions_manifest.rs +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ mod tests { let original = VersionsManifest { smithy_rs_revision: "some-revision-smithy-rs".into(), aws_doc_sdk_examples_revision: "some-revision-docs".into(), manual_interventions: Default::default(), crates: [ ( "aws-config".to_string(), Loading
tools/publisher/tests/hydrate_readme_e2e_test.rs +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ fn test_hydrate_readme() { VersionsManifest { smithy_rs_revision: "dontcare".into(), aws_doc_sdk_examples_revision: "dontcare".into(), manual_interventions: Default::default(), crates: [ ( "aws-config".to_string(), Loading
tools/sdk-versioner/src/main.rs +1 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ mod tests { VersionsManifest { smithy_rs_revision: "doesntmatter".into(), aws_doc_sdk_examples_revision: "doesntmatter".into(), manual_interventions: Default::default(), crates: crates .iter() .map(|&(name, version)| { Loading
tools/smithy-rs-tool-common/src/versions_manifest.rs +21 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,12 @@ pub struct VersionsManifest { /// Git commit hash of the `aws-doc-sdk-examples` repository that was synced into this SDK pub aws_doc_sdk_examples_revision: String, /// Optional manual interventions to apply to the next release. /// These are intended to be filled out manually in the `versions.toml` via pull request /// to `aws-sdk-rust`. #[serde(default)] pub manual_interventions: ManualInterventions, /// All SDK crate version metadata pub crates: BTreeMap<String, CrateVersion>, Loading Loading @@ -60,6 +66,21 @@ impl FromStr for VersionsManifest { } } /// The SDK release process has sanity checks sprinkled throughout it to make sure /// a release is done correctly. Sometimes, manual intervention is required to bypass /// these sanity checks. For example, when a service model is intentionally removed, /// without manual intervention, there would be no way to release that removal. #[derive(Clone, Debug, Default, Deserialize, Serialize, Eq, PartialEq)] pub struct ManualInterventions { /// List of crate names that are being removed from the SDK in the next release. /// /// __Note:__ this only bypasses a release-time sanity check. The models for these crates /// (if they're generated) need to be manually deleted, and the crates must be manually /// yanked after the release (if necessary). #[serde(default)] pub crates_to_remove: Vec<String>, } /// Release metadata #[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] pub struct Release { Loading