Skip to content

Commit

Permalink
Merge pull request #903 from etungsten/admin-ctr-migration
Browse files Browse the repository at this point in the history
Admin container v0.5.0 migration
  • Loading branch information
etungsten authored Apr 16, 2020
2 parents 05bb2eb + 812b464 commit c79260a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
7 changes: 7 additions & 0 deletions sources/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ members = [
"api/migration/migration-helpers",

# "api/migration/migrations/vX.Y.Z/...
"api/migration/migrations/v0.3.2/migrate-admin-container-v0_5_0",

"bottlerocket-release",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "migrate-admin-container-v0_5_0"
version = "0.1.0"
authors = ["Erikson Tung <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2018"
publish = false

[dependencies]
migration-helpers = { path = "../../../migration-helpers" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#![deny(rust_2018_idioms)]

use migration_helpers::common_migrations::ReplaceTemplateMigration;
use migration_helpers::{migrate, Result};
use std::process;

const OLD_ADMIN_CTR_TEMPLATE: &str =
"328549459982.dkr.ecr.{{ settings.aws.region }}.amazonaws.com/bottlerocket-admin:v0.4.0";
const NEW_ADMIN_CTR_TEMPLATE: &str =
"328549459982.dkr.ecr.{{ settings.aws.region }}.amazonaws.com/bottlerocket-admin:v0.5.0";

/// We bumped the version of the default admin container from v0.4.0 to v0.5.0
fn run() -> Result<()> {
migrate(ReplaceTemplateMigration {
setting: "settings.host-containers.admin.source",
old_template: OLD_ADMIN_CTR_TEMPLATE,
new_template: NEW_ADMIN_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);
}
}
2 changes: 1 addition & 1 deletion sources/models/defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ superpowered = true

[metadata.settings.host-containers.admin.source]
setting-generator = "schnauzer settings.host-containers.admin.source"
template = "328549459982.dkr.ecr.{{ settings.aws.region }}.amazonaws.com/bottlerocket-admin:v0.4.0"
template = "328549459982.dkr.ecr.{{ settings.aws.region }}.amazonaws.com/bottlerocket-admin:v0.5.0"

[settings.host-containers.control]
enabled = true
Expand Down

0 comments on commit c79260a

Please sign in to comment.