types: add RemoteSourceID to Project
In future we may support specifying a remote source for a project without a linked account and thus use a user provided token (saved in the project) or other ways to define a remote repo (like standard git repos over ssh).
This commit is contained in:
parent
b9db3137ad
commit
6943c10dc9
|
@ -41,6 +41,12 @@ func (c *CommandHandler) CreateProject(ctx context.Context, req *CreateProjectRe
|
|||
if !util.ValidateName(req.Name) {
|
||||
return nil, util.NewErrBadRequest(errors.Errorf("invalid project name %q", req.Name))
|
||||
}
|
||||
if req.RemoteSourceName == "" {
|
||||
return nil, util.NewErrBadRequest(errors.Errorf("empty remote source name"))
|
||||
}
|
||||
if req.RepoPath == "" {
|
||||
return nil, util.NewErrBadRequest(errors.Errorf("empty remote repo path name"))
|
||||
}
|
||||
|
||||
user, resp, err := c.configstoreClient.GetUser(ctx, req.CurrentUserID)
|
||||
if err != nil {
|
||||
|
@ -49,7 +55,6 @@ func (c *CommandHandler) CreateProject(ctx context.Context, req *CreateProjectRe
|
|||
|
||||
rs, resp, err := c.configstoreClient.GetRemoteSourceByName(ctx, req.RemoteSourceName)
|
||||
if err != nil {
|
||||
c.log.Errorf("err: %+v", err)
|
||||
return nil, ErrFromRemote(resp, errors.Wrapf(err, "failed to get remote source %q", req.RemoteSourceName))
|
||||
}
|
||||
c.log.Infof("rs: %s", util.Dump(rs))
|
||||
|
@ -94,6 +99,7 @@ func (c *CommandHandler) CreateProject(ctx context.Context, req *CreateProjectRe
|
|||
ID: parentID,
|
||||
},
|
||||
Visibility: req.Visibility,
|
||||
RemoteSourceID: rs.ID,
|
||||
LinkedAccountID: la.ID,
|
||||
RepositoryID: repo.ID,
|
||||
RepositoryPath: req.RepoPath,
|
||||
|
|
|
@ -160,6 +160,10 @@ type Project struct {
|
|||
|
||||
Visibility Visibility `json:"visibility,omitempty"`
|
||||
|
||||
// Remote Repository fields
|
||||
RemoteSourceID string `json:"remote_source_id,omitempty"`
|
||||
LinkedAccountID string `json:"linked_account_id,omitempty"`
|
||||
|
||||
// The remote repository id
|
||||
RepositoryID string `json:"repository_id,omitempty"`
|
||||
|
||||
|
@ -171,8 +175,6 @@ type Project struct {
|
|||
// do this but gitlab can and github has an hidden api to do this)
|
||||
RepositoryPath string `json:"repository_path,omitempty"`
|
||||
|
||||
LinkedAccountID string `json:"linked_account_id,omitempty"`
|
||||
|
||||
SSHPrivateKey string `json:"ssh_private_key,omitempty"` // PEM Encoded private key
|
||||
|
||||
SkipSSHHostKeyCheck bool `json:"skip_ssh_host_key_check,omitempty"`
|
||||
|
|
Loading…
Reference in New Issue