|
|
@@ -3,6 +3,7 @@ package connect
|
|
|
import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
+ "strings"
|
|
|
|
|
|
"github.com/porter-dev/porter/api/types"
|
|
|
|
|
|
@@ -22,12 +23,18 @@ func Dockerhub(
|
|
|
|
|
|
// query for dockerhub name
|
|
|
|
|
|
- repoName, err := utils.PromptPlaintext("Provide the Docker Hub organization name. For example, if your Docker Hub repository is 'myorg/myrepo', enter 'myorg'.\nName: ")
|
|
|
-
|
|
|
+ repoName, err := utils.PromptPlaintext(`Provide the Docker Hub repository, in the form of ${org_name}/${repo_name}. For example, porter1/porter.
|
|
|
+Repository: `)
|
|
|
if err != nil {
|
|
|
return 0, err
|
|
|
}
|
|
|
|
|
|
+ orgRepo := strings.Split(repoName, "/")
|
|
|
+
|
|
|
+ if len(orgRepo) != 2 || orgRepo[0] == "" || orgRepo[1] == "" {
|
|
|
+ return 0, fmt.Errorf("invalid Docker Hub image path: %s", repoName)
|
|
|
+ }
|
|
|
+
|
|
|
username, err := utils.PromptPlaintext("Docker Hub username: ")
|
|
|
|
|
|
if err != nil {
|