From adf4f59f813bf9e09629126d4b3302bfcc0d6a06 Mon Sep 17 00:00:00 2001 From: "Patrick J.P. Culp" Date: Tue, 21 Dec 2021 21:15:23 +0000 Subject: [PATCH] Update default control container to v0.5.4 --- Release.toml | 3 ++ sources/Cargo.lock | 7 +++++ sources/Cargo.toml | 1 + .../control-container-v0-5-4/Cargo.toml | 12 ++++++++ .../control-container-v0-5-4/src/main.rs | 29 +++++++++++++++++++ .../shared-defaults/aws-host-containers.toml | 2 +- .../vmware-host-containers.toml | 2 +- 7 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/Cargo.toml create mode 100644 sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/src/main.rs diff --git a/Release.toml b/Release.toml index 8f26f3b9a8c..f0be8f68d84 100644 --- a/Release.toml +++ b/Release.toml @@ -86,3 +86,6 @@ version = "1.5.0" "migrate_v1.5.0_oci-hooks-setting.lz4", "migrate_v1.5.0_oci-hooks-setting-metadata.lz4", ] +"(1.5.0, 1.5.1)" = [ + "migrate_v1.5.1_control-container-v0-5-4.lz4", +] diff --git a/sources/Cargo.lock b/sources/Cargo.lock index 1f69eaebe3e..4dfa1a88854 100644 --- a/sources/Cargo.lock +++ b/sources/Cargo.lock @@ -728,6 +728,13 @@ dependencies = [ "migration-helpers", ] +[[package]] +name = "control-container-v0-5-4" +version = "0.1.0" +dependencies = [ + "migration-helpers", +] + [[package]] name = "convert_case" version = "0.4.0" diff --git a/sources/Cargo.toml b/sources/Cargo.toml index 4b34761127c..b60a37fbc6e 100644 --- a/sources/Cargo.toml +++ b/sources/Cargo.toml @@ -33,6 +33,7 @@ members = [ "api/migration/migrations/v1.4.2/control-container-v0-5-3", "api/migration/migrations/v1.5.0/oci-hooks-setting", "api/migration/migrations/v1.5.0/oci-hooks-setting-metadata", + "api/migration/migrations/v1.5.1/control-container-v0-5-4", "bottlerocket-release", diff --git a/sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/Cargo.toml b/sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/Cargo.toml new file mode 100644 index 00000000000..2a167fee251 --- /dev/null +++ b/sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "control-container-v0-5-4" +version = "0.1.0" +authors = ["Patrick J.P. Culp "] +license = "Apache-2.0 OR MIT" +edition = "2018" +publish = false +# Don't rebuild crate just because of changes to README. +exclude = ["README.md"] + +[dependencies] +migration-helpers = { path = "../../../migration-helpers", version = "0.1.0" } diff --git a/sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/src/main.rs b/sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/src/main.rs new file mode 100644 index 00000000000..3f1014e0936 --- /dev/null +++ b/sources/api/migration/migrations/v1.5.1/control-container-v0-5-4/src/main.rs @@ -0,0 +1,29 @@ +#![deny(rust_2018_idioms)] + +use migration_helpers::common_migrations::ReplaceTemplateMigration; +use migration_helpers::{migrate, Result}; +use std::process; + +const OLD_CONTROL_CTR_TEMPLATE: &str = + "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.5.3"; +const NEW_CONTROL_CTR_TEMPLATE: &str = + "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.5.4"; + +/// We bumped the version of the default control container from v0.5.3 to v0.5.4 +fn run() -> Result<()> { + migrate(ReplaceTemplateMigration { + setting: "settings.host-containers.control.source", + old_template: OLD_CONTROL_CTR_TEMPLATE, + new_template: NEW_CONTROL_CTR_TEMPLATE, + }) +} + +// 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/models/shared-defaults/aws-host-containers.toml b/sources/models/shared-defaults/aws-host-containers.toml index 65bfc049944..fa3462c2e91 100644 --- a/sources/models/shared-defaults/aws-host-containers.toml +++ b/sources/models/shared-defaults/aws-host-containers.toml @@ -15,4 +15,4 @@ superpowered = false [metadata.settings.host-containers.control.source] setting-generator = "schnauzer settings.host-containers.control.source" -template = "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.5.3" +template = "{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.5.4" diff --git a/sources/models/shared-defaults/vmware-host-containers.toml b/sources/models/shared-defaults/vmware-host-containers.toml index 6df7158cb35..d5fa36b7f7e 100644 --- a/sources/models/shared-defaults/vmware-host-containers.toml +++ b/sources/models/shared-defaults/vmware-host-containers.toml @@ -11,4 +11,4 @@ source = "public.ecr.aws/bottlerocket/bottlerocket-admin:v0.7.2" [settings.host-containers.control] enabled = false superpowered = false -source = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.5.2" +source = "public.ecr.aws/bottlerocket/bottlerocket-control:v0.5.4"