service

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

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

	CodeHostCodeHub = "codehub"
	CodeHostIlyshin = "ilyshin"
)

Variables

This section is empty.

Functions

func CleanWorkspace

func CleanWorkspace(username, pipelineName string, log *zap.SugaredLogger) 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)

Types

type Branch added in v1.2.0

type Branch struct {
	Name      string `json:"name"`
	Protected bool   `json:"protected"`
	Merged    bool   `json:"merged"`
}

func CodeHostListBranches added in v1.2.0

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

func ToBranches added in v1.2.0

func ToBranches(obj interface{}) []*Branch

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, repoName, branchName, remoteName, dir string, log *zap.SugaredLogger) ([]*FileInfo, error)

type GitRepoInfo

type GitRepoInfo struct {
	Owner         string         `json:"repo_owner"`
	Repo          string         `json:"repo"`
	CodehostID    int            `json:"codehost_id"`
	Source        string         `json:"source"`
	DefaultBranch string         `json:"default_branch"`
	ErrorMsg      string         `json:"error_msg"` // repo信息是否拉取成功
	Branches      []*Branch      `json:"branches"`
	Tags          []*Tag         `json:"tags"`
	PRs           []*PullRequest `json:"prs"`
	ProjectUUID   string         `json:"project_uuid,omitempty"`
	RepoUUID      string         `json:"repo_uuid,omitempty"`
	RepoID        string         `json:"repo_id,omitempty"`
}

func ListRepoInfos

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

ListRepoInfos ...

type Namespace added in v1.2.0

type Namespace struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Kind        string `json:"kind"`
	ProjectUUID string `json:"project_uuid,omitempty"`
}

func CodeHostListNamespaces added in v1.2.0

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

func ToNamespaces added in v1.2.0

func ToNamespaces(obj interface{}) []*Namespace

type Project added in v1.2.0

type Project struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	DefaultBranch string `json:"defaultBranch"`
	Namespace     string `json:"namespace"`
	RepoUUID      string `json:"repo_uuid,omitempty"`
	RepoID        string `json:"repo_id,omitempty"`
}

func CodeHostListProjects added in v1.2.0

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

func ToProjects added in v1.2.0

func ToProjects(obj interface{}) []*Project

type PullRequest added in v1.2.0

type PullRequest struct {
	ID             int    `json:"id"`
	TargetBranch   string `json:"targetBranch"`
	SourceBranch   string `json:"sourceBranch"`
	ProjectID      int    `json:"projectId"`
	Title          string `json:"title"`
	State          string `json:"state"`
	CreatedAt      int64  `json:"createdAt"`
	UpdatedAt      int64  `json:"updatedAt"`
	AuthorUsername string `json:"authorUsername"`
	Number         int    `json:"number"`
	User           string `json:"user"`
	Base           string `json:"base,omitempty"`
}

func CodeHostListPRs added in v1.2.0

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

func ToPullRequests added in v1.2.0

func ToPullRequests(obj interface{}) []*PullRequest

type RepoInfoList

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

type Tag added in v1.2.0

type Tag struct {
	Name       string `json:"name"`
	ZipballURL string `json:"zipball_url"`
	TarballURL string `json:"tarball_url"`
	Message    string `json:"message"`
}

func CodeHostListTags added in v1.2.0

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

func ToTags added in v1.2.0

func ToTags(obj interface{}) []*Tag

Jump to

Keyboard shortcuts

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