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 AutoCancelWorkflowV4Task(autoCancelOpt *AutoCancelOpt, log *zap.SugaredLogger) error
- func CodehubGetLatestCommit(client *codehub.Client, owner, repo string, branch string) (string, string, error)
- func ContainsFile(h *commonmodels.GitHook, file string) bool
- func ConvertScanningHookToMainHookRepo(hook *commonmodels.ScanningHook) *commonmodels.MainHookRepo
- func CreateEnvAndTaskByPR(workflowArgs *commonmodels.WorkflowTaskArgs, prID int, requestID string, ...) error
- func EventConfigured(m *commonmodels.MainHookRepo, event config.HookEventType) bool
- func GetAddress(URL string) (string, error)
- func GetCodehubServiceTemplates() ([]*commonmodels.Service, error)
- func GetGerritServiceTemplates() ([]*commonmodels.Service, error)
- func GetGerritWorkspaceBasePath(repoName string) (string, error)
- func GetGiteeServiceTemplates() ([]*commonmodels.Service, error)
- func GetGithubServiceTemplates() ([]*commonmodels.Service, error)
- func GetGitlabServiceTemplates() ([]*commonmodels.Service, error)
- func GetOwnerRepoBranchPath(URL string) (string, string, string, string, string, string, error)
- func GetWorkspaceBasePath(repoName 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 MatchChanges(m *commonmodels.MainHookRepo, files []string) bool
- func ProcessCodehubHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGerritHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGiteeHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGithubHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) (string, error)
- func ProcessGithubWebHook(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGithubWebHookForTest(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGithubWebHookForWorkflowV4(payload []byte, req *http.Request, requestID string, log *zap.SugaredLogger) error
- func ProcessGithubWebhookForScanning(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 SyncServiceTemplateFromCodehub(service *commonmodels.Service, log *zap.SugaredLogger) error
- func SyncServiceTemplateFromGerrit(service *commonmodels.Service, log *zap.SugaredLogger) error
- func SyncServiceTemplateFromGitee(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 TriggerScanningByGithubEvent(event interface{}, requestID string, log *zap.SugaredLogger) error
- func TriggerScanningByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerTestByGiteeEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerTestByGithubEvent(event interface{}, requestID string, log *zap.SugaredLogger) error
- func TriggerTestByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerWorkflowByCodehubEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerWorkflowByGerritEvent(event *gerritTypeEvent, body []byte, uri, baseURI, domain, requestID string, ...) error
- func TriggerWorkflowByGiteeEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerWorkflowByGithubEvent(event interface{}, baseURI, deliveryID, requestID string, ...) error
- func TriggerWorkflowByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerWorkflowV4ByGerritEvent(event *gerritTypeEvent, body []byte, uri, baseURI, domain, requestID string, ...) error
- func TriggerWorkflowV4ByGiteeEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func TriggerWorkflowV4ByGithubEvent(event interface{}, baseURI, deliveryID, requestID string, ...) error
- func TriggerWorkflowV4ByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
- func UpdateWorkflowTaskArgs(triggerYaml *TriggerYaml, workflow *commonmodels.Workflow, ...) error
- func WaitEnvCreate(timeoutSeconds int, envName string, ...) error
- func WaitEnvDelete(timeoutSeconds int, envName string, ...) error
- type AuthorInfo
- type AutoCancelOpt
- type Build
- type BuildServices
- type CacheSet
- type ChangeInfo
- type ChangeKeyInfo
- type CommitInfo
- type Deploy
- type DeployStrategy
- type EnvRecyclePolicy
- type EventPush
- type GitlabEvent
- type MatchFolders
- type MatchFoldersElem
- type MatchFoldersTree
- type OwnerInfo
- type PatchSetInfo
- type PipelineHook
- type ProjectDetail
- type ProjectInfo
- type Repo
- type RepositoryInfo
- type Rules
- type Stage
- type StrategyRules
- type SubmitterInfo
- type Test
- type TestRepoStrategy
- type TriggerYaml
- type UploaderInfo
- type Variables
Constants ¶
const ( EventTypePR = "pr" EventTypePush = "push" EventTypeTag = "tag" )
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 AutoCancelWorkflowV4Task ¶ added in v1.9.9
func AutoCancelWorkflowV4Task(autoCancelOpt *AutoCancelOpt, log *zap.SugaredLogger) error
func CodehubGetLatestCommit ¶ added in v1.3.0
func ContainsFile ¶
func ContainsFile(h *commonmodels.GitHook, file string) bool
ContainsFile "/" 代表全部文件
func ConvertScanningHookToMainHookRepo ¶ added in v1.9.9
func ConvertScanningHookToMainHookRepo(hook *commonmodels.ScanningHook) *commonmodels.MainHookRepo
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 GetAddress ¶ added in v1.4.0
func GetCodehubServiceTemplates ¶ added in v1.3.0
func GetCodehubServiceTemplates() ([]*commonmodels.Service, error)
func GetGerritServiceTemplates ¶
func GetGerritServiceTemplates() ([]*commonmodels.Service, error)
GetGerritServiceTemplates Get all service templates maintained in gerrit
func GetGiteeServiceTemplates ¶ added in v1.9.9
func GetGiteeServiceTemplates() ([]*commonmodels.Service, error)
GetGiteeServiceTemplates Get all service templates maintained in gitee
func GetGithubServiceTemplates ¶
func GetGithubServiceTemplates() ([]*commonmodels.Service, error)
func GetGitlabServiceTemplates ¶
func GetGitlabServiceTemplates() ([]*commonmodels.Service, error)
func GetOwnerRepoBranchPath ¶
GetOwnerRepoBranchPath 获取gitlab路径中的owner、repo、branch和path return address, owner, repo, branch, path, pathType Note this function needs be optimized badly!
func GetWorkspaceBasePath ¶ added in v1.9.9
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 MatchChanges ¶
func MatchChanges(m *commonmodels.MainHookRepo, files []string) bool
func ProcessCodehubHook ¶ added in v1.3.0
func ProcessGerritHook ¶
func ProcessGiteeHook ¶ added in v1.9.9
func ProcessGithubHook ¶
func ProcessGithubWebHook ¶
func ProcessGithubWebHookForTest ¶ added in v1.8.0
func ProcessGithubWebHookForWorkflowV4 ¶ added in v1.9.9
func ProcessGithubWebhookForScanning ¶ added in v1.9.9
func ProcessGitlabHook ¶
func SyncServiceTemplateFromCodehub ¶ added in v1.3.0
func SyncServiceTemplateFromCodehub(service *commonmodels.Service, log *zap.SugaredLogger) error
SyncServiceTemplateFromCodehub Force to sync Service Template to latest commit and content, Notes: if remains the same, quit sync; if updates, revision +1
func SyncServiceTemplateFromGerrit ¶
func SyncServiceTemplateFromGerrit(service *commonmodels.Service, log *zap.SugaredLogger) error
SyncServiceTemplateFromGerrit Force to sync Service Template to the latest commit and content, Notes: if remains the same, quit sync; if updates, revision +1
func SyncServiceTemplateFromGitee ¶ added in v1.9.9
func SyncServiceTemplateFromGitee(service *commonmodels.Service, log *zap.SugaredLogger) error
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 TriggerScanningByGithubEvent ¶ added in v1.9.9
func TriggerScanningByGithubEvent(event interface{}, requestID string, log *zap.SugaredLogger) error
func TriggerScanningByGitlabEvent ¶ added in v1.9.9
func TriggerScanningByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
func TriggerTestByGiteeEvent ¶ added in v1.9.9
func TriggerTestByGiteeEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
func TriggerTestByGithubEvent ¶ added in v1.8.0
func TriggerTestByGithubEvent(event interface{}, 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 TriggerWorkflowByCodehubEvent ¶ added in v1.3.0
func TriggerWorkflowByCodehubEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
func TriggerWorkflowByGerritEvent ¶
func TriggerWorkflowByGerritEvent(event *gerritTypeEvent, body []byte, uri, baseURI, domain, requestID string, log *zap.SugaredLogger) error
func TriggerWorkflowByGiteeEvent ¶ added in v1.9.9
func TriggerWorkflowByGiteeEvent(event interface{}, baseURI, 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 TriggerWorkflowV4ByGerritEvent ¶ added in v1.9.9
func TriggerWorkflowV4ByGerritEvent(event *gerritTypeEvent, body []byte, uri, baseURI, domain, requestID string, log *zap.SugaredLogger) error
func TriggerWorkflowV4ByGiteeEvent ¶ added in v1.9.9
func TriggerWorkflowV4ByGiteeEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
func TriggerWorkflowV4ByGithubEvent ¶ added in v1.9.9
func TriggerWorkflowV4ByGithubEvent(event interface{}, baseURI, deliveryID, requestID string, log *zap.SugaredLogger) error
func TriggerWorkflowV4ByGitlabEvent ¶ added in v1.9.9
func TriggerWorkflowV4ByGitlabEvent(event interface{}, baseURI, requestID string, log *zap.SugaredLogger) error
func UpdateWorkflowTaskArgs ¶ added in v1.8.0
func UpdateWorkflowTaskArgs(triggerYaml *TriggerYaml, workflow *commonmodels.Workflow, workFlowArgs *commonmodels.WorkflowTaskArgs, item *commonmodels.WorkflowHook, branref string, prId int) 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 { Type string MergeRequestID string Ref string CommitID string TaskType config.PipelineType MainRepo *commonmodels.MainHookRepo WorkflowArgs *commonmodels.WorkflowTaskArgs TestArgs *commonmodels.TestTaskArgs IsYaml bool AutoCancel bool YamlHookPath string WorkflowName string }
type Build ¶ added in v1.8.0
type Build struct {
Services []*BuildServices `yaml:"services"`
}
type BuildServices ¶ added in v1.8.0
type BuildServices struct { Name string `yaml:"name"` ServiceModule string `yaml:"service_module"` Variables []*Variables `yaml:"variables"` }
func ServicesMatchChangesFiles ¶ added in v1.8.0
func ServicesMatchChangesFiles(mf *MatchFoldersElem, files []string) []BuildServices
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 Deploy ¶ added in v1.8.0
type Deploy struct { Strategy DeployStrategy `yaml:"strategy"` Envsname []string `yaml:"envs_name"` EnvRecyclePolicy EnvRecyclePolicy `yaml:"env_recycle_policy"` BaseNamespace string `yaml:"base_env"` }
Strategy
single: Update to the specified environment; dynamic: Dynamic selection of idle environment; base: Create a new environment based on the baseline environment And Need to set EnvRecyclePolicy:success/always/never
type DeployStrategy ¶ added in v1.9.9
type DeployStrategy string
const ( DeployStrategySingle DeployStrategy = "single" DeployStrategyDynamic DeployStrategy = "dynamic" DeployStrategyBase DeployStrategy = "base" )
type EnvRecyclePolicy ¶ added in v1.9.9
type EnvRecyclePolicy string
const ( EnvRecyclePolicySuccess EnvRecyclePolicy = "success" EnvRecyclePolicyAlways EnvRecyclePolicy = "always" EnvRecyclePolicyNever EnvRecyclePolicy = "never" )
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 MatchFoldersElem ¶ added in v1.8.0
type MatchFoldersElem struct { MatchSwitch string `yaml:"match_switch"` MatchFoldersTree []*MatchFoldersTree `yaml:"match_folders_tree"` MatchFoldersSpecific string `yaml:"match_folders_specific"` }
type MatchFoldersTree ¶ added in v1.8.0
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"`
}
type Repo ¶ added in v1.8.0
type Repo struct {
Strategy TestRepoStrategy `yaml:"strategy"`
}
Strategy
default: Code repository information configured by default on the zadig platform currentRepo: Use current changed code information
type RepositoryInfo ¶
type Rules ¶ added in v1.8.0
type Rules struct { Branchs []string `yaml:"branchs"` Events []config.HookEventType `yaml:"events"` Strategy *StrategyRules `yaml:"strategy"` MatchFolders *MatchFoldersElem `yaml:"match_folders"` }
type StrategyRules ¶ added in v1.8.0
type StrategyRules struct {
AutoCancel bool `yaml:"auto_cancel"`
}
type SubmitterInfo ¶
type TestRepoStrategy ¶ added in v1.9.9
type TestRepoStrategy string
const ( TestRepoStrategyDefault TestRepoStrategy = "default" TestRepoStrategyCurrentRepo TestRepoStrategy = "currentRepo" )
type TriggerYaml ¶ added in v1.8.0
type UploaderInfo ¶
Source Files ¶
- auto_cancel_task.go
- codehub.go
- codehub_workflow_task.go
- gerrit.go
- gerrit_workflow_task.go
- gerrit_workflowv4_task.go
- gitee.go
- gitee_testing_task.go
- gitee_workflow_task.go
- gitee_workflowv4_task.go
- github.go
- github_scanning_task.go
- github_testing_task.go
- github_workflow_task.go
- github_workflowv4_task.go
- gitlab.go
- gitlab_pipeline_task.go
- gitlab_scanning_task.go
- gitlab_testing_task.go
- gitlab_workflow_task.go
- gitlab_workflowv4_task.go
- trigger_yaml.go
- utils.go