-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add schnauzer-v2 settings generator migrations
- Loading branch information
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
sources/api/migration/migrations/v1.15.0/schnauzer-v2-generators/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "schnauzer-v2-generators" | ||
version = "0.1.0" | ||
authors = ["Sean P. Kelly <seankell@amazon.com>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2021" | ||
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" } |
43 changes: 43 additions & 0 deletions
43
sources/api/migration/migrations/v1.15.0/schnauzer-v2-generators/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use migration_helpers::common_migrations::{MetadataReplacement, ReplaceMetadataMigration}; | ||
use migration_helpers::{migrate, Result}; | ||
use std::process; | ||
|
||
// | ||
fn run() -> Result<()> { | ||
migrate(ReplaceMetadataMigration(vec![ | ||
MetadataReplacement { | ||
setting: "settings.host-containers.admin.source", | ||
metadata: "setting-generator", | ||
old_val: "schnauzer settings.host-containers.admin.source", | ||
new_val: "schnauzer-v2 render --requires 'aws@v1(ecr-prefix)' --template '{{ ecr-prefix settings.aws.region }}/bottlerocket-admin:v0.10.1'", | ||
}, | ||
MetadataReplacement { | ||
setting: "settings.host-containers.control.source", | ||
metadata: "setting-generator", | ||
old_val: "schnauzer settings.host-containers.control.source", | ||
new_val: "schnauzer-v2 render --requires 'aws@v1(ecr-prefix)' --template '{{ ecr-prefix settings.aws.region }}/bottlerocket-control:v0.7.2'", | ||
}, | ||
MetadataReplacement { | ||
setting: "settings.updates.targets-base-url", | ||
metadata: "setting-generator", | ||
old_val: "schnauzer settings.updates.targets-base-url", | ||
new_val: "schnauzer-v2 render --requires 'aws@v1' --requires 'updates@v1(tuf-prefix)' --template '{{ tuf-prefix settings.aws.region }}/targets/'", | ||
}, | ||
MetadataReplacement { | ||
setting: "settings.updates.metadata-base-url", | ||
metadata: "setting-generator", | ||
old_val: "schnauzer settings.updates.metadata-base-url", | ||
new_val: "schnauzer-v2 render --requires 'aws@v1' --requires 'updates@v1(metadata-prefix, tuf-prefix)' --template '{{ tuf-prefix settings.aws.region }}{{ metadata-prefix settings.aws.region }}/2020-07-07/{{ os.variant_id }}/{{ os.arch }}/'", | ||
}, | ||
])) | ||
} | ||
|
||
// 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); | ||
} | ||
} |