Skip to content

Commit

Permalink
fix: Ensure image names are lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpinder committed Sep 8, 2024
1 parent d4b511e commit 8c94473
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 3 additions & 1 deletion process/drivers/github_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ impl CiDriver for GithubDriver {
.repository
.owner
.login
))
)
.trim()
.to_lowercase())
}
}

Expand Down
19 changes: 16 additions & 3 deletions process/drivers/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,26 @@ pub trait CiDriver {
fn inner(opts: &GenerateImageNameOpts, driver_registry: &str) -> Result<Reference> {
let image = match (&opts.registry, &opts.registry_namespace) {
(Some(registry), Some(registry_namespace)) => {
format!("{registry}/{registry_namespace}/{}", &opts.name)
format!(
"{}/{}/{}",
registry.trim().to_lowercase(),
registry_namespace.trim().to_lowercase(),
opts.name.trim().to_lowercase()
)
}
(Some(registry), None) => {
format!("{registry}/{}", &opts.name)
format!(
"{}/{}",
registry.trim().to_lowercase(),
opts.name.trim().to_lowercase()
)
}
_ => {
format!("{}/{}", driver_registry, &opts.name)
format!(
"{}/{}",
driver_registry.trim().to_lowercase(),
opts.name.trim().to_lowercase()
)
}
};
image
Expand Down
2 changes: 1 addition & 1 deletion test-files/github-events/branch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"repository": {
"default_branch": "main",
"owner": {
"login": "test-owner"
"login": "Test-Owner"
},
"html_url": "https://example.com/"
}
Expand Down

0 comments on commit 8c94473

Please sign in to comment.