helper functions

pull/2/head
Karolis Rusenas 2017-06-11 20:12:55 +01:00
parent c081b3f1b1
commit 4611d3bc44
1 changed files with 23 additions and 0 deletions

23
trigger/pubsub/util.go Normal file
View File

@ -0,0 +1,23 @@
package pubsub
import (
"strings"
)
// "gcr.io/v2-namespace/hello-world:1.1"
func extractContainerRegistryURI(imageName string) string {
parts := strings.Split(imageName, "/")
return parts[0]
}
func containerRegistryURI(projectID, registry string) string {
return registry + "%2F" + projectID
}
func containerRegistrySubName(projectID, topic string) string {
return "keel-" + projectID + "-" + topic
}
func isGoogleContainerRegistry(registry string) bool {
return strings.Contains(registry, "gcr.io")
}