Skip to content

Commit

Permalink
add migration for aws-config setting generator
Browse files Browse the repository at this point in the history
Add migration for the new aws-config setting generator.

Signed-off-by: Gavin Inglis <[email protected]>
  • Loading branch information
ginglis13 committed Nov 7, 2024
1 parent b681183 commit 0435a67
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.26.2"
version = "1.27.0"

[migrations]
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
Expand Down Expand Up @@ -368,3 +368,6 @@ version = "1.26.2"
"(1.25.0, 1.26.0)" = []
"(1.26.0, 1.26.1)" = []
"(1.26.1, 1.26.2)" = []
"(1.26.2, 1.27.0)" = [
"migrate_v1.27.0_aws-config.lz4",
]
2 changes: 1 addition & 1 deletion Twoliter.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
schema-version = 1
release-version = "1.26.2"
release-version = "1.27.0"

[vendor.bottlerocket]
registry = "public.ecr.aws/bottlerocket"
Expand Down
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 @@ -65,6 +65,7 @@ members = [
"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-migrations/v1.27.0/aws-config",
"settings-plugins/aws-dev",
"settings-plugins/aws-ecs-1",
"settings-plugins/aws-ecs-2",
Expand Down
15 changes: 15 additions & 0 deletions sources/settings-migrations/v1.27.0/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "aws-config"
version = "0.1.0"
authors = ["Gavin Inglis <[email protected]>"]
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
21 changes: 21 additions & 0 deletions sources/settings-migrations/v1.27.0/aws-config/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use migration_helpers::common_migrations::{AddMetadataMigration, SettingMetadata};
use migration_helpers::{migrate, Result};
use std::process;

/// We added new settings metadata, `aws.config.setting-generator`
fn run() -> Result<()> {
migrate(AddMetadataMigration(&[SettingMetadata {
metadata: &["setting-generator"],
setting: "settings.aws.config",
}]))
}

// 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);
}
}
3 changes: 3 additions & 0 deletions sources/shared-defaults/aws-creds.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[settings.aws]
profile = "default"

[metadata.settings.aws.config]
setting-generator = "schnauzer-v2 render --requires 'aws@v1(helpers=[aws-config])' --template '{{ aws-config settings.aws.config settings.aws.profile }}'"

[services.aws]
configuration-files = [
"aws-config",
Expand Down

0 comments on commit 0435a67

Please sign in to comment.