-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The old process was cumbersome and error-prone. The new process looks better. We should be able to create the connection via the CLI and then open a browser for the user to install the app at GitHub.
Relevant code:
apppack/stacks/app_pipeline.go
Lines 740 to 786 in 2b2da0d
func verifySourceCredentials(sess *session.Session, repositoryType string) error { codebuildSvc := codebuild.New(sess) sourceCredentialsOutput, err := codebuildSvc.ListSourceCredentials(&codebuild.ListSourceCredentialsInput{}) if err != nil { return err } hasCredentials := false for _, cred := range sourceCredentialsOutput.SourceCredentialsInfos { if *cred.ServerType == repositoryType { hasCredentials = true } } if !hasCredentials { var friendlySourceName string if repositoryType == "BITBUCKET" { friendlySourceName = "Bitbucket" } else if repositoryType == "GITHUB" { friendlySourceName = "GitHub" } else { return fmt.Errorf("unsupported repository type: %s", repositoryType) } ui.Spinner.Stop() ui.PrintWarning(fmt.Sprintf("CodeBuild needs to be authenticated to access your repository at %s", friendlySourceName)) fmt.Println("On the CodeBuild new project page:") fmt.Printf(" 1. Scroll to the %s section\n", aurora.Bold("Source")) fmt.Printf(" 2. Select %s for the %s\n", aurora.Bold(friendlySourceName), aurora.Bold("Source provider")) fmt.Printf(" 3. Keep the default %s\n", aurora.Bold("Connect using OAuth")) fmt.Printf(" 4. Click %s\n", aurora.Bold(fmt.Sprintf("Connect to %s", friendlySourceName))) fmt.Printf(" 5. Click %s in the popup window\n", aurora.Bold("Confirm")) fmt.Printf(" 6. %s You can close the browser window and continue with app setup here.\n\n", aurora.Bold("That's it!")) newProjectURL := fmt.Sprintf("https://%s.console.aws.amazon.com/codesuite/codebuild/project/new", *sess.Config.Region) url, err := auth.GetConsoleURL(sess, newProjectURL) if err == nil && isatty.IsTerminal(os.Stdin.Fd()) { fmt.Println("Opening the CodeBuild new project page now...") err = browser.OpenURL(*url) if err != nil { fmt.Println("Open this URL in your browser to view logs:") fmt.Println(*url) } } else { fmt.Printf("Visit the following URL to authenticate: %s", newProjectURL) } ui.PauseUntilEnter("Finish authentication in your web browser then press ENTER to continue.") return verifySourceCredentials(sess, repositoryType) } return nil } - https://github.com/apppackio/apppack-docs/blob/61a96fdf4424663f235f03a3d52c593e8b90a6b2/src/tutorials/deploy-first-app.md#L50-L60
Metadata
Metadata
Assignees
Labels
No labels