Documentation
¶
Index ¶
- Constants
- type AuthType
- type BranchFilterInfo
- type Command
- type RepoSource
- type Repository
- func (r *Repository) BranchRef() string
- func (repo *Repository) GetReleaseCandidateTag(taskID int64) string
- func (repo *Repository) GetRepoNamespace() string
- func (r *Repository) PRRef() string
- func (r *Repository) PRRefByPRID(pr int) string
- func (r *Repository) Ref() string
- func (r *Repository) TagRef() string
- type SourceFrom
- type Status
Constants ¶
const ( ZADIG_SERVER_URL = "ZADIG_SERVER_URL" AGENT_TOKEN = "AGENT_TOKEN" AGENT_STATUS = "AGENT_STATUS" AGENT_DESCRIPTION = "AGENT_DESCRIPTION" AGENT_CONCURRENCY = "AGENT_CONCURRENCY" AGENT_VERSION = "ZADIG_AGENT_VERSION" ZADIG_VERSION = "ZADIG_VERSION" AGENT_INSTALL_TIME = "AGENT_INSTALL_TIME" AGENT_INSTALL_USER = "AGENT_INSTALL_USER" AGENT_UPDATE_TIME = "AGENT_UPDATE_TIME" AGENT_UPDATE_USER = "AGENT_UPDATE_USER" AGENT_WORK_DIRECTORY = "AGENT_WORK_DIRECTORY" )
config const
const ( AGENT_STATUS_INIT = "init" AGENT_STATUS_REGISTERING = "registering" AGENT_STATUS_REGISTERED = "registered" AGENT_STATUS_RUNNING = "running" AGENT_STATUS_ABNORMAL = "abnormal" AGENT_STATUS_UPDATING = "updating" AGENT_STATUS_STOP = "stop" )
agent status
const ( DefaultAgentConcurrency = 10 DefaultAgentConcurrencyBlockTime = 5 DefaultAgentPollingInterval = 3 DefaultJobReportInterval = 1 DefaultJobLogReadNum = 100 )
const ( LogLevelDebug = "debug" LogLevelInfo = "info" LogLevelWarning = "warning" LogLevelError = "error" LogLevelFatal = "fatal" )
const ( JobOutputDir = "zadig/results/" Home = "HOME" JobLogTmpDir = "/tmp/job-log/" JobScriptTmpDir = "/tmp/job-script/" JobOutputsTmpDir = "/tmp/job-outputs/" JobCacheTmpDir = "/tmp/caches" )
config const
const ( CacheDirWorkspaceType = "workspace" CacheDirUserDefineType = "user_defined" )
const ( // ProviderGithub ... ProviderGithub = "github" // ProviderGitlab ... ProviderGitlab = "gitlab" // ProviderGerrit ProviderGerrit = "gerrit" // ProviderCodehub ProviderCodehub = "codehub" // ProviderGitee ProviderGitee = "gitee" // ProviderGiteeEE ProviderGiteeEE = "gitee-enterprise" // ProviderOther ProviderOther = "other" )
const ( // MaxContainerTerminationMessageLength is the upper bound any one container may write to // its termination message path. Contents above this length will cause a failure. MaxContainerTerminationMessageLength = 1024 * 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BranchFilterInfo ¶
type BranchFilterInfo struct {
// repository identifier
CodehostID int `bson:"codehost_id" json:"codehost_id"`
RepoOwner string `bson:"repo_owner" json:"repo_owner"`
RepoName string `bson:"repo_name" json:"repo_name"`
RepoNamespace string `bson:"repo_namespace" json:"repo_namespace"`
// actual regular expression filter
FilterRegExp string `bson:"filter_regexp" json:"filter_regexp"`
DefaultBranch string `bson:"default_branch" json:"default_branch"`
}
func (*BranchFilterInfo) GetNamespace ¶
func (bf *BranchFilterInfo) GetNamespace() string
type RepoSource ¶
type RepoSource string
const ( RepoSourceRuntime RepoSource = "" RepoSourceParam RepoSource = "param" RepoSourceJob RepoSource = "job" )
type Repository ¶
type Repository struct {
Source string `bson:"source,omitempty" json:"source,omitempty" yaml:"source,omitempty"`
RepoOwner string `bson:"repo_owner" json:"repo_owner" yaml:"repo_owner"`
RepoNamespace string `bson:"repo_namespace" json:"repo_namespace" yaml:"repo_namespace"`
RepoName string `bson:"repo_name" json:"repo_name" yaml:"repo_name"`
RemoteName string `bson:"remote_name,omitempty" json:"remote_name,omitempty" yaml:"remote_name,omitempty"`
Branch string `bson:"branch" json:"branch" yaml:"branch"`
PR int `bson:"pr,omitempty" json:"pr,omitempty" yaml:"pr,omitempty"`
PRs []int `bson:"prs,omitempty" json:"prs,omitempty" yaml:"prs,omitempty"`
Tag string `bson:"tag,omitempty" json:"tag,omitempty" yaml:"tag,omitempty"`
CommitID string `bson:"commit_id,omitempty" json:"commit_id,omitempty" yaml:"commit_id,omitempty"`
CommitMessage string `bson:"commit_message,omitempty" json:"commit_message,omitempty" yaml:"commit_message,omitempty"`
CheckoutPath string `bson:"checkout_path,omitempty" json:"checkout_path,omitempty" yaml:"checkout_path,omitempty"`
SubModules bool `bson:"submodules,omitempty" json:"submodules,omitempty" yaml:"submodules,omitempty"`
// Hidden defines whether the frontend needs to hide this repo
Hidden bool `bson:"hidden" json:"hidden" yaml:"hidden"`
// UseDefault defines if the repo can be configured in agent pipeline task page
UseDefault bool `bson:"use_default,omitempty" json:"use_default,omitempty" yaml:"use_default,omitempty"`
// IsPrimary used to generated image and package name, each build has one primary repo
IsPrimary bool `bson:"is_primary" json:"is_primary" yaml:"is_primary"`
CodehostID int `bson:"codehost_id" json:"codehost_id" yaml:"codehost_id"`
// add
OauthToken string `bson:"oauth_token" json:"oauth_token" yaml:"oauth_token"`
Address string `bson:"address" json:"address" yaml:"address"`
AuthorName string `bson:"author_name,omitempty" json:"author_name,omitempty" yaml:"author_name,omitempty"`
CheckoutRef string `bson:"checkout_ref,omitempty" json:"checkout_ref,omitempty" yaml:"checkout_ref,omitempty"`
// codehub
ProjectUUID string `bson:"project_uuid,omitempty" json:"project_uuid,omitempty" yaml:"project_uuid,omitempty"`
RepoUUID string `bson:"repo_uuid,omitempty" json:"repo_uuid,omitempty" yaml:"repo_uuid,omitempty"`
RepoID string `bson:"repo_id,omitempty" json:"repo_id,omitempty" yaml:"repo_id,omitempty"`
Username string `bson:"username,omitempty" json:"username,omitempty" yaml:"username,omitempty"`
Password string `bson:"password,omitempty" json:"password,omitempty" yaml:"password,omitempty"`
// Now EnableProxy is not something we store. We decide this on runtime
EnableProxy bool `bson:"-" json:"enable_proxy,omitempty" yaml:"enable_proxy,omitempty"`
// FilterRegexp is the regular expression filter for the branches and tags
FilterRegexp string `bson:"-" json:"filter_regexp,omitempty" yaml:"filter_regexp,omitempty"`
// The address of the code base input of the other type
AuthType AuthType `bson:"auth_type,omitempty" json:"auth_type,omitempty" yaml:"auth_type,omitempty"`
SSHKey string `bson:"ssh_key,omitempty" json:"ssh_key,omitempty" yaml:"ssh_key,omitempty"`
PrivateAccessToken string `bson:"private_access_token,omitempty" json:"private_access_token,omitempty" yaml:"private_access_token,omitempty"`
/*
repo can come from params or other job, introduced in 1.3.1
*/
SourceFrom RepoSource `bson:"source_from" json:"source_from" yaml:"source_from"`
GlobalParamName string `bson:"param_name" json:"param_name" yaml:"param_name"`
JobName string `bson:"job_name" json:"job_name" yaml:"job_name"`
ServiceName string `bson:"service_name" json:"service_name" yaml:"service_name"`
ServiceModule string `bson:"service_module" json:"service_module" yaml:"service_module"`
JobRepoIndex int `bson:"repo_index" json:"repo_index" yaml:"repo_index"`
SubmissionID string `bson:"submission_id" json:"submission_id" yaml:"submission_id"`
}
Repository struct
func (*Repository) BranchRef ¶
func (r *Repository) BranchRef() string
BranchRef returns branch refs format e.g. refs/heads/master
func (*Repository) GetReleaseCandidateTag ¶
func (repo *Repository) GetReleaseCandidateTag(taskID int64) string
GetReleaseCandidateTag 返回待发布对象Tag Branch: 20060102150405-{TaskID}-master PR: 20060102150405-{TaskID}-pr-1765 Branch + PR: 20060102150405-{TaskID}-master-pr-1276 Tag: 20060102150405-{TaskID}-v0.9.1
func (*Repository) GetRepoNamespace ¶
func (repo *Repository) GetRepoNamespace() string
func (*Repository) PRRef ¶
func (r *Repository) PRRef() string
PRRef returns refs format It will check repo provider type, by default returns github refs format.
e.g. github returns refs/pull/1/head e.g. gitlab returns merge-requests/1/head
func (*Repository) PRRefByPRID ¶
func (r *Repository) PRRefByPRID(pr int) string
func (*Repository) Ref ¶
func (r *Repository) Ref() string
Ref returns the changes ref of current repo in the following order: 1. tag ref 2. branch ref 3. pr ref
func (*Repository) TagRef ¶
func (r *Repository) TagRef() string
TagRef returns the tag ref of current repo e.g. refs/tags/v1.0.0
type SourceFrom ¶
type SourceFrom struct {
Enabled bool `bson:"enabled" json:"enabled" yaml:"enabled"`
SourceType RepoSource `bson:"source_type" json:"source_type" yaml:"source_type"`
}
repo source, repo can come from params or other job
type Status ¶
type Status string
const ( StatusDisabled Status = "disabled" StatusCreated Status = "created" StatusRunning Status = "running" StatusPassed Status = "passed" StatusSkipped Status = "skipped" StatusFailed Status = "failed" StatusTimeout Status = "timeout" StatusCancelled Status = "cancelled" StatusWaiting Status = "waiting" StatusQueued Status = "queued" StatusBlocked Status = "blocked" QueueItemPending Status = "pending" StatusChanged Status = "changed" StatusNotRun Status = "notRun" StatusPrepare Status = "prepare" StatusReject Status = "reject" StatusDistributed Status = "distributed" )
zadig job status