Skip to content

Commit

Permalink
Use occam.example.com as registry prefix
Browse files Browse the repository at this point in the history
Using a custom registry domain ensures that we won't inadvertently
trigger the run-image mirroring code that would be triggered when naming
an image without a domain.
  • Loading branch information
Ryan Moran authored and joshzarrabi committed Jun 23, 2020
1 parent d34d099 commit 129568e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cache_volume_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func CacheVolumeNames(name string) []string {
refName := []byte(fmt.Sprintf("index.docker.io/library/%s:latest", name))
refName := []byte(fmt.Sprintf("%s:latest", name))

sum := sha256.Sum256(refName)

Expand Down
6 changes: 3 additions & 3 deletions cache_volume_names_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func testCacheVolumeNames(t *testing.T, context spec.G, it spec.S) {

it("returns the name of the cache volumes that are assigned to an image", func() {
Expect(occam.CacheVolumeNames("some-app")).To(Equal([]string{
"pack-cache-891d1f8dedc9.build",
"pack-cache-891d1f8dedc9.launch",
"pack-cache-891d1f8dedc9.cache",
"pack-cache-16fe664c76f0.build",
"pack-cache-16fe664c76f0.launch",
"pack-cache-16fe664c76f0.cache",
}))
})
}
2 changes: 1 addition & 1 deletion random_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ func RandomName() (string, error) {
return "", err
}

return strings.ToLower(fmt.Sprintf("occam-%s", guid)), nil
return strings.ToLower(fmt.Sprintf("occam.example.com/%s", guid)), nil
}
2 changes: 1 addition & 1 deletion random_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ func testRandomName(t *testing.T, context spec.G, it spec.S) {
it("generates a random name", func() {
name, err := occam.RandomName()
Expect(err).NotTo(HaveOccurred())
Expect(name).To(MatchRegexp(`^occam\-[0123456789abcdefghjkmnpqrstvwxyz]{26}$`))
Expect(name).To(MatchRegexp(`^occam\.example\.com/[0123456789abcdefghjkmnpqrstvwxyz]{26}$`))
})
}

0 comments on commit 129568e

Please sign in to comment.