From 3f06c19cc16eb93b09f0bcb95667ec156bd2e300 Mon Sep 17 00:00:00 2001 From: Gavin Inglis Date: Wed, 9 Oct 2024 23:46:50 +0000 Subject: [PATCH] [hack] migrations: migrate to control container v0.7.17 Migrate to beta dev container for testing Signed-off-by: Gavin Inglis --- Release.toml | 2 ++ sources/Cargo.lock | 14 ++++++++++ sources/Cargo.toml | 2 ++ .../aws-control-container-v0-7-17/Cargo.toml | 15 +++++++++++ .../aws-control-container-v0-7-17/src/main.rs | 27 +++++++++++++++++++ .../Cargo.toml | 15 +++++++++++ .../src/main.rs | 27 +++++++++++++++++++ 7 files changed, 102 insertions(+) create mode 100644 sources/settings-migrations/v1.25.0/aws-control-container-v0-7-17/Cargo.toml create mode 100644 sources/settings-migrations/v1.25.0/aws-control-container-v0-7-17/src/main.rs create mode 100644 sources/settings-migrations/v1.25.0/public-control-container-v0-7-17/Cargo.toml create mode 100644 sources/settings-migrations/v1.25.0/public-control-container-v0-7-17/src/main.rs diff --git a/Release.toml b/Release.toml index 992b86da8e1..bf805e77aae 100644 --- a/Release.toml +++ b/Release.toml @@ -361,4 +361,6 @@ version = "1.25.0" "migrate_v1.25.0_kubernetes-service-config.lz4", "migrate_v1.25.0_aws-admin-container-v0-11-13.lz4", "migrate_v1.25.0_public-admin-container-v0-11-13.lz4", + "migrate_v1.25.0_aws-control-container-v0-7-17.lz4", + "migrate_v1.25.0_public-control-container-v0-7-17.lz4", ] diff --git a/sources/Cargo.lock b/sources/Cargo.lock index 4d2b86e3f53..0f07936a867 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -334,6 +334,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "aws-control-container-v0-7-17" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "backtrace" version = "0.3.69" @@ -1769,6 +1776,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "public-control-container-v0-7-17" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "quote" version = "1.0.36" diff --git a/sources/Cargo.toml b/sources/Cargo.toml index c932d4e6e0b..ce9f6949db0 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -62,6 +62,8 @@ members = [ "settings-migrations/v1.25.0/kubernetes-service-config", "settings-migrations/v1.25.0/aws-admin-container-v0-11-13", "settings-migrations/v1.25.0/public-admin-container-v0-11-13", + "settings-migrations/v1.25.0/aws-control-container-v0-7-17", + "settings-migrations/v1.25.0/public-control-container-v0-7-17", "settings-plugins/aws-dev", "settings-plugins/aws-ecs-1", diff --git a/sources/settings-migrations/v1.25.0/aws-control-container-v0-7-17/Cargo.toml b/sources/settings-migrations/v1.25.0/aws-control-container-v0-7-17/Cargo.toml new file mode 100644 index 00000000000..1d5f50c6b1b --- /dev/null +++ b/sources/settings-migrations/v1.25.0/aws-control-container-v0-7-17/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "aws-control-container-v0-7-17" +version = "0.1.0" +authors = ["Gavin Inglis "] +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.25.0/aws-control-container-v0-7-17/src/main.rs b/sources/settings-migrations/v1.25.0/aws-control-container-v0-7-17/src/main.rs new file mode 100644 index 00000000000..f18f2446658 --- /dev/null +++ b/sources/settings-migrations/v1.25.0/aws-control-container-v0-7-17/src/main.rs @@ -0,0 +1,27 @@ +use migration_helpers::common_migrations::ReplaceSchnauzerMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +const OLD_CONTROL_CTR_CMDLINE: &str = + "schnauzer-v2 render --requires 'aws@v1(helpers=[ecr-prefix])' --template '{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.7.16'"; +const NEW_CONTROL_CTR_CMDLINE: &str = + "schnauzer-v2 render --requires 'aws@v1(helpers=[ecr-prefix])' --template '{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.7.17'"; + +/// We bumped the version of the default control container +fn run() -> Result<()> { + migrate(ReplaceSchnauzerMigration { + setting: "settings.host-containers.control.source", + old_schnauzer_cmdline: OLD_CONTROL_CTR_CMDLINE, + new_schnauzer_cmdline: NEW_CONTROL_CTR_CMDLINE, + }) +} + +// 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); + } +} diff --git a/sources/settings-migrations/v1.25.0/public-control-container-v0-7-17/Cargo.toml b/sources/settings-migrations/v1.25.0/public-control-container-v0-7-17/Cargo.toml new file mode 100644 index 00000000000..a5b10c3af88 --- /dev/null +++ b/sources/settings-migrations/v1.25.0/public-control-container-v0-7-17/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "public-control-container-v0-7-17" +version = "0.1.0" +authors = ["Gavin Inglis "] +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.25.0/public-control-container-v0-7-17/src/main.rs b/sources/settings-migrations/v1.25.0/public-control-container-v0-7-17/src/main.rs new file mode 100644 index 00000000000..6e9030285bf --- /dev/null +++ b/sources/settings-migrations/v1.25.0/public-control-container-v0-7-17/src/main.rs @@ -0,0 +1,27 @@ +use migration_helpers::common_migrations::ReplaceStringMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +const OLD_CONTROL_CTR_SOURCE_VAL: &str = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.7.16"; +// TODO (hack) update to publicly released control container +const NEW_CONTROL_CTR_SOURCE_VAL: &str = + "public.ecr.aws/o7o0w6s5/beta-bottlerocket-control-container:v0.7.17"; + +/// We bumped the version of the default control container +fn run() -> Result<()> { + migrate(ReplaceStringMigration { + setting: "settings.host-containers.control.source", + old_val: OLD_CONTROL_CTR_SOURCE_VAL, + new_val: NEW_CONTROL_CTR_SOURCE_VAL, + }) +} + +// 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); + } +}