break out repo split and add unit test
This commit is contained in:
@@ -55,7 +55,7 @@ func main() {
|
||||
}
|
||||
|
||||
if create {
|
||||
err = ensureRepoExists(svc, strings.SplitN(repo, "/", 2)[1])
|
||||
err = ensureRepoExists(svc, getRepoName(repo))
|
||||
if err != nil {
|
||||
log.Fatal(fmt.Sprintf("error creating ECR repo: %v", err))
|
||||
}
|
||||
@@ -75,6 +75,10 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func getRepoName(repo string) string {
|
||||
return strings.SplitN(repo, "/", 2)[1]
|
||||
}
|
||||
|
||||
func ensureRepoExists(svc *ecr.ECR, name string) (err error) {
|
||||
input := &ecr.CreateRepositoryInput{}
|
||||
input.SetRepositoryName(name)
|
||||
|
||||
Reference in New Issue
Block a user