scm

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCommitMsg = "init with devstream"
	TransitBranch    = "init-with-devstream"
)

Variables

This section is empty.

Functions

func PushInitRepo

func PushInitRepo(client ClientOperation, commitInfo *git.CommitInfo) error

Types

type ClientOperation

type ClientOperation interface {
	InitRepo() error
	DeleteRepo() error
	DownloadRepo() (string, error)
	DescribeRepo() (*git.RepoInfo, error)
	PushFiles(commitInfo *git.CommitInfo, checkUpdate bool) (bool, error)
	DeleteFiles(commitInfo *git.CommitInfo) error
	GetPathInfo(path string) ([]*git.RepoFileStatus, error)
	AddWebhook(webhookConfig *git.WebhookConfig) error
	DeleteWebhook(webhookConfig *git.WebhookConfig) error
	AddRepoSecret(secretKey, secretValue string) error
}

func NewClient

func NewClient(repoInfo *git.RepoInfo) (ClientOperation, error)

func NewClientWithAuth added in v0.10.0

func NewClientWithAuth(repoInfo *git.RepoInfo) (ClientOperation, error)

type MockScmClient added in v0.10.0

type MockScmClient struct {
	InitRaiseError         error
	PushRaiseError         error
	GetPathInfoError       error
	DownloadRepoError      error
	AddRepoSecretError     error
	DownloadRepoValue      string
	NeedRollBack           bool
	DeleteFuncIsRun        bool
	GetPathInfoReturnValue []*git.RepoFileStatus
}

func (*MockScmClient) AddRepoSecret added in v0.10.0

func (m *MockScmClient) AddRepoSecret(secretKey, secretValue string) error

func (*MockScmClient) AddWebhook added in v0.10.0

func (m *MockScmClient) AddWebhook(webhookConfig *git.WebhookConfig) error

func (*MockScmClient) DeleteFiles added in v0.10.0

func (m *MockScmClient) DeleteFiles(commitInfo *git.CommitInfo) error

func (*MockScmClient) DeleteRepo added in v0.10.0

func (m *MockScmClient) DeleteRepo() error

func (*MockScmClient) DeleteWebhook added in v0.10.0

func (m *MockScmClient) DeleteWebhook(webhookConfig *git.WebhookConfig) error

func (*MockScmClient) DescribeRepo added in v0.10.0

func (m *MockScmClient) DescribeRepo() (*git.RepoInfo, error)

func (*MockScmClient) DownloadRepo added in v0.10.0

func (m *MockScmClient) DownloadRepo() (string, error)

func (*MockScmClient) GetPathInfo added in v0.10.0

func (m *MockScmClient) GetPathInfo(path string) ([]*git.RepoFileStatus, error)

func (*MockScmClient) InitRepo added in v0.10.0

func (m *MockScmClient) InitRepo() error

func (*MockScmClient) PushFiles added in v0.10.0

func (m *MockScmClient) PushFiles(commitInfo *git.CommitInfo, checkUpdate bool) (bool, error)

type SCMInfo added in v0.10.0

type SCMInfo struct {
	// SCM URL related info
	CloneURL string `mapstructure:"url,omitempty" yaml:"url"`
	APIURL   string `mapstructure:"apiURL,omitempty" yaml:"apiURL"`
	// SCM Basic related info
	Owner string `yaml:"owner" mapstructure:"owner,omitempty"`
	Org   string `yaml:"org" mapstructure:"org,omitempty"`
	Name  string `yaml:"name" mapstructure:"name,omitempty"`
	Type  string `mapstructure:"scmType,omitempty" yaml:"scmType"`
	// common fields
	Branch        string `mapstructure:"branch,omitempty" yaml:"branch"`
	SSHPrivateKey string `mapstructure:"sshPrivateKey,omitempty"`
}

SCMInfo can use BasicRepo and URLRepo to get scm info

func (*SCMInfo) BuildRepoInfo added in v0.10.0

func (s *SCMInfo) BuildRepoInfo() (*git.RepoInfo, error)

BuildRepoInfo will return RepoInfo from SCMInfo

func (*SCMInfo) Encode added in v0.10.0

func (s *SCMInfo) Encode() map[string]any

func (*SCMInfo) NewClientWithAuthFromScm added in v0.10.2

func (s *SCMInfo) NewClientWithAuthFromScm() (ClientOperation, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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