Skip to content

Commit

Permalink
Change container name separator from - to ---
Browse files Browse the repository at this point in the history
Closes #39.
  • Loading branch information
mbr committed Jan 14, 2024
1 parent 8e2abed commit 00d0886
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

* Log messages have been cleaned up.
* The name separator in container names changed from `-` to `---` to allow dashes in domains.

### Fixed

Expand Down
11 changes: 8 additions & 3 deletions src/container_orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,12 @@ impl ContainerOrchestrator {

if matches!(manifest_reference.reference(), Reference::Tag(tag) if tag == production_tag) {
let location = manifest_reference.location();
let name = format!("rockslide-{}-{}", location.repository(), location.image());

let name = format!(
"rockslide---{}---{}",
location.repository(),
location.image()
);

debug!(%name, "removing (potentially nonexistant) container");

Expand Down Expand Up @@ -453,11 +458,11 @@ impl<'de> Deserialize<'de> for EmptyGoStruct {

impl ContainerJson {
fn image_location(&self) -> Option<ImageLocation> {
const PREFIX: &str = "rockslide-";
const PREFIX: &str = "rockslide---";

for name in &self.names {
if let Some(subname) = name.strip_prefix(PREFIX) {
if let Some((left, right)) = subname.split_once('-') {
if let Some((left, right)) = subname.split_once("---") {
return Some(ImageLocation::new(left.to_owned(), right.to_owned()));
}
}
Expand Down

0 comments on commit 00d0886

Please sign in to comment.