Documentation
¶
Index ¶
- Constants
- func NilOrEmpty(v Variables) bool
- type AgentConfig
- type AgentConfigResponse
- type AgentInit
- type AgentProfile
- type AgentStatus
- type AppEvent
- type AuthSecret
- type Cache
- type CmdIn
- type CmdOut
- type CmdStatus
- type CmdType
- type Config
- type ConfigBase
- type ConfigResponse
- type DockerConfig
- type DockerOption
- type DockerVolume
- type JobCache
- type JobCacheResponse
- type K8sConfig
- type RSASecret
- type Response
- type ResponseMessage
- type ResponseRaw
- type Secret
- type SecretBase
- type SecretField
- type SecretResponse
- type ShellIn
- type ShellLog
- type ShellOut
- type SimpleAuthPair
- type SimpleKeyPair
- type SmtpConfig
- type TextConfig
- type TokenSecret
- type TtyIn
- type TtyLog
- type TtyOut
- type Variables
Constants ¶
View Source
const ( // CmdExitCodeUnknown default exit code CmdExitCodeUnknown = -1 // CmdExitCodeTimeOut exit code for timeout CmdExitCodeTimeOut = -100 // CmdExitCodeKilled exit code for killed CmdExitCodeKilled = -1 // CmdExitCodeSuccess exit code for command executed successfully CmdExitCodeSuccess = 0 )
View Source
const ( TtyActionOpen = "OPEN" TtyActionClose = "CLOSE" TtyActionShell = "SHELL" )
View Source
const ( ConfigCategorySmtp = "SMTP" ConfigCategoryText = "TEXT" )
View Source
const ( SecretCategoryAuth = "AUTH" SecretCategorySshRsa = "SSH_RSA" SecretCategoryToken = "TOKEN" SecretCategoryAndroidSign = "ANDROID_SIGN" SecretCategoryKubeConfig = "KUBE_CONFIG" )
View Source
const ( VarServerUrl = "FLOWCI_SERVER_URL" VarAgentDebug = "FLOWCI_AGENT_DEBUG" // boolean VarAgentToken = "FLOWCI_AGENT_TOKEN" VarAgentPort = "FLOWCI_AGENT_PORT" VarAgentWorkspace = "FLOWCI_AGENT_WORKSPACE" VarAgentJobDir = "FLOWCI_AGENT_JOB_DIR" VarAgentPluginDir = "FLOWCI_AGENT_PLUGIN_DIR" VarAgentLogDir = "FLOWCI_AGENT_LOG_DIR" VarAgentVolumes = "FLOWCI_AGENT_VOLUMES" VarAgentDockerNetwork = "FLOWCI_AGENT_DOCKER_NETWORK" VarAgentDockerAuth = "FLOWCI_AGENT_DOCKER_AUTH" // for private docker repo auth VarAgentEnableProfile = "FLOWCI_AGENT_PROFILE_ENABLED" // boolean VarAgentFromDocker = "FLOWCI_DOCKER_AGENT" // boolean VarK8sEnabled = "FLOWCI_AGENT_K8S_ENABLED" // boolean VarK8sInCluster = "FLOWCI_AGENT_K8S_IN_CLUSTER" // boolean VarK8sNodeName = "K8S_NODE_NAME" VarK8sPodName = "K8S_POD_NAME" VarK8sPodIp = "K8S_POD_IP" VarK8sNamespace = "K8S_NAMESPACE" VarAgentIpPattern = "FLOWCI_AGENT_IP_%s" // ip address of agent host VarExportContainerIdPattern = "export CONTAINER_ID_%d=%s" // container id , d=index of dockers VarExportContainerIpPattern = "export CONTAINER_IP_%d=%s" // container ip , d=index of dockers )
View Source
const EventOnBusy = AppEvent("EventOnBusy")
View Source
const EventOnIdle = AppEvent("EventOnIdle")
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentConfig ¶
type AgentConfig struct {
ExitOnIdle int `json:"exitOnIdle"` // 0 for don't exit agent on idle
}
AgentConfig response body of AgentInit from server
type AgentConfigResponse ¶
type AgentConfigResponse struct {
Response
Data *AgentConfig
}
func (*AgentConfigResponse) GetMessage ¶
func (r *AgentConfigResponse) GetMessage() string
func (*AgentConfigResponse) IsOk ¶
func (r *AgentConfigResponse) IsOk() bool
type AgentInit ¶
type AgentInit struct {
IsK8sCluster bool `json:"isK8sCluster"`
IsDocker bool `json:"isDocker"`
Token string `json:"token"`
Port int `json:"port"`
Os string `json:"os"`
Status string `json:"status"`
}
AgentInit request data to get settings to server
type AgentProfile ¶
type AgentProfile struct {
CpuNum int `json:"cpuNum"`
CpuUsage float64 `json:"cpuUsage"`
TotalMemory uint64 `json:"totalMemory"`
FreeMemory uint64 `json:"freeMemory"`
TotalDisk uint64 `json:"totalDisk"`
FreeDisk uint64 `json:"freeDisk"`
}
AgentProfile token signed at server side
type AgentStatus ¶
type AgentStatus string
AgentStatus string of agent status
const ( // AgentOffline offline status AgentOffline AgentStatus = "OFFLINE" // AgentBusy busy status AgentBusy AgentStatus = "BUSY" // AgentIdle idle status AgentIdle AgentStatus = "IDLE" )
type AuthSecret ¶
type AuthSecret struct {
SecretBase
Pair *SimpleAuthPair `json:"pair"`
}
func (*AuthSecret) ToEnvs ¶
func (s *AuthSecret) ToEnvs() map[string]string
type ConfigBase ¶
func (*ConfigBase) ConfigMarker ¶
func (c *ConfigBase) ConfigMarker()
func (*ConfigBase) GetCategory ¶
func (c *ConfigBase) GetCategory() string
func (*ConfigBase) GetName ¶
func (c *ConfigBase) GetName() string
type ConfigResponse ¶
type ConfigResponse struct {
Response
Data *ConfigBase `json:"data"`
}
type DockerConfig ¶
type DockerConfig struct {
Name string
Auth *SimpleAuthPair
Config *container.Config
Host *container.HostConfig
IsStop bool
IsDelete bool
ContainerID string // try to resume if container id is existed
}
func (*DockerConfig) HasEntrypoint ¶
func (c *DockerConfig) HasEntrypoint() bool
type DockerOption ¶
type DockerOption struct {
Image string `json:"image"`
Auth string `json:"auth"`
Name string `json:"name"`
Entrypoint []string `json:"entrypoint"` // host:container
Command []string `json:"command"`
Ports []string `json:"ports"`
Network string `json:"network"`
Environment Variables `json:"environment"`
User string `json:"user"`
IsRuntime bool `json:"isRuntime"`
IsStopContainer bool `json:"isStopContainer"`
IsDeleteContainer bool `json:"isDeleteContainer"`
ContainerID string // try to resume if container id is existed
AuthContent *SimpleAuthPair // the real auth secret from 'auth' name
}
func (*DockerOption) HasAuth ¶
func (d *DockerOption) HasAuth() bool
func (*DockerOption) SetDefaultNetwork ¶
func (d *DockerOption) SetDefaultNetwork(network string)
func (*DockerOption) ToConfig ¶
func (d *DockerOption) ToConfig() *DockerConfig
func (*DockerOption) ToRuntimeConfig ¶
func (d *DockerOption) ToRuntimeConfig(vars Variables, workingDir string, binds []string) *DockerConfig
type DockerVolume ¶
type DockerVolume struct {
Name string // volume name
Dest string // dest path
Script string // script file name to execute
Image string // image contain volume
Init string // init script /ws/{init} in image that will copy required data to /target
}
DockerVolume volume will mount to step docker
func NewVolumesFromString ¶
func NewVolumesFromString(val string) []*DockerVolume
NewFromString parse string name=xxx,dest=xxx,script=xxx;name=xxx,dest=xxx,script=xxx;...
func (*DockerVolume) DefaultTargetInImage ¶
func (v *DockerVolume) DefaultTargetInImage() string
func (*DockerVolume) HasImage ¶
func (v *DockerVolume) HasImage() bool
func (*DockerVolume) InitScriptInImage ¶
func (v *DockerVolume) InitScriptInImage() string
func (*DockerVolume) ScriptPath ¶
func (v *DockerVolume) ScriptPath() string
func (*DockerVolume) ToBindStr ¶
func (v *DockerVolume) ToBindStr() string
type JobCacheResponse ¶
func (*JobCacheResponse) GetMessage ¶
func (r *JobCacheResponse) GetMessage() string
func (*JobCacheResponse) IsOk ¶
func (r *JobCacheResponse) IsOk() bool
type RSASecret ¶
type RSASecret struct {
SecretBase
Pair *SimpleKeyPair `json:"pair"`
MD5FingerPrint string `json:"md5Fingerprint"`
}
type ResponseMessage ¶
type ResponseRaw ¶
type ResponseRaw struct {
Raw json.RawMessage `json:"data"`
}
type SecretBase ¶
func (*SecretBase) GetCategory ¶
func (s *SecretBase) GetCategory() string
func (*SecretBase) GetName ¶
func (s *SecretBase) GetName() string
func (*SecretBase) SecretMarker ¶
func (s *SecretBase) SecretMarker()
type SecretField ¶
type SecretField struct {
Data string `json:"data"`
}
type SecretResponse ¶
type SecretResponse struct {
Response
Data *SecretBase `json:"data"`
}
type ShellIn ¶
type ShellIn struct {
CmdIn
ID string `json:"id"`
FlowId string `json:"flowId"`
JobId string `json:"jobId"`
AllowFailure bool `json:"allowFailure"`
Plugin string `json:"plugin"`
Cache *Cache `json:"cache"`
Dockers []*DockerOption `json:"dockers"`
Bash []string `json:"bash"`
Pwsh []string `json:"pwsh"`
Retry int `json:"retry"`
Timeout int `json:"timeout"`
Inputs Variables `json:"inputs"`
EnvFilters []string `json:"envFilters"`
Secrets []string `json:"secrets"` // secret name list
Configs []string `json:"configs"` // config name list
}
func (*ShellIn) HasConfigs ¶
func (*ShellIn) HasDockerOption ¶
func (*ShellIn) HasEnvFilters ¶
func (*ShellIn) HasSecrets ¶
func (*ShellIn) VarsToStringArray ¶
type ShellOut ¶
type ShellOut struct {
ID string `json:"id"`
ProcessId int `json:"processId"`
Containers []string `json:"containers"` // container ids applied for shell
Status CmdStatus `json:"status"`
Code int `json:"code"`
Output Variables `json:"output"`
StartAt time.Time `json:"startAt"`
FinishAt time.Time `json:"finishAt"`
Error string `json:"error"`
LogSize int64 `json:"logSize"`
}
func NewShellOutput ¶
func (*ShellOut) IsFinishStatus ¶
type SimpleAuthPair ¶
type SimpleKeyPair ¶
type SmtpConfig ¶
type SmtpConfig struct {
ConfigBase
Server string
Port int
SecureType string `json:"secure"`
Auth *SimpleAuthPair
}
func (*SmtpConfig) ToEnvs ¶
func (c *SmtpConfig) ToEnvs() map[string]string
type TextConfig ¶
type TextConfig struct {
ConfigBase
Text string
}
func (*TextConfig) ToEnvs ¶
func (c *TextConfig) ToEnvs() map[string]string
type TokenSecret ¶
type TokenSecret struct {
SecretBase
Token *SecretField `json:"token"`
}
func (*TokenSecret) ToEnvs ¶
func (s *TokenSecret) ToEnvs() map[string]string
type TtyOut ¶
type TtyOut struct {
ID string `json:"id"`
Action string `json:"action"`
IsSuccess bool `json:"success"`
Error string `json:"error"`
}
Open, Close control action response
type Variables ¶
Variables applied for environment variable as key, value
func ConnectVars ¶
func NewVariables ¶
func NewVariables() Variables
func (Variables) AddMapVars ¶
func (Variables) ToStringArray ¶
ToStringArray convert variables map to key=value string array
Click to show internal directories.
Click to hide internal directories.