scm

package
v1.0.4-gitspaces-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDefaultBranch = errors.New("no default branch")
)

WireSet provides a wire set for this package.

Functions

This section is empty.

Types

type CodeRepositoryRequest

type CodeRepositoryRequest struct {
	URL string `json:"url"`
}

type CodeRepositoryResponse

type CodeRepositoryResponse struct {
	URL               string `json:"url"`
	Branch            string `json:"branch,omitempty"`
	CodeRepoIsPrivate bool   `json:"is_private"`
}

type Credentials

type Credentials struct {
	Email    string
	Name     string
	Password string
}

Credentials contains login and initialization information used by an automated login process.

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory(gitnessProvider *GitnessSCM, genericSCM *GenericSCM) Factory

func NewFactoryWithProviders

func NewFactoryWithProviders(providers map[enum.GitspaceCodeRepoType]Provider) Factory

func ProvideFactory

func ProvideFactory(gitness *GitnessSCM, genericSCM *GenericSCM) Factory

func (*Factory) GetSCMProvider

func (f *Factory) GetSCMProvider(providerType enum.GitspaceCodeRepoType) (Provider, error)

type GenericSCM

type GenericSCM struct {
}

func NewGenericSCM

func NewGenericSCM() *GenericSCM

func ProvideGenericSCM

func ProvideGenericSCM() *GenericSCM

func (GenericSCM) GetFileContent

func (s GenericSCM) GetFileContent(ctx context.Context,
	gitspaceConfig types.GitspaceConfig,
	filePath string,
) ([]byte, error)

func (GenericSCM) ResolveCredentials

func (s GenericSCM) ResolveCredentials(
	_ context.Context,
	gitspaceConfig types.GitspaceConfig,
) (*ResolvedCredentials, error)

type GitnessSCM

type GitnessSCM struct {
	// contains filtered or unexported fields
}

func NewGitnessSCM

func NewGitnessSCM(repoStore store.RepoStore, git git.Interface,
	tokenStore store.TokenStore,
	principalStore store.PrincipalStore,
	urlProvider urlprovider.Provider) *GitnessSCM

func ProvideGitnessSCM

func ProvideGitnessSCM(repoStore store.RepoStore,
	rpcClient git.Interface,
	tokenStore store.TokenStore,
	principalStore store.PrincipalStore,
	urlProvider urlprovider.Provider,
) *GitnessSCM

func (GitnessSCM) GetFileContent

func (s GitnessSCM) GetFileContent(ctx context.Context,
	gitspaceConfig types.GitspaceConfig,
	filePath string,
) ([]byte, error)

func (GitnessSCM) ResolveCredentials

func (s GitnessSCM) ResolveCredentials(
	ctx context.Context,
	gitspaceConfig types.GitspaceConfig,
) (*ResolvedCredentials, error)

type Provider

type Provider interface {
	ResolveCredentials(ctx context.Context, gitspaceConfig types.GitspaceConfig) (*ResolvedCredentials, error)
	GetFileContent(
		ctx context.Context,
		gitspaceConfig types.GitspaceConfig,
		filePath string,
	) ([]byte, error)
}

type ResolvedCredentials

type ResolvedCredentials struct {
	Branch      string
	CloneURL    string
	Credentials *Credentials
	RepoName    string
}

type ResolvedDetails

type ResolvedDetails struct {
	*ResolvedCredentials
	DevcontainerConfig *types.DevcontainerConfig
}

type SCM

type SCM interface {
	// GetSCMRepoDetails fetches repository name, credentials & devcontainer config file from the given repo and branch.
	GetSCMRepoDetails(
		ctx context.Context,
		gitspaceConfig types.GitspaceConfig,
	) (*ResolvedDetails, error)

	// CheckValidCodeRepo checks if the current URL is a valid and accessible code repo,
	// input can be connector info, user token etc.
	CheckValidCodeRepo(ctx context.Context, request CodeRepositoryRequest) (*CodeRepositoryResponse, error)
}

func NewSCM

func NewSCM(factory Factory) SCM

func ProvideSCM

func ProvideSCM(factory Factory) SCM

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL