Documentation ¶
Overview ¶
All struct fields are required, unless "Optional" explicitly declared.
Index ¶
- Constants
- Variables
- func ApplyKVsWithPriority(kvs ...map[string]string) map[string]string
- func GenerateFlowUUID(yUUID string) string
- func GenerateStageUUID(stageName string, index int, yUUID string) string
- func GenerateTaskUUID(stageIndex int, stageName string, taskIndex int, taskName string, yUUID string) string
- func InsertStage(s *[]*Stage, index int, data *Stage) error
- func Map2MetadataFields(m map[string]string) []metadata.MetadataField
- func MetadataFields2Map(metas []metadata.MetadataField) map[string]string
- func RenderPlaceholders(input string, placeholders []metadata.MetadataField) (string, error)
- func ResourceDir(suffix string) string
- type Config
- type CustomTask
- func (t *CustomTask) GetCustomTaskRunPathArgs() []string
- func (t *CustomTask) GetEnvs() map[string]string
- func (t *CustomTask) GetResource() *Resource
- func (t *CustomTask) GetResourceType() string
- func (t *CustomTask) GetStatus() string
- func (t *CustomTask) GetTaskConfig() TaskConfig
- func (t *CustomTask) GetTaskParams() Params
- func (t *CustomTask) GetTimeout() (time.Duration, error)
- func (t *CustomTask) GetVersion() Version
- func (t *CustomTask) IsDisable() bool
- func (t *CustomTask) IsPause() bool
- func (t *CustomTask) IsResourceTask() bool
- func (t *CustomTask) Name() string
- func (t *CustomTask) OutputToContext() []string
- func (t *CustomTask) RequiredContext(y PipelineYml) []string
- func (t *CustomTask) Resources() []string
- func (t *CustomTask) SetStatus(status string)
- func (t *CustomTask) Type() steptasktype.StepTaskType
- func (t *CustomTask) Validate() error
- type Filter
- type Filters
- type GetRequest
- type GetTask
- func (get *GetTask) GetCustomTaskRunPathArgs() []string
- func (get *GetTask) GetEnvs() map[string]string
- func (get *GetTask) GetParams() Params
- func (get *GetTask) GetResource() *Resource
- func (get *GetTask) GetResourceType() string
- func (get *GetTask) GetStatus() string
- func (get *GetTask) GetTaskConfig() TaskConfig
- func (get *GetTask) GetTaskParams() Params
- func (get *GetTask) GetTimeout() (time.Duration, error)
- func (get *GetTask) GetVersion() Version
- func (get *GetTask) IsDisable() bool
- func (get *GetTask) IsPause() bool
- func (get *GetTask) IsResourceTask() bool
- func (get *GetTask) Name() string
- func (get *GetTask) OutputToContext() []string
- func (get *GetTask) RequiredContext(y PipelineYml) []string
- func (get *GetTask) SetStatus(status string)
- func (get *GetTask) Type() steptasktype.StepTaskType
- func (get *GetTask) Validate() error
- type ImageResource
- type OpOption
- func WithAgentContainerPath(agentContainerPath string) OpOption
- func WithAgentHostPath(agentHostPath string) OpOption
- func WithAlreadyTransformed(already bool) OpOption
- func WithBranch(branch string) OpOption
- func WithBuiltinResourceTypeDockerImagePrefixAndTag(prefix, tag string) OpOption
- func WithClusterName(clusterName string) OpOption
- func WithContainerResLimit(cpu, mem float64) OpOption
- func WithNFSRealPath(realPath string) OpOption
- func WithPlaceholders(placeholders []metadata.MetadataField) OpOption
- func WithRenderPlaceholder(render bool) OpOption
- type Option
- type Params
- type Pipeline
- type PipelineMetadata
- type PipelineYml
- func (y *PipelineYml) FindDockerImageByResourceName(name string) (repository, tag string, err error)
- func (y *PipelineYml) FindResourceByName(name string) (Resource, bool)
- func (y *PipelineYml) GetBpArgs(sourceId int) map[string]string
- func (y *PipelineYml) GetBpRepoArgs(sourceId int) map[string]string
- func (y *PipelineYml) GetGlobalEnvs() map[string]string
- func (y *PipelineYml) GetInstanceID() string
- func (y *PipelineYml) GetMetadata() PipelineMetadata
- func (y *PipelineYml) GetOptions() *Option
- func (y *PipelineYml) GetPlaceHolderTransformedEnvs() map[string]string
- func (y *PipelineYml) GetPlaceholders() []metadata.MetadataField
- func (y *PipelineYml) GetResourceID(taskName string) int
- func (y *PipelineYml) GetTaskDisableStatus(taskUUID string) (bool, error)
- func (y *PipelineYml) GetTaskEnvs(taskUUID string) (map[string]string, error)
- func (y *PipelineYml) GetTaskForceBuildpackStatus(taskUUID string) bool
- func (y *PipelineYml) GetTaskPauseStatus(taskUUID string) (bool, error)
- func (y *PipelineYml) GetTriggerScheduleCron() (string, bool)
- func (y *PipelineYml) InsertDiceHub() error
- func (y *PipelineYml) JSON() (string, error)
- func (y *PipelineYml) JSONPretty() (string, error)
- func (y *PipelineYml) Object() *Pipeline
- func (y *PipelineYml) Parse(ops ...OpOption) error
- func (y *PipelineYml) ParseWithAllFields(ops ...OpOption) error
- func (y *PipelineYml) ReRender() error
- func (y *PipelineYml) SetPipelineID(pipelineID uint64)
- func (y *PipelineYml) StringData() string
- func (y *PipelineYml) UpdatePipelineOnBpArgs(resource string, bp_args, bp_repo_args map[string]string) error
- func (y *PipelineYml) UpdatePipelineOnGlobal(kvs map[string]string) error
- func (y *PipelineYml) UpdatePipelineOnTask(expectUUID string, params TaskUpdateParams) error
- func (y *PipelineYml) UpdatePipelineWorkspaceOnBpArgs(env string) error
- func (y *PipelineYml) ValidateResTypes() error
- func (y *PipelineYml) Version() string
- func (y *PipelineYml) YAML() (string, error)
- type PutTask
- func (put *PutTask) GetCustomTaskRunPathArgs() []string
- func (put *PutTask) GetEnvs() map[string]string
- func (put *PutTask) GetResource() *Resource
- func (put *PutTask) GetResourceType() string
- func (put *PutTask) GetStatus() string
- func (put *PutTask) GetTaskConfig() TaskConfig
- func (put *PutTask) GetTaskParams() Params
- func (put *PutTask) GetTimeout() (time.Duration, error)
- func (put *PutTask) GetVersion() Version
- func (put *PutTask) IsDisable() bool
- func (put *PutTask) IsPause() bool
- func (put *PutTask) IsResourceTask() bool
- func (put *PutTask) Name() string
- func (put *PutTask) OutputToContext() []string
- func (put *PutTask) RequiredContext(y PipelineYml) []string
- func (put *PutTask) SetStatus(status string)
- func (put *PutTask) Type() steptasktype.StepTaskType
- func (put *PutTask) Validate() error
- type Resource
- type ResourceType
- type Run
- type Schedule
- type Source
- type Stage
- type StepTask
- type TaskConfig
- type TaskInputConfig
- type TaskOutputConfig
- type TaskUpdateParams
- type Trigger
- type Version
Constants ¶
const ( RES_TYPE_GIT builtinResType = "git" RES_TYPE_BUILDPACK builtinResType = "buildpack" RES_TYPE_BP_COMPILE builtinResType = "bp-compile" RES_TYPE_BP_IMAGE builtinResType = "bp-image" RES_TYPE_DICE builtinResType = "dice" RES_TYPE_ABILITY builtinResType = "ability" RES_TYPE_ADDON_REGISTRY builtinResType = "addon-registry" RES_TYPE_DICEHUB builtinResType = "dicehub" RES_TYPE_IT builtinResType = "it" RES_TYPE_SONAR builtinResType = "sonar" RES_TYPE_FLINK builtinResType = "flink" RES_TYPE_SPARK builtinResType = "spark" RES_TYPE_UT builtinResType = "ut" )
builtinResType declaration 如有更新,请进入 gogenerate 目录重新运行 go generate 并提交
const ( GIT_BRANCH = "git-branch" GLOBAL_ENV = "global-env" )
const ( BuiltinResourceTypeDefaultDockerImagePrefix = "registry.cn-hangzhou.aliyuncs.com/terminus" BuiltinResourceTypeDefaultDockerImageTag = "latest" )
const DockerImageResType = "docker-image"
Variables ¶
var BuiltinResTypeNames = []string{ string(RES_TYPE_GIT), string(RES_TYPE_BUILDPACK), string(RES_TYPE_BP_COMPILE), string(RES_TYPE_BP_IMAGE), string(RES_TYPE_DICE), string(RES_TYPE_ABILITY), string(RES_TYPE_ADDON_REGISTRY), string(RES_TYPE_DICEHUB), string(RES_TYPE_IT), string(RES_TYPE_SONAR), string(RES_TYPE_FLINK), string(RES_TYPE_SPARK), string(RES_TYPE_UT), }
Functions ¶
func ApplyKVsWithPriority ¶
ApplyKVsWithPriority generates a result map with the rule that the latter will overwrite the former. For example:
priority: e1 > e2 > e3 you should pass param `envs` as: e3, e2, e1
func GenerateFlowUUID ¶
func GenerateTaskUUID ¶
func GenerateTaskUUID(stageIndex int, stageName string, taskIndex int, taskName string, yUUID string) string
GenerateTaskUUID have some constrains 如果存在多个 job 执行器,需要同时满足约束
func Map2MetadataFields ¶
func Map2MetadataFields(m map[string]string) []metadata.MetadataField
func MetadataFields2Map ¶
func MetadataFields2Map(metas []metadata.MetadataField) map[string]string
func RenderPlaceholders ¶
func RenderPlaceholders(input string, placeholders []metadata.MetadataField) (string, error)
func ResourceDir ¶
Types ¶
type Config ¶
type Config struct { ImageResource ImageResource `json:"image_resource,omitempty" mapstructure:"image_resource"` Inputs []TaskInputConfig `json:"inputs,omitempty"` Outputs []TaskOutputConfig `json:"outputs,omitempty"` Envs map[string]string `json:"envs,omitempty"` Run Run `json:"run"` }
type CustomTask ¶
type CustomTask struct { Task string `json:"task"` Config Config `json:"config"` Filters Filters `json:"filters,omitempty"` Disable *bool `json:"disable,omitempty"` Timeout interface{} `json:"timeout,omitempty"` Pause *bool `json:"pause,omitempty"` GlobalEnvs map[string]string `json:"-"` Branch string `json:"-"` TaskConfig TaskConfig `json:"-"` Status string `json:"-"` }
func (*CustomTask) GetCustomTaskRunPathArgs ¶
func (t *CustomTask) GetCustomTaskRunPathArgs() []string
func (*CustomTask) GetEnvs ¶
func (t *CustomTask) GetEnvs() map[string]string
func (*CustomTask) GetResource ¶
func (t *CustomTask) GetResource() *Resource
func (*CustomTask) GetResourceType ¶
func (t *CustomTask) GetResourceType() string
func (*CustomTask) GetStatus ¶
func (t *CustomTask) GetStatus() string
func (*CustomTask) GetTaskConfig ¶
func (t *CustomTask) GetTaskConfig() TaskConfig
func (*CustomTask) GetTaskParams ¶
func (t *CustomTask) GetTaskParams() Params
func (*CustomTask) GetTimeout ¶
func (t *CustomTask) GetTimeout() (time.Duration, error)
func (*CustomTask) GetVersion ¶
func (t *CustomTask) GetVersion() Version
func (*CustomTask) IsDisable ¶
func (t *CustomTask) IsDisable() bool
func (*CustomTask) IsPause ¶
func (t *CustomTask) IsPause() bool
func (*CustomTask) IsResourceTask ¶
func (t *CustomTask) IsResourceTask() bool
func (*CustomTask) Name ¶
func (t *CustomTask) Name() string
func (*CustomTask) OutputToContext ¶
func (t *CustomTask) OutputToContext() []string
func (*CustomTask) RequiredContext ¶
func (t *CustomTask) RequiredContext(y PipelineYml) []string
func (*CustomTask) Resources ¶
func (t *CustomTask) Resources() []string
func (*CustomTask) SetStatus ¶
func (t *CustomTask) SetStatus(status string)
func (*CustomTask) Type ¶
func (t *CustomTask) Type() steptasktype.StepTaskType
func (*CustomTask) Validate ¶
func (t *CustomTask) Validate() error
type GetRequest ¶
type GetTask ¶
type GetTask struct { Get string `json:"get"` // contains filtered or unexported fields }
func (*GetTask) GetCustomTaskRunPathArgs ¶
func (*GetTask) GetResource ¶
func (*GetTask) GetResourceType ¶
func (*GetTask) GetTaskConfig ¶
func (get *GetTask) GetTaskConfig() TaskConfig
func (*GetTask) GetTaskParams ¶
func (*GetTask) GetVersion ¶
func (*GetTask) IsResourceTask ¶
func (*GetTask) OutputToContext ¶
func (*GetTask) RequiredContext ¶
func (get *GetTask) RequiredContext(y PipelineYml) []string
TODO more intelligent check
func (*GetTask) Type ¶
func (get *GetTask) Type() steptasktype.StepTaskType
type ImageResource ¶
type OpOption ¶
type OpOption func(*Option)
func WithAgentContainerPath ¶
func WithAgentHostPath ¶
func WithAlreadyTransformed ¶
func WithBranch ¶
func WithClusterName ¶
func WithContainerResLimit ¶
func WithNFSRealPath ¶
func WithPlaceholders ¶
func WithPlaceholders(placeholders []metadata.MetadataField) OpOption
func WithRenderPlaceholder ¶
type Pipeline ¶
type Pipeline struct { Version string `json:"version"` Stages []*Stage `json:"stages,omitempty"` Envs map[string]string `json:"envs,omitempty"` Resources []Resource `json:"resources,omitempty"` ResourceTypes []ResourceType `json:"resource_types,omitempty"` Triggers []Trigger `json:"triggers,omitempty"` }
type PipelineMetadata ¶
type PipelineMetadata struct { ContextDir string // context dir related with instanceID, under nfs mount point or oss path dir PlaceHolderEnvs map[string]string // contains filtered or unexported fields }
PipelineMetadata contains extra info needs by parse process.
type PipelineYml ¶
type PipelineYml struct {
// contains filtered or unexported fields
}
func New ¶
func New(b []byte) *PipelineYml
func (*PipelineYml) FindDockerImageByResourceName ¶
func (y *PipelineYml) FindDockerImageByResourceName(name string) (repository, tag string, err error)
func (*PipelineYml) FindResourceByName ¶
func (y *PipelineYml) FindResourceByName(name string) (Resource, bool)
func (*PipelineYml) GetBpRepoArgs ¶
func (y *PipelineYml) GetBpRepoArgs(sourceId int) map[string]string
func (*PipelineYml) GetGlobalEnvs ¶
func (y *PipelineYml) GetGlobalEnvs() map[string]string
func (*PipelineYml) GetInstanceID ¶
func (y *PipelineYml) GetInstanceID() string
func (*PipelineYml) GetMetadata ¶
func (y *PipelineYml) GetMetadata() PipelineMetadata
func (*PipelineYml) GetOptions ¶
func (y *PipelineYml) GetOptions() *Option
func (*PipelineYml) GetPlaceHolderTransformedEnvs ¶
func (y *PipelineYml) GetPlaceHolderTransformedEnvs() map[string]string
func (*PipelineYml) GetPlaceholders ¶
func (y *PipelineYml) GetPlaceholders() []metadata.MetadataField
func (*PipelineYml) GetResourceID ¶
func (y *PipelineYml) GetResourceID(taskName string) int
func (*PipelineYml) GetTaskDisableStatus ¶
func (y *PipelineYml) GetTaskDisableStatus(taskUUID string) (bool, error)
func (*PipelineYml) GetTaskEnvs ¶
func (y *PipelineYml) GetTaskEnvs(taskUUID string) (map[string]string, error)
func (*PipelineYml) GetTaskForceBuildpackStatus ¶
func (y *PipelineYml) GetTaskForceBuildpackStatus(taskUUID string) bool
func (*PipelineYml) GetTaskPauseStatus ¶
func (y *PipelineYml) GetTaskPauseStatus(taskUUID string) (bool, error)
func (*PipelineYml) GetTriggerScheduleCron ¶
func (y *PipelineYml) GetTriggerScheduleCron() (string, bool)
可以有多个 schedule cron 声明,但只能有一个生效
func (*PipelineYml) InsertDiceHub ¶
func (y *PipelineYml) InsertDiceHub() error
func (*PipelineYml) JSON ¶
func (y *PipelineYml) JSON() (string, error)
func (*PipelineYml) JSONPretty ¶
func (y *PipelineYml) JSONPretty() (string, error)
func (*PipelineYml) Object ¶
func (y *PipelineYml) Object() *Pipeline
func (*PipelineYml) Parse ¶
func (y *PipelineYml) Parse(ops ...OpOption) error
Parse parse yaml file, and validate fields content.
func (*PipelineYml) ParseWithAllFields ¶
func (y *PipelineYml) ParseWithAllFields(ops ...OpOption) error
func (*PipelineYml) ReRender ¶
func (y *PipelineYml) ReRender() error
ReRender 用于更改了结构体数据后重新渲染,保证其他字段同步
func (*PipelineYml) SetPipelineID ¶
func (y *PipelineYml) SetPipelineID(pipelineID uint64)
func (*PipelineYml) StringData ¶
func (y *PipelineYml) StringData() string
func (*PipelineYml) UpdatePipelineOnBpArgs ¶
func (y *PipelineYml) UpdatePipelineOnBpArgs(resource string, bp_args, bp_repo_args map[string]string) error
Update bp_args, docker_args.
func (*PipelineYml) UpdatePipelineOnGlobal ¶
func (y *PipelineYml) UpdatePipelineOnGlobal(kvs map[string]string) error
UpdatePipelineOnGlobal update pipeline object and byteData together.
func (*PipelineYml) UpdatePipelineOnTask ¶
func (y *PipelineYml) UpdatePipelineOnTask(expectUUID string, params TaskUpdateParams) error
UpdatePipelineOnTask update pipeline object and byteData together.
func (*PipelineYml) UpdatePipelineWorkspaceOnBpArgs ¶
func (y *PipelineYml) UpdatePipelineWorkspaceOnBpArgs(env string) error
Update workspace into bp_args
func (*PipelineYml) ValidateResTypes ¶
func (y *PipelineYml) ValidateResTypes() error
func (*PipelineYml) Version ¶
func (y *PipelineYml) Version() string
func (*PipelineYml) YAML ¶
func (y *PipelineYml) YAML() (string, error)
type PutTask ¶
type PutTask struct { Put string `json:"put"` GetParams Params `json:"get_params,omitempty" mapstructure:"get_params"` // contains filtered or unexported fields }
func (*PutTask) GetCustomTaskRunPathArgs ¶
func (*PutTask) GetResource ¶
func (*PutTask) GetResourceType ¶
func (*PutTask) GetTaskConfig ¶
func (put *PutTask) GetTaskConfig() TaskConfig
func (*PutTask) GetTaskParams ¶
func (*PutTask) GetVersion ¶
func (*PutTask) IsResourceTask ¶
func (*PutTask) OutputToContext ¶
func (*PutTask) RequiredContext ¶
func (put *PutTask) RequiredContext(y PipelineYml) []string
TODO more intelligent check
func (*PutTask) Type ¶
func (put *PutTask) Type() steptasktype.StepTaskType
type ResourceType ¶
type Stage ¶
type Stage struct { Name string `json:"name,omitempty"` TaskConfigs []TaskConfig `json:"tasks,omitempty"` Tasks []StepTask `json:"-"` }
type StepTask ¶
type StepTask interface { Type() steptasktype.StepTaskType Name() string GetEnvs() map[string]string Validate() error OutputToContext() []string // includes required resources and explicit context RequiredContext(y PipelineYml) []string IsResourceTask() bool // if IsResourceTask, GetResourceType will return resource type name. GetResourceType() string IsDisable() bool IsPause() bool GetStatus() string SetStatus(status string) GetTaskParams() Params GetTaskConfig() TaskConfig GetCustomTaskRunPathArgs() []string GetResource() *Resource GetVersion() Version GetTimeout() (time.Duration, error) }
type TaskConfig ¶
type TaskConfig map[string]interface{}
type TaskInputConfig ¶
type TaskInputConfig struct {
Name string `json:"name" yaml:"name"`
}