git

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateGitHubBlobSHA added in v0.10.0

func CalculateGitHubBlobSHA(fileContent []byte) string

func CalculateLocalFileSHA added in v0.10.0

func CalculateLocalFileSHA(fileContent []byte) string

CalculateLocalFileSHA is used to calculate file content's md5

Types

type CommitInfo

type CommitInfo struct {
	CommitMsg    string
	CommitBranch string
	GitFileMap   GitFileContentMap
}

type GitFileContentMap

type GitFileContentMap map[string][]byte

func GetFileContent

func GetFileContent(files []*GitFilePathInfo) GitFileContentMap

unused

type GitFilePathInfo

type GitFilePathInfo struct {
	SourcePath      string
	DestinationPath string
}

GitFilePathInfo contains file local path and remote git path

func GenerateGitFileInfo

func GenerateGitFileInfo(filePaths []string, gitDirPath string) ([]*GitFilePathInfo, error)

unused

type RepoFileStatus

type RepoFileStatus struct {
	Path   string
	SHA    string
	Branch string
}

func (*RepoFileStatus) EncodeToGitHubContentOption

func (f *RepoFileStatus) EncodeToGitHubContentOption(commitMsg string) *github.RepositoryContentFileOptions

type RepoInfo

type RepoInfo struct {
	Owner    string `validate:"required_without=Org" mapstructure:"owner,omitempty"`
	Org      string `validate:"required_without=Owner" mapstructure:"org,omitempty"`
	Repo     string `validate:"required" mapstructure:"repo,omitempty"`
	Branch   string `mapstructure:"branch,omitempty"`
	RepoType string `validate:"oneof=gitlab github" mapstructure:"repoType,omitempty"`
	// This is config for gitlab
	CloneURL      string `mapstructure:"url,omitempty"`
	SSHPrivateKey string `mapstructure:"sshPrivateKey,omitempty"`

	// used for gitlab
	Namespace  string `mapstructure:"nameSpace,omitempty"`
	BaseURL    string `mapstructure:"baseURL,omitempty"`
	Visibility string `mapstructure:"visibility,omitempty"`

	// used for GitHub
	WorkPath string `mapstructure:"workPath,omitempty"`
	NeedAuth bool   `mapstructure:"needAuth,omitempty"`
}

func (*RepoInfo) BuildRepoRenderConfig added in v0.10.0

func (r *RepoInfo) BuildRepoRenderConfig() map[string]interface{}

BuildRepoRenderConfig will generate template render variables

func (*RepoInfo) BuildScmURL added in v0.10.0

func (r *RepoInfo) BuildScmURL() string

BuildURL return url build from repo struct

func (*RepoInfo) BuildWebhookInfo added in v0.10.0

func (r *RepoInfo) BuildWebhookInfo(baseURL, appName, token string) *WebhookConfig

func (*RepoInfo) CheckValid added in v0.10.0

func (r *RepoInfo) CheckValid() error

func (*RepoInfo) Encode added in v0.10.0

func (r *RepoInfo) Encode() map[string]any

func (*RepoInfo) GetBranchWithDefault added in v0.10.0

func (r *RepoInfo) GetBranchWithDefault() string

func (*RepoInfo) GetRepoNameWithBranch

func (r *RepoInfo) GetRepoNameWithBranch() string

func (*RepoInfo) GetRepoOwner

func (r *RepoInfo) GetRepoOwner() string

func (*RepoInfo) GetRepoPath

func (r *RepoInfo) GetRepoPath() string

func (*RepoInfo) UpdateRepoPathByCloneURL added in v0.10.0

func (r *RepoInfo) UpdateRepoPathByCloneURL(cloneURL string) error

type WebhookConfig

type WebhookConfig struct {
	Address     string
	SecretToken string
}

Jump to

Keyboard shortcuts

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