Skip to content

Commit

Permalink
support setting app path
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed May 14, 2023
1 parent a57d3fa commit 27cae3d
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 121 deletions.
12 changes: 8 additions & 4 deletions app/handler/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ func (e *GoogleApp) Run(ctx context.Context, req *pb.RunRequest, rsp *pb.RunResp
log.Errorf("Failed to download %s@%s\n", req.Repo, req.Branch)
return errors.InternalServerError("app.run", "Failed to download source")
}
sourceDir := filepath.Join(gitter.RepoDir(), req.Path)

// TODO validate name and use custom domain name

Expand All @@ -338,6 +339,7 @@ func (e *GoogleApp) Run(ctx context.Context, req *pb.RunRequest, rsp *pb.RunResp
Branch: req.Branch,
Region: req.Region,
Port: req.Port,
Path: req.Path,
Status: domain.StatusDeploying,
EnvVars: req.EnvVars,
Created: time.Now().Format(time.RFC3339Nano),
Expand Down Expand Up @@ -385,7 +387,7 @@ func (e *GoogleApp) Run(ctx context.Context, req *pb.RunRequest, rsp *pb.RunResp
)

// set the command dir
cmd.Dir = gitter.RepoDir()
cmd.Dir = sourceDir
// write the gloudignore file
e.WriteGcloudIgnore(cmd.Dir)

Expand Down Expand Up @@ -440,7 +442,7 @@ func (e *GoogleApp) Run(ctx context.Context, req *pb.RunRequest, rsp *pb.RunResp
cmd.Args = append(cmd.Args, "--set-env-vars", strings.Join(envVars, ","))
}
// set the command dir
cmd.Dir = gitter.RepoDir()
cmd.Dir = sourceDir
// execute the command
outp, err = cmd.CombinedOutput()

Expand Down Expand Up @@ -529,6 +531,8 @@ func (e *GoogleApp) Update(ctx context.Context, req *pb.UpdateRequest, rsp *pb.U
return errors.InternalServerError("app.run", "Failed to download source")
}

sourceDir := filepath.Join(gitter.RepoDir(), srv.Path)

// TODO validate name and use custom domain name

// process the env vars to the required format
Expand Down Expand Up @@ -588,7 +592,7 @@ func (e *GoogleApp) Update(ctx context.Context, req *pb.UpdateRequest, rsp *pb.U
)

// set the command dir
cmd.Dir = gitter.RepoDir()
cmd.Dir = sourceDir
// write the gloudignore file
e.WriteGcloudIgnore(cmd.Dir)

Expand Down Expand Up @@ -643,7 +647,7 @@ func (e *GoogleApp) Update(ctx context.Context, req *pb.UpdateRequest, rsp *pb.U
cmd.Args = append(cmd.Args, "--set-env-vars", strings.Join(envVars, ","))
}
// set the command dir
cmd.Dir = gitter.RepoDir()
cmd.Dir = sourceDir
// execute the command
outp, err = cmd.CombinedOutput()

Expand Down
Loading

0 comments on commit 27cae3d

Please sign in to comment.