service

package
v2.2.0-20240131 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrgKind        = "org"
	GroupKind      = "group"
	UserKind       = "user"
	EnterpriseKind = "enterprise"
)

Variables

This section is empty.

Functions

func CleanWorkspace

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

func CodeHostListBranches

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

func CodeHostListCommits

func CodeHostListCommits(codeHostID int, projectName, namespace, targetBranch string, page, perPage int, log *zap.SugaredLogger) ([]*client.Commit, error)

func CodeHostListNamespaces

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

func CodeHostListPRs

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

func CodeHostListProjects

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

func CodeHostListTags

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

func GetContents

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

func GetPublicRepoTree

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

func GetRepoTree

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

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"`
}

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

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