-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrations: add migrations for 'settings.container-registry.credentials'
- Loading branch information
Showing
7 changed files
with
91 additions
and
0 deletions.
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
10 changes: 10 additions & 0 deletions
10
sources/api/migration/migrations/v1.6.2/container-registry-credentials-metadata/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,10 @@ | ||
[package] | ||
name = "container-registry-credentials-metadata" | ||
version = "0.1.0" | ||
authors = ["Erikson Tung <etung@amazon.com>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies] | ||
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"} |
31 changes: 31 additions & 0 deletions
31
sources/api/migration/migrations/v1.6.2/container-registry-credentials-metadata/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,31 @@ | ||
#![deny(rust_2018_idioms)] | ||
|
||
use migration_helpers::common_migrations::{AddMetadataMigration, SettingMetadata}; | ||
use migration_helpers::{migrate, Result}; | ||
use std::process; | ||
|
||
/// We added a new setting and `affected-services` metadata for `container-registry.credentials` | ||
/// We subdivided metadata for `container-registry` into `container-registry.mirrors` and `container-registry.credentials` | ||
/// This is for the docker variants where don't want to restart the docker daemon when credentials settings change. | ||
fn run() -> Result<()> { | ||
migrate(AddMetadataMigration(&[ | ||
SettingMetadata { | ||
metadata: &["affected-services"], | ||
setting: "settings.container-registry.credentials", | ||
}, | ||
SettingMetadata { | ||
metadata: &["affected-services"], | ||
setting: "settings.container-registry.mirrors", | ||
}, | ||
])) | ||
} | ||
|
||
// 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); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
sources/api/migration/migrations/v1.6.2/container-registry-credentials/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,10 @@ | ||
[package] | ||
name = "container-registry-credentials" | ||
version = "0.1.0" | ||
authors = ["Erikson Tung <etung@amazon.com>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies] | ||
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"} |
22 changes: 22 additions & 0 deletions
22
sources/api/migration/migrations/v1.6.2/container-registry-credentials/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,22 @@ | ||
#![deny(rust_2018_idioms)] | ||
|
||
use migration_helpers::common_migrations::AddPrefixesMigration; | ||
use migration_helpers::{migrate, Result}; | ||
use std::process; | ||
|
||
/// We added a new setting for configuring image credentials, `settings.container-registry.credentials` | ||
fn run() -> Result<()> { | ||
migrate(AddPrefixesMigration(vec![ | ||
"settings.container-registry.credentials", | ||
])) | ||
} | ||
|
||
// 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); | ||
} | ||
} |