Skip to content

Commit

Permalink
Mocking github repo service and refactoring (#315)
Browse files Browse the repository at this point in the history
* Mocking github repo service and refactoring

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* compilation fix

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* More fixes

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* Refactored tests and fix error checks

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* more fixes

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* more fixes

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* more fixes

Signed-off-by: Prafulla Mahindrakar <[email protected]>
  • Loading branch information
pmahindrakar-oss authored Apr 25, 2022
1 parent 440ad31 commit 262af6e
Show file tree
Hide file tree
Showing 24 changed files with 858 additions and 1,136 deletions.
5 changes: 4 additions & 1 deletion flytectl/cmd/demo/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ func demoClusterExec(ctx context.Context, args []string, cmdCtx cmdCore.CommandC
}

func execute(ctx context.Context, cli docker.Docker, args []string) error {
c := docker.GetSandbox(ctx, cli)
c, err := docker.GetSandbox(ctx, cli)
if err != nil {
return err
}
if c != nil {
exec, err := docker.ExecCommend(ctx, cli, c.ID, args)
if err != nil {
Expand Down
10 changes: 6 additions & 4 deletions flytectl/cmd/demo/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"

"github.com/flyteorg/flytectl/clierrors"
"github.com/flyteorg/flytectl/pkg/githubutil"
"github.com/flyteorg/flytectl/pkg/github"

"github.com/avast/retry-go"
"github.com/olekukonko/tablewriter"
Expand Down Expand Up @@ -136,7 +136,9 @@ func startDemoCluster(ctx context.Context, args []string, cmdCtx cmdCore.Command
return err
}

reader, err := startDemo(ctx, cli, os.Stdin)
ghRepo := github.GetGHRepoService()

reader, err := startDemo(ctx, cli, ghRepo, os.Stdin)
if err != nil {
return err
}
Expand Down Expand Up @@ -178,7 +180,7 @@ func updateLocalKubeContext() error {
return k8sCtxMgr.CopyContext(srcConfigAccess, demoDockerContext, demoContextName)
}

func startDemo(ctx context.Context, cli docker.Docker, reader io.Reader) (*bufio.Scanner, error) {
func startDemo(ctx context.Context, cli docker.Docker, g github.GHRepoService, reader io.Reader) (*bufio.Scanner, error) {
fmt.Printf("%v Bootstrapping a brand new flyte cluster... %v %v\n", emoji.FactoryWorker, emoji.Hammer, emoji.Wrench)

if err := docker.RemoveSandbox(ctx, cli, reader); err != nil {
Expand Down Expand Up @@ -211,7 +213,7 @@ func startDemo(ctx context.Context, cli docker.Docker, reader io.Reader) (*bufio
}
demoImage := sandboxConfig.DefaultConfig.Image
if len(demoImage) == 0 {
image, version, err := githubutil.GetFullyQualifiedImageName("sha", sandboxConfig.DefaultConfig.Version, demoImageName, sandboxConfig.DefaultConfig.Prerelease)
image, version, err := github.GetFullyQualifiedImageName("sha", sandboxConfig.DefaultConfig.Version, demoImageName, sandboxConfig.DefaultConfig.Prerelease, g)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit 262af6e

Please sign in to comment.