service

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrgKind         = "org"
	GroupKind       = "group"
	UserKind        = "user"
	CodeHostCodeHub = "codehub"
)

Variables

This section is empty.

Functions

func CleanWorkspace

func CleanWorkspace(username, pipelineName string, log *zap.SugaredLogger) error

func CodeHostListBranches added in v1.2.0

func CodeHostListBranches(codeHostID int, projectName, namespace, key string, page, perPage int, log *zap.SugaredLogger) ([]*client.Branch, error)

func CodeHostListNamespaces added in v1.2.0

func CodeHostListNamespaces(codeHostID int, keyword string, log *zap.SugaredLogger) ([]*client.Namespace, error)

func CodeHostListPRs added in v1.2.0

func CodeHostListPRs(codeHostID int, projectName, namespace, targetBr string, key string, page, perPage int, log *zap.SugaredLogger) ([]*client.PullRequest, error)

func CodeHostListProjects added in v1.2.0

func CodeHostListProjects(codeHostID int, namespace, namespaceType string, page, perPage int, keyword string, log *zap.SugaredLogger) ([]*client.Project, error)

func CodeHostListTags added in v1.2.0

func CodeHostListTags(codeHostID int, projectName string, namespace string, key string, page int, perPage int, log *zap.SugaredLogger) ([]*client.Tag, error)

func GetContents added in v1.9.9

func GetContents(codeHostID int, owner, repo, path, branch string, isDir bool, logger *zap.SugaredLogger) (string, error)

func GetPublicRepoTree added in v1.5.0

func GetPublicRepoTree(repoLink, path string, logger *zap.SugaredLogger) ([]*git.TreeNode, error)

func GetRepoTree added in v1.4.0

func GetRepoTree(codeHostID int, owner, repo, path, branch string, logger *zap.SugaredLogger) ([]*git.TreeNode, error)

func GetWorkspaceFilePath

func GetWorkspaceFilePath(username, pipelineName, file string, log *zap.SugaredLogger) (string, error)

func MatchBranchesList added in v1.6.0

func MatchBranchesList(regular string, branches []string) []string

Types

type CodehostFileInfo

type CodehostFileInfo struct {
	Name     string `json:"name"`
	Size     int    `json:"size"`
	IsDir    bool   `json:"is_dir"`
	FullPath string `json:"full_path"`
}

func GetCodehubRepoInfo added in v1.3.0

func GetCodehubRepoInfo(codehostID int, repoUUID, branchName, path string, log *zap.SugaredLogger) ([]*CodehostFileInfo, error)

获取codehub的目录内容接口

type FileInfo

type FileInfo struct {
	// parent path of the file
	Parent string `json:"parent"`
	// base name of the file
	Name string `json:"name"`
	// length in bytes for regular files; system-dependent for others
	Size int64 `json:"size"`
	// file mode bits
	Mode os.FileMode `json:"mode"`
	// modification time
	ModTime int64 `json:"mod_time"`
	// abbreviation for Mode().IsDir()
	IsDir bool `json:"is_dir"`
}

func GetGitRepoInfo

func GetGitRepoInfo(codehostID int, repoOwner, repoNamespace, repoName, branchName, remoteName, dir string, log *zap.SugaredLogger) ([]*FileInfo, error)

type GitRepoInfo

type GitRepoInfo struct {
	Owner         string                `json:"repo_owner"`
	Namespace     string                `json:"repo_namespace"`
	Repo          string                `json:"repo"`
	CodehostID    int                   `json:"codehost_id"`
	Source        string                `json:"source"`
	DefaultBranch string                `json:"default_branch"`
	ErrorMsg      string                `json:"error_msg"` // get repo message fail message
	Branches      []*client.Branch      `json:"branches"`
	Tags          []*client.Tag         `json:"tags"`
	PRs           []*client.PullRequest `json:"prs"`
	ProjectUUID   string                `json:"project_uuid,omitempty"`
	RepoUUID      string                `json:"repo_uuid,omitempty"`
	RepoID        string                `json:"repo_id,omitempty"`
	Key           string                `json:"key"`
	// FilterRegexp is the regular expression filter for the branches and tags
	FilterRegexp string `json:"filter_regexp,omitempty"`
}

func ListRepoInfos

func ListRepoInfos(infos []*GitRepoInfo, log *zap.SugaredLogger) ([]*GitRepoInfo, error)

ListRepoInfos ...

func (*GitRepoInfo) GetNamespace added in v1.9.9

func (repo *GitRepoInfo) GetNamespace() string

type RepoInfoList

type RepoInfoList struct {
	Infos []*GitRepoInfo `json:"infos"`
}

Jump to

Keyboard shortcuts

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