Documentation
¶
Index ¶
- Constants
- type Agent
- func (agent *Agent) AppendError(err error)
- func (agent *Agent) Callback()
- func (agent *Agent) Execute(r io.Reader)
- func (agent *Agent) Exit()
- func (agent *Agent) ListenSignal()
- func (agent *Agent) MergeErrors() []apistructs.ErrorResponse
- func (agent *Agent) PreStop()
- func (agent *Agent) Teardown(exitCode ...int)
- type AgentArg
- type Callback
- type EasyUse
- type RunningEnvironment
Constants ¶
View Source
const ( CONTEXTDIR = "CONTEXTDIR" WORKDIR = "WORKDIR" METAFILE = "METAFILE" UPLOADDIR = "UPLOADDIR" )
View Source
const ( EnvDiceOpenapiPublicUrl = "DICE_OPENAPI_PUBLIC_URL" EnvDiceOpenapiAddr = "DICE_OPENAPI_ADDR" EnvDiceIsEdge = "DICE_IS_EDGE" )
View Source
const ( EnvStdErrRegexpList = "ACTIONAGENT_STDERR_REGEXP_LIST" EnvMaxWaitingPathUnlockSec = "ACTIONAGENT_MAX_WAITING_PATH_UNLOCK_SEC" DefaultMaxWaitingPathUnlockSec = 10 )
View Source
const ( EnvSuffixPublicURL = "_PUBLIC_URL" EnvSuffixAddr = "_ADDR" )
View Source
const ( EnvEnablePushLog2Collector = "ACTIONAGENT_ENABLE_PUSH_LOG_TO_COLLECTOR" EnvCollectorAddr = "COLLECTOR_ADDR" EnvTaskLogID = "TERMINUS_DEFINE_TAG" )
View Source
const EncryptedValueMinLen = "ACTIONAGENT_ENCRYPTED_VAlUE_MIN_LEN"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
Arg *AgentArg
EasyUse EasyUse
// errs collect occurred errors
Errs []error
FileWatcher *filewatch.Watcher
FWLock sync.Mutex
// PushedMetaFileMap store key value already pushed
// first-level key: meta name; second-level key: meta value
// for situation that one key has multiple values
PushedMetaFileMap map[string]map[string]struct{}
LockPushedMetaFileMap sync.RWMutex
Ctx context.Context
Cancel context.CancelFunc // cancel when logic done
ExitCode int
StdErrRegexpList []*regexp.Regexp
MaxWaitingPathUnlockSec int
TextBlackList []string // enciphered data will Replaced by '******' when log output
}
func (*Agent) AppendError ¶
func (*Agent) ListenSignal ¶
func (agent *Agent) ListenSignal()
func (*Agent) MergeErrors ¶
func (agent *Agent) MergeErrors() []apistructs.ErrorResponse
type AgentArg ¶
type AgentArg struct {
PullBootstrapInfo bool `json:"pullBootstrapInfo"`
Commands []string `json:"commands,omitempty"` // custom action commands -> script -> run
Context spec.PipelineTaskContext `json:"context,omitempty"` // 上下文
PrivateEnvs map[string]string `json:"privateEnvs,omitempty"`
PipelineID uint64 `json:"pipelineID"`
PipelineTaskID uint64 `json:"pipelineTaskID"`
EncryptSecretKeys []string `json:"encryptSecretKeys"` // Encrypt envs, it will Replaced by '******' when log output
}
func NewAgentArgForPull ¶
type Callback ¶
type Callback apistructs.ActionCallback
func (*Callback) AppendMetadataFields ¶
func (c *Callback) AppendMetadataFields(fields []*apistructs.MetadataField)
append fields to metadata and limit metadataField
func (*Callback) HandleMetaFile ¶
1) decode as: apistructs.Metadata 2) decode as: line(k=v)
type EasyUse ¶
type EasyUse struct {
ContainerContext string // 容器内程序运行时上下文目录
ContainerWd string // 执行 run 程序时所在目录
ContainerMetaFile string // metadata 文件
ContainerUploadDir string // uploadDir,该目录下的文件在执行结束后会自动上传,并提供下载
ContainerTempTarUploadDir string // temp tar dir,需要 prepare 时预先创建,用于存放 upload 生成的 tar
IsEdgeCluster bool // 是否是边缘集群
RunScript string // run 文件
RunProcess *os.Process
RunMultiStdoutFilePath string // multiWriter(os.Stdout) 的文件路径
RunMultiStdout *os.File // multiWriter(os.Stdout) 的文件
RunMultiStderrFilePath string // multiWriter(os.Stderr) 的文件路径
RunMultiStderr *os.File // multiWriter(os.Stderr) 的文件
FlagEndLineForTail string // flag end line for tail to stop
OpenAPIAddr string
OpenAPIToken string
TokenForBootstrap string
EnablePushLog2Collector bool // 是否推送日志到 collector
CollectorAddr string // collector 地址
TaskLogID string // 日志 ID,推送和查询时需要一致
// Machine stat
MachineStat apistructs.PipelineTaskMachineStat
}
type RunningEnvironment ¶
type RunningEnvironment struct {
HostIP string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.