Documentation
¶
Index ¶
- Constants
- func RegisterExecutor(executor string, provider ExecutorProvider)
- type BuildError
- type Docker
- type DockerVolume
- type Execution
- type Executor
- type ExecutorProvider
- type FailuresCollector
- type GitConfig
- type Image
- type Job
- type JobCredentials
- type JobFailureReason
- type JobInfo
- type JobLogger
- func (e *JobLogger) Debugln(args ...interface{})
- func (e *JobLogger) Errorln(args ...interface{})
- func (e *JobLogger) Infoln(args ...interface{})
- func (e *JobLogger) Println(args ...interface{})
- func (e *JobLogger) SendRawLog(args ...interface{})
- func (e *JobLogger) SoftErrorln(args ...interface{})
- func (e *JobLogger) Warningln(args ...interface{})
- func (e *JobLogger) WithFields(fields logrus.Fields) JobLogger
- func (e *JobLogger) WriterLevel(level logrus.Level) *io.PipeWriter
- type JobRequest
- type JobResponse
- type JobResultRequest
- type JobState
- type JobTrace
- type JobVariable
- type JobVariables
- type KafkaConfig
- type Kubernetes
- type MinioConfig
- type PluginInfo
- type PluginRequest
- type PluginResponse
- type Plugins
- type Read
- type ResultData
- type RunnerConfig
- type RunnerCredentials
- type Services
- type UpdateJobInfo
- type UpdateJobRequest
- type UpdateState
- type VersionInfo
- type Volume
- type Writer
Constants ¶
View Source
const ArtifactWebhook = "/api/v4/artifacts/webhook"
View Source
const BashDetectShell = `` /* 401-byte string literal not displayed */
View Source
const DefaultDockerWorkspace = "/workspace" // docker executor worspace dir
View Source
const DefaultLivessTimeout = 1800 // pod 生产时间
View Source
const DefaultMetricsServerPort = 9252 //prometheus metrics 端口
View Source
const DefaultNetworkClientTimeout = 60 * time.Minute // http 底层 timeout 超时时间
View Source
const DefaultOutputLimit = 4 * 1024 * 1024 // 日志文件大小 4MB
View Source
const DefaultTracePatchLimit = 1024 * 1024 // 每次上传日志大小 1MB
View Source
const ForceTraceSentInterval = 30 * time.Second // 30s 强制解锁
View Source
const KubernetesPollAttempts = 100 // 尝试获得 Pod 详情次数
View Source
const KubernetesPollInterval = 10 * time.Second // 每次查询 pod 详情 间隔时间
View Source
const NAME = "super-runner"
View Source
const PluginsInput = "/api/v4/plugins/input"
api
View Source
const PluginsOutput = "/api/v4/plugins/output"
View Source
const SSHConnectRetries = 3 // ssh 重试次数
View Source
const SSHRetryInterval = 3 //ssh 间隔时间
View Source
const UpdateInterval = 3 * time.Second // 每隔 3s 监控一个job 状态及上传日志
View Source
const UpdateRetryInterval = 3 * time.Second // 30s 重试间隔时间
View Source
const VERSION = "2020-12-08"
Variables ¶
This section is empty.
Functions ¶
func RegisterExecutor ¶
func RegisterExecutor(executor string, provider ExecutorProvider)
Types ¶
type BuildError ¶
type BuildError struct {
Inner error
}
func (*BuildError) Error ¶
func (b *BuildError) Error() string
type Docker ¶
type Docker struct { DNS []string `toml:"dns,omitempty" json:"dns" long:"dns" env:"DOCKER_DNS" description:"A list of DNS servers for the container to use"` DockerWorkspace string `toml:"workspace"` Privileged bool `` /* 138-byte string literal not displayed */ Volumes []DockerVolume `` /* 284-byte string literal not displayed */ }
type DockerVolume ¶
type ExecutorProvider ¶
func GetExecutor ¶
func GetExecutor(executorStr string) ExecutorProvider
type FailuresCollector ¶
type FailuresCollector interface {
RecordFailure(reason JobFailureReason, runnerDescription string)
}
prometheus 异常收集器
type Job ¶
type Job struct { Runner RunnerConfig JobResponse Trace JobTrace JobName string }
type JobCredentials ¶
JobCredentials 是 job 请求的凭证,带上 pipeline,stageIndex,jobIndex 方便后端定位
type JobFailureReason ¶
type JobFailureReason string // job 失败的原因(系统级别简要分析)
const ( NoneFailure JobFailureReason = "" ScriptFailure JobFailureReason = "script_failure" RunnerSystemFailure JobFailureReason = "runner_system_failure" JobExecutionTimeout JobFailureReason = "job_execution_timeout" )
type JobInfo ¶
type JobInfo struct { Pipeline string `json:"pipeline"` PipelineNumber int `json:"pipeline_number"` ProjectID int `json:"project_id"` Stage string `json:"stage"` StageIndex int `json:"stage_index"` JobName string `json:"job_name"` JobNumber int `json:"job_number"` JobIndex int `json:"job_index"` Timestamp int64 `json:"timestamp"` Image Image `json:"image"` Services Services `json:"services,omitempty"` Volumes []Volume `json:"volumes,omitempty"` Variables JobVariables `json:"variables,omitempty"` Plugins Plugins `json:"plugins"` Timeout int32 `json:"timeout,omitempty"` }
type JobLogger ¶
type JobLogger struct {
// contains filtered or unexported fields
}
func (*JobLogger) SendRawLog ¶
func (e *JobLogger) SendRawLog(args ...interface{})
func (*JobLogger) SoftErrorln ¶
func (e *JobLogger) SoftErrorln(args ...interface{})
func (*JobLogger) WriterLevel ¶
func (e *JobLogger) WriterLevel(level logrus.Level) *io.PipeWriter
type JobRequest ¶
type JobRequest struct { Info VersionInfo `json:"info,omitempty"` Token string `json:"token,omitempty"` }
type JobResponse ¶
type JobResponse struct { ID string `json:"id"` Token string `json:"token"` JobInfo JobInfo `json:"job_info"` }
JobResponse 为解析 json 的结构体
type JobResultRequest ¶
type JobResultRequest struct { Info VersionInfo `json:"info,omitempty"` Token string `json:"token,omitempty"` JobInfo JobInfo `json:"job_info"` Data ResultData `json:"result_data"` }
type JobTrace ¶
type JobTrace interface { io.Writer Success() Fail(err error, failureReason JobFailureReason) SetCancelFunc(cancelFunc context.CancelFunc) SetFailuresCollector(fc FailuresCollector) SetMasked(values []string) IsStdout() bool }
Job 日志跟踪接口
type JobVariable ¶
func ParseVariable ¶
func ParseVariable(text string) (variable JobVariable, err error)
func (JobVariable) String ¶
func (b JobVariable) String() string
type JobVariables ¶
type JobVariables []JobVariable
func (JobVariables) Expand ¶
func (b JobVariables) Expand() (variables JobVariables)
func (JobVariables) ExpandValue ¶
func (b JobVariables) ExpandValue(value string) string
func (JobVariables) Get ¶
func (b JobVariables) Get(key string) string
func (JobVariables) StringList ¶
func (b JobVariables) StringList() (variables []string)
type KafkaConfig ¶
type Kubernetes ¶
type MinioConfig ¶
type PluginInfo ¶
type PluginRequest ¶
type PluginResponse ¶
type PluginResponse struct { ID int `json:"id"` Token string `json:"token"` PluginInfo PluginInfo `json:"plugin_info"` }
type ResultData ¶
type RunnerConfig ¶
type RunnerConfig struct { Name string `toml:"name"` Executor string `toml:"executor"` Concurrent int `toml:"concurrent"` OutputLimit int `` /* 126-byte string literal not displayed */ LogLevel string `toml:"log_level"` Log string `toml:"log"` TempLogDir string `toml:"temp_log_dir"` ListenAddress string `toml:"listen_address,omitempty" json:"listen_address"` KafkaConfig KafkaConfig `toml:"kafka"` Kubernetes Kubernetes `toml:"kubernetes"` MinioConfig MinioConfig `toml:"minio"` Docker Docker `toml:"docker"` GitConfig GitConfig `toml:"git"` RunnerCredentials }
func (*RunnerConfig) GetListenAddress ¶
func (config *RunnerConfig) GetListenAddress() (string, error)
获取 ListenAddress 配置地址
func (*RunnerConfig) LoadConfig ¶
func (config *RunnerConfig) LoadConfig(configFile string) error
解析配置文件
type RunnerCredentials ¶
type RunnerCredentials struct { URL string `toml:"url" json:"url" short:"u" long:"url" env:"CI_SERVER_URL" required:"true" description:"Runner URL"` Token string `toml:"token" json:"token" short:"t" long:"token" env:"CI_SERVER_TOKEN" required:"true" description:"Runner token"` }
func (*RunnerCredentials) GetToken ¶
func (c *RunnerCredentials) GetToken() string
func (*RunnerCredentials) GetURL ¶
func (c *RunnerCredentials) GetURL() string
type UpdateJobInfo ¶
type UpdateJobInfo struct { ID string State JobState FailureReason JobFailureReason }
UpdateJobInfo 是更新 job 状态的内容
type UpdateJobRequest ¶
type UpdateJobRequest struct { Info VersionInfo `json:"info,omitempty"` Token string `json:"token,omitempty"` State JobState `json:"state,omitempty"` FailureReason JobFailureReason `json:"failure_reason,omitempty"` }
UpdateJobRequest 更新 job 的 request 内容
type UpdateState ¶
type UpdateState int // 日志内容上传的状态标识
const ( UpdateSucceeded UpdateState = iota UpdateNotFound UpdateAbort UpdateFailed UpdateRangeMismatch )
type VersionInfo ¶
Click to show internal directories.
Click to hide internal directories.