@@ -34,6 +34,7 @@ import (
3434 "github.com/codefresh-io/cli-v2/pkg/util"
3535
3636 "github.com/argoproj-labs/argocd-autopilot/pkg/git"
37+ autoPilotUtil "github.com/argoproj-labs/argocd-autopilot/pkg/util"
3738 "github.com/manifoldco/promptui"
3839 "github.com/spf13/cobra"
3940 "github.com/spf13/pflag"
@@ -83,7 +84,11 @@ func IsValidName(s string) (bool, error) {
8384}
8485
8586func isValidIngressHost (ingressHost string ) (bool , error ) {
86- return regexp .MatchString (`^(http|https)://` , ingressHost )
87+ pattern := `^https://`
88+ if store .Get ().InsecureIngressHost {
89+ pattern = `^(http|https)://`
90+ }
91+ return regexp .MatchString (pattern , ingressHost )
8792}
8893
8994func askUserIfToInstallDemoResources (cmd * cobra.Command , sampleInstall * bool ) error {
@@ -149,6 +154,13 @@ func ensureRepo(cmd *cobra.Command, runtimeName string, cloneOpts *git.CloneOpti
149154func getRepoFromUserInput (cmd * cobra.Command ) error {
150155 repoPrompt := promptui.Prompt {
151156 Label : "Repository URL" ,
157+ Validate : func (value string ) error {
158+ host , orgRepo , _ , _ , _ , _ , _ := autoPilotUtil .ParseGitUrl (value )
159+ if host != "" && orgRepo != "" {
160+ return nil
161+ }
162+ return fmt .Errorf ("Invalid URL for Git repository" )
163+ },
152164 }
153165 repoInput , err := repoPrompt .Run ()
154166 if err != nil {
@@ -225,7 +237,7 @@ func validateRuntimeName(runtime string) error {
225237 return fmt .Errorf ("failed to validate runtime name: %w" , err )
226238 }
227239 if ! isValid {
228- return fmt .Errorf ("runtime name cannot have any uppercase letters, must start with a character, end with character or number, and be shorter than 63 chars " )
240+ return fmt .Errorf ("Runtime name must start with a lower-case character, and can include up to 62 lower-case characters and numbers " )
229241 }
230242 return nil
231243}
@@ -276,10 +288,10 @@ func inferProviderFromRepo(opts *git.CloneOptions) {
276288}
277289
278290func ensureGitToken (cmd * cobra.Command , cloneOpts * git.CloneOptions , verify bool ) error {
279- errMessage := "Value from environment variable TOKEN is not valid, enter another value "
291+ errMessage := "Value stored in environment variable TOKEN is invalid; enter a valid runtime token "
280292 if cloneOpts .Auth .Password == "" && ! store .Get ().Silent {
281293 err := getGitTokenFromUserInput (cmd )
282- errMessage = "Entered git token is not valid, enter another value please "
294+ errMessage = "Invalid runtime token; enter a valid token "
283295 if err != nil {
284296 return err
285297 }
@@ -440,7 +452,7 @@ func validateIngressHost(ingressHost string) error {
440452 if err != nil {
441453 err = fmt .Errorf ("could not verify ingress host: %w" , err )
442454 } else if ! isValid {
443- err = fmt .Errorf ("ingress host must begin with protocol ' http://' or ' https://' " )
455+ err = fmt .Errorf ("Ingress host must begin with a protocol, either http:// or https://" )
444456 }
445457
446458 return err
@@ -484,6 +496,11 @@ func setIngressHost(ctx context.Context, opts *RuntimeInstallOptions) error {
484496 if err != nil {
485497 return err
486498 }
499+ _ , err := http .Get (opts .IngressHost )
500+ if err != nil {
501+ opts .IngressHost = ""
502+ return err
503+ }
487504 }
488505
489506 if opts .IngressHost == "" {
0 commit comments