MCPcopy Index your code
hub / github.com/rilldata/rill / PushToNewManagedRepo

Method PushToNewManagedRepo

cli/pkg/cmdutil/githelper.go:76–118  ·  view source on GitHub ↗
(ctx context.Context, primaryBranch string)

Source from the content-addressed store, hash-verified

74}
75
76func (g *GitHelper) PushToNewManagedRepo(ctx context.Context, primaryBranch string) (*adminv1.CreateManagedGitRepoResponse, error) {
77 c, err := g.h.Client()
78 if err != nil {
79 return nil, err
80 }
81
82 gitRepo, err := c.CreateManagedGitRepo(ctx, &adminv1.CreateManagedGitRepoRequest{
83 Org: g.org,
84 Name: g.project,
85 })
86 if err != nil {
87 return nil, err
88 }
89 // git does not allow setting default branch on repo on creation
90 // but there is no restriction to push to any branch so directly update default branch here
91 if primaryBranch != "" {
92 gitRepo.DefaultBranch = primaryBranch
93 }
94 author, err := g.h.GitSignature(ctx, g.localPath)
95 if err != nil {
96 return nil, err
97 }
98 config := &gitutil.Config{
99 Remote: gitRepo.Remote,
100 Username: gitRepo.Username,
101 Password: gitRepo.Password,
102 PasswordExpiresAt: gitRepo.PasswordExpiresAt.AsTime(),
103 DefaultBranch: gitRepo.DefaultBranch,
104 ManagedRepo: true,
105 }
106
107 err = gitutil.CommitAndPush(ctx, g.localPath, config, "", author)
108 if err != nil {
109 return nil, err
110 }
111
112 err = g.setGitConfig(ctx, config)
113 if err != nil {
114 return nil, err
115 }
116
117 return gitRepo, nil
118}
119
120func (g *GitHelper) PushToManagedRepo(ctx context.Context) error {
121 gitConfig, err := g.GitConfig(ctx)

Callers 4

DeployProjectMethod · 0.80
RedeployProjectMethod · 0.80
DeployWithUploadFlowFunction · 0.80
redeployProjectFunction · 0.80

Calls 5

setGitConfigMethod · 0.95
CommitAndPushFunction · 0.92
GitSignatureMethod · 0.80
CreateManagedGitRepoMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected