Documentation ¶
Index ¶
- Constants
- func AutoCancelTask(autoCancelOpt *AutoCancelOpt, log *zap.SugaredLogger) error
- func AutoCancelTestTask(autoCancelOpt *AutoCancelOpt, task *task.Task, log *zap.SugaredLogger) error
- func AutoCancelWorkflowTask(autoCancelOpt *AutoCancelOpt, task *task.Task, log *zap.SugaredLogger) error
- func ContainsFile(h *commonmodels.GitHook, file string) bool
- func CreateEnvAndTaskByPR(workflowArgs *commonmodels.WorkflowTaskArgs, prID int, requestID string, ...) error
- func EventConfigured(m commonmodels.MainHookRepo, event config.HookEventType) bool
- func GetGerritServiceTemplates() ([]*commonmodels.Service, error)
- func GetGerritWorkspaceBasePath(repoName string) (string, error)
- func GetGithubServiceTemplates() ([]*commonmodels.Service, error)
- func GetGitlabAddress(URL string) (string, error)
- func GetGitlabServiceTemplates() ([]*commonmodels.Service, error)
- func GetOwnerRepoBranchPath(URL string) (string, string, string, string, string, string, error)
- func GitlabGetLatestCommit(client *gitlabtool.Client, owner, repo string, ref, path string) (*gitlab.Commit, error)
- func GitlabGetRawFiles(client *gitlabtool.Client, owner, repo, ref, path, pathType string) (files []string, err error)
- func InitDiffNote(ev *gitlab.MergeEvent, mainRepo commonmodels.MainHookRepo, ...) error
- func MatchChanges(m commonmodels.MainHookRepo, files []string) bool
- func ProcessGerritHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGithubHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) (output string, err error)
- func ProcessGithubWebHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGitlabHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func SplitYaml(yaml string) []string
- func SyncServiceTemplateFromGerrit(service *commonmodels.Service, log *zap.SugaredLogger) error
- func SyncServiceTemplateFromGithub(service *commonmodels.Service, latestCommitID, latestCommitMessage string, ...) error
- func SyncServiceTemplateFromGitlab(service *commonmodels.Service, log *zap.SugaredLogger) error
- func TriggerPipelineByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerTestByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerWorkflowByGerritEvent(event *gerritTypeEvent, body []byte, uri, baseURI, domain, requestID string, ...) error
- func TriggerWorkflowByGithubEvent(event interface{}, baseURI, deliveryID, requestID string, ...) error
- func TriggerWorkflowByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func WaitEnvCreate(timeoutSeconds int, envName string, ...) error
- func WaitEnvDelete(timeoutSeconds int, envName string, ...) error
- type AuthorInfo
- type AutoCancelOpt
- type ChangeInfo
- type ChangeKeyInfo
- type CommitInfo
- type EventPush
- type GitlabEvent
- type MatchFolders
- type OwnerInfo
- type PatchSetInfo
- type PipelineHook
- type ProjectDetail
- type ProjectInfo
- type RepositoryInfo
- type SubmitterInfo
- type UploaderInfo
Constants ¶
const SplitSymbol = "&"
Variables ¶
This section is empty.
Functions ¶
func AutoCancelTask ¶
func AutoCancelTask(autoCancelOpt *AutoCancelOpt, log *zap.SugaredLogger) error
func AutoCancelTestTask ¶
func AutoCancelTestTask(autoCancelOpt *AutoCancelOpt, task *task.Task, log *zap.SugaredLogger) error
func AutoCancelWorkflowTask ¶
func AutoCancelWorkflowTask(autoCancelOpt *AutoCancelOpt, task *task.Task, log *zap.SugaredLogger) error
func ContainsFile ¶
func ContainsFile(h *commonmodels.GitHook, file string) bool
ContainsFile "/" 代表全部文件
func CreateEnvAndTaskByPR ¶
func CreateEnvAndTaskByPR(workflowArgs *commonmodels.WorkflowTaskArgs, prID int, requestID string, log *zap.SugaredLogger) error
CreateEnvAndTaskByPR 根据pr触发创建环境、使用工作流更新该创建的环境、根据环境删除策略删除环境
func EventConfigured ¶
func EventConfigured(m commonmodels.MainHookRepo, event config.HookEventType) bool
func GetGerritServiceTemplates ¶
func GetGerritServiceTemplates() ([]*commonmodels.Service, error)
GetGerritServiceTemplates Get all service templates maintained in gerrit
func GetGithubServiceTemplates ¶
func GetGithubServiceTemplates() ([]*commonmodels.Service, error)
func GetGitlabAddress ¶
func GetGitlabServiceTemplates ¶
func GetGitlabServiceTemplates() ([]*commonmodels.Service, error)
func GetOwnerRepoBranchPath ¶
GetOwnerRepoBranchPath 获取gitlab路径中的owner、repo、branch和path
func GitlabGetLatestCommit ¶
func GitlabGetLatestCommit(client *gitlabtool.Client, owner, repo string, ref, path string) (*gitlab.Commit, error)
func GitlabGetRawFiles ¶
func GitlabGetRawFiles(client *gitlabtool.Client, owner, repo, ref, path, pathType string) (files []string, err error)
GitlabGetRawFiles ... projectID: identity of project, can be retrieved from s.GitlabGetProjectID(owner, repo) ref: branch (e.g. master) or commit (commit id) or tag path: file path of raw files, only retrieve leaf node(blob type == file), no recursive get
func InitDiffNote ¶
func InitDiffNote(ev *gitlab.MergeEvent, mainRepo commonmodels.MainHookRepo, log *zap.SugaredLogger) error
InitDiffNote 调用gitlab接口初始化DiffNote,并保存到数据库
func MatchChanges ¶
func MatchChanges(m commonmodels.MainHookRepo, files []string) bool
func ProcessGerritHook ¶
func ProcessGithubHook ¶
func ProcessGithubWebHook ¶
func ProcessGitlabHook ¶
func SyncServiceTemplateFromGerrit ¶
func SyncServiceTemplateFromGerrit(service *commonmodels.Service, log *zap.SugaredLogger) error
SyncServiceTemplateFromGerrit Force to sync Service Template to latest commit and content, Notes: if remains the same, quit sync; if updates, revision +1
func SyncServiceTemplateFromGithub ¶
func SyncServiceTemplateFromGithub(service *commonmodels.Service, latestCommitID, latestCommitMessage string, log *zap.SugaredLogger) error
SyncServiceTemplateFromGithub Force to sync Service Template to latest commit and content, Notes: if remains the same, quit sync; if updates, revision +1
func SyncServiceTemplateFromGitlab ¶
func SyncServiceTemplateFromGitlab(service *commonmodels.Service, log *zap.SugaredLogger) error
SyncServiceTemplateFromGitlab Force to sync Service Template to latest commit and content, Notes: if remains the same, quit sync; if updates, revision +1
func TriggerPipelineByGitlabEvent ¶
func TriggerPipelineByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
func TriggerTestByGitlabEvent ¶ added in v1.2.0
func TriggerTestByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
TriggerTestByGitlabEvent 测试管理模块的触发器任务
func TriggerWorkflowByGerritEvent ¶
func TriggerWorkflowByGerritEvent(event *gerritTypeEvent, body []byte, uri, baseURI, domain, requestID string, log *zap.SugaredLogger) error
func TriggerWorkflowByGithubEvent ¶
func TriggerWorkflowByGithubEvent(event interface{}, baseURI, deliveryID, requestID string, log *zap.SugaredLogger) error
func TriggerWorkflowByGitlabEvent ¶
func TriggerWorkflowByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
func WaitEnvCreate ¶
func WaitEnvCreate(timeoutSeconds int, envName string, workflowArgs *commonmodels.WorkflowTaskArgs, log *zap.SugaredLogger) error
func WaitEnvDelete ¶
func WaitEnvDelete(timeoutSeconds int, envName string, workflowArgs *commonmodels.WorkflowTaskArgs, log *zap.SugaredLogger) error
Types ¶
type AuthorInfo ¶
type AutoCancelOpt ¶
type AutoCancelOpt struct { MergeRequestID string CommitID string TaskType config.PipelineType MainRepo commonmodels.MainHookRepo WorkflowArgs *commonmodels.WorkflowTaskArgs TestArgs *commonmodels.TestTaskArgs }
type ChangeInfo ¶
type ChangeInfo struct { Project string `json:"project"` Branch string `json:"branch"` ID string `json:"id"` Number int `json:"number"` Subject string `json:"subject"` Owner OwnerInfo `json:"owner"` URL string `json:"url"` CommitMessage string `json:"commitMessage"` CreatedOn int `json:"createdOn"` Status string `json:"status"` }
type ChangeKeyInfo ¶
type ChangeKeyInfo struct {
ID string `json:"id"`
}
type CommitInfo ¶
type GitlabEvent ¶
type GitlabEvent struct { ObjectKind string `json:"object_kind"` EventName string `json:"event_name"` Before string `json:"before"` After string `json:"after"` Ref string `json:"ref"` CheckoutSha string `json:"checkout_sha"` Message interface{} `json:"message"` UserID int `json:"user_id"` UserName string `json:"user_name"` UserUsername string `json:"user_username"` UserEmail string `json:"user_email"` UserAvatar string `json:"user_avatar"` ProjectID int `json:"project_id"` Project ProjectDetail `json:"project"` Commits []CommitInfo `json:"commits"` TotalCommitsCount int `json:"total_commits_count"` Repository RepositoryInfo `json:"repository"` }
type MatchFolders ¶
type MatchFolders []string
func (MatchFolders) ContainsFile ¶
func (m MatchFolders) ContainsFile(file string) bool
type PatchSetInfo ¶
type PatchSetInfo struct { Number int `json:"number"` Revision string `json:"revision"` Parents []string `json:"parents"` Ref string `json:"ref"` Uploader UploaderInfo `json:"uploader"` CreatedOn int `json:"createdOn"` Author AuthorInfo `json:"author"` Kind string `json:"kind"` SizeInsertions int `json:"sizeInsertions"` SizeDeletions int `json:"sizeDeletions"` }
type PipelineHook ¶
type PipelineHook struct { PipelineName string GitHook commonmodels.GitHook }
type ProjectDetail ¶
type ProjectDetail struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` WebURL string `json:"web_url"` AvatarURL interface{} `json:"avatar_url"` GitSSHURL string `json:"git_ssh_url"` GitHTTPURL string `json:"git_http_url"` Namespace string `json:"namespace"` VisibilityLevel int `json:"visibility_level"` PathWithNamespace string `json:"path_with_namespace"` DefaultBranch string `json:"default_branch"` CiConfigPath interface{} `json:"ci_config_path"` Homepage string `json:"homepage"` URL string `json:"url"` SSHURL string `json:"ssh_url"` HTTPURL string `json:"http_url"` }
type ProjectInfo ¶
type ProjectInfo struct {
Name string `json:"name"`
}