From ff057a8f4db27cdb685ac0d42e85e0ce55e8006a Mon Sep 17 00:00:00 2001 From: Shikha Vyaghra Date: Fri, 24 Jan 2025 22:55:01 +0000 Subject: [PATCH] migrations: Remove metdata and data public Control In this migration we will remove the data and metadata if it matches with existing ones in datastore. We will rely on storewolf to populate correct metadata and data. --- Release.toml | 1 + sources/Cargo.lock | 7 ++++++ sources/Cargo.toml | 1 + .../public-remove-source-control/Cargo.toml | 15 +++++++++++ .../public-remove-source-control/src/main.rs | 25 +++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 sources/settings-migrations/v1.33.0/public-remove-source-control/Cargo.toml create mode 100644 sources/settings-migrations/v1.33.0/public-remove-source-control/src/main.rs diff --git a/Release.toml b/Release.toml index 2948b5c240b..b5b8bba0a2f 100644 --- a/Release.toml +++ b/Release.toml @@ -399,4 +399,5 @@ version = "1.33.0" "migrate_v1.33.0_aws-remove-schnauzer-admin.lz4", "migrate_v1.33.0_aws-remove-schnauzer-control.lz4", "migrate_v1.33.0_public-remove-source-admin.lz4", + "migrate_v1.33.0_public-remove-source-control.lz4", ] diff --git a/sources/Cargo.lock b/sources/Cargo.lock index c976fd3e886..737e2d295b2 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -2216,6 +2216,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "public-remove-source-control" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "quinn" version = "0.11.5" diff --git a/sources/Cargo.toml b/sources/Cargo.toml index b4d49ab67cd..d0e118ae557 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -87,6 +87,7 @@ members = [ "settings-migrations/v1.33.0/aws-remove-schnauzer-admin", "settings-migrations/v1.33.0/aws-remove-schnauzer-control", "settings-migrations/v1.33.0/public-remove-source-admin", + "settings-migrations/v1.33.0/public-remove-source-control", "settings-plugins/aws-dev", "settings-plugins/aws-ecs-1", diff --git a/sources/settings-migrations/v1.33.0/public-remove-source-control/Cargo.toml b/sources/settings-migrations/v1.33.0/public-remove-source-control/Cargo.toml new file mode 100644 index 00000000000..e4b172646c7 --- /dev/null +++ b/sources/settings-migrations/v1.33.0/public-remove-source-control/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "public-remove-source-control" +version = "0.1.0" +authors = ["Shikha Vyaghra "] +license = "Apache-2.0 OR MIT" +edition = "2021" +publish = false +# Don't rebuild crate just because of changes to README. +exclude = ["README.md"] + + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +migration-helpers.workspace = true diff --git a/sources/settings-migrations/v1.33.0/public-remove-source-control/src/main.rs b/sources/settings-migrations/v1.33.0/public-remove-source-control/src/main.rs new file mode 100644 index 00000000000..1bcf955649f --- /dev/null +++ b/sources/settings-migrations/v1.33.0/public-remove-source-control/src/main.rs @@ -0,0 +1,25 @@ +use migration_helpers::common_migrations::RemoveOldData; +use migration_helpers::{migrate, Result}; +use std::process; + +const OLD_CONTROL_CTR: &str = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.7.18"; +const NEW_CONTROL_CTR: &str = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.7.18"; + +/// We bumped the version of the default admin container +fn run() -> Result<()> { + migrate(RemoveOldData { + setting: "settings.host-containers.control.source", + old_val: OLD_CONTROL_CTR, + new_val: NEW_CONTROL_CTR, + }) +} + +// Returning a Result from main makes it print a Debug representation of the error, but with Snafu +// we have nice Display representations of the error, so we wrap "main" (run) and print any error. +// https://github.com/shepmaster/snafu/issues/110 +fn main() { + if let Err(e) = run() { + eprintln!("{}", e); + process::exit(1); + } +}