grim/tagpull

Rename the repo to tagpull
draft
2020-07-05, Gary Kramlich
4a2ab904ba01
Rename the repo to tagpull
package main
import (
"strings"
)
// create a comma separate string of labels to match based on a map
func createLabelString(labelMap map[string]string) string {
labels := make([]string, len(labelMap))
i := 0
for k, v := range labelMap {
labels[i] = k + "=" + v
i++
}
return strings.Join(labels, ",")
}
// takes a repository like rwgrim/tagops or rwgrim/tagops:1.0 and returns the
// repo name and tag. Ie: rwgrim/tagops, latest and rwgrim/tagops, 1.0.
func parseRepositoryAndTag(repository string) (string, string) {
parts := strings.SplitN(repository, ":", 2)
if len(parts) == 2 {
return parts[0], parts[1]
}
return parts[0], "latest"
}