common

package
v0.14.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 如果有增加新的系统变量,记得需要同步更新 SysParamNameList
	SysParamNamePFRunID        = "PF_RUN_ID"
	SysParamNamePFStepName     = "PF_STEP_NAME"
	SysParamNamePFUserName     = "PF_USER_NAME"
	SysParamNamePFLoopArgument = "PF_LOOP_ARGUMENT"

	PF_PARENT        = "PF_PARENT"
	PF_LOOP_ARGUMENT = "PF_LOOP_ARGUMENT"

	WfExtraInfoKeySource     = "Source" // pipelineID or yamlPath
	WfExtraInfoKeyFSUserName = "FsUserName"
	WfExtraInfoKeyFsName     = "FsName"
	WfExtraInfoKeyFsID       = "FsID"

	ParamTypeString = "string"
	ParamTypeFloat  = "float"
	ParamTypePath   = "path"
	ParamTypeInt    = "int"
	ParamTypeList   = "list"

	WfParallelismDefault = 10
	WfParallelismMaximum = 20

	FieldParameters      = "parameters"
	FieldCommand         = "command"
	FieldEnv             = "env"
	FieldInputArtifacts  = "inputArtifacts"
	FieldOutputArtifacts = "outputArtifacts"
	FieldCondition       = "condition"
	FieldLoopArguemt     = "loop_argument"

	CacheStrategyConservative = "conservative"
	CacheStrategyAggressive   = "aggressive"
	CacheExpiredTimeNever     = "-1"

	NodeTypeEntrypoint  NodeType = "entrypoints"
	NodeTypePostProcess NodeType = "postProcess"

	ViewTypeEntrypoint  ViewType = "entrypoints"
	ViewTypePostProcess ViewType = "postProcess"

	RegExpUpstreamTpl          = `^\{\{(\s)*[a-zA-Z0-9-_]+\.[a-zA-Z0-9_]+(\s)*\}\}$`  // {{xx-xx.xx_xx}}
	RegExpCurTpl               = `^\{\{(\s)*([a-zA-Z0-9_]+)(\s)*\}\}$`                // {{xx_xx}}
	RegExpIncludingUpstreamTpl = `\{\{(\s)*([a-zA-Z0-9-_]+\.[a-zA-Z0-9_]+)(\s)*\}\}`  // 包含 {{xx-xx.xx_xx}}
	RegExpIncludingTpl         = `\{\{(\s)*([a-zA-Z0-9-_]*\.?[a-zA-Z0-9_]+)(\s)*\}\}` // 包含 {{xx-xx.xx_xx}} 或 {xx_xx}
	RegExpIncludingCurTpl      = `\{\{(\s)*([a-zA-Z0-9_]+)(\s)*\}\}`                  // 包含 {{xx_xx}}

	// condition 字段中引用的 artifact 支持最大空间, 单位为 byte
	ConditionArtifactMaxSize = 1024 // 1KB

	// loop_argument 字段中引用的 artifact 支持最大空间, 单位为 byte
	LoopArgumentArtifactMaxSize = 1024 * 1024 // 1MB

	// dagID 中随机码的位数
	DagIDRandCodeNum = 16

	// artifact 挂载路径的父目录
	ArtMountDir = "/tmp"
)

Variables

Functions

func CheckDictParam added in v0.14.3

func CheckDictParam(dict DictParam, paramName string, realVal interface{}) (interface{}, error)

func CheckListParam added in v0.14.4

func CheckListParam(param []interface{}) error

func DeleteSystemParamEnv

func DeleteSystemParamEnv(sysParamEnv map[string]string) map[string]string

删除系统变量

func GetArtifactContent added in v0.14.3

func GetArtifactContent(artPath string, maxSize int, fsID string, logger *logrus.Entry) (string, error)

获取制定Artifact的内容

func GetArtifactMountPath added in v0.14.3

func GetArtifactMountPath(mainFS *schema.FsMount, artifactPath string) string

func GetFSMountPath added in v0.14.3

func GetFSMountPath(FS *schema.FsMount) string

func GetInputArtifactEnvName added in v0.14.3

func GetInputArtifactEnvName(atfName string) string

func GetOutputArtifactEnvName added in v0.14.3

func GetOutputArtifactEnvName(atfName string) string

func GetRandID added in v0.14.3

func GetRandID(randNum int) string

func GetSiblingAbsoluteName added in v0.14.3

func GetSiblingAbsoluteName(curAbsName string, siblingRelativeName string) string

func InvalidParamTypeError added in v0.14.3

func InvalidParamTypeError(param interface{}, expected string) error

func LatestTime added in v0.14.3

func LatestTime(times []time.Time) time.Time

func MismatchRegexError added in v0.14.3

func MismatchRegexError(param, regex string) error

func ParseParamName added in v0.14.3

func ParseParamName(paramName string) []string

func StringsContain added in v0.14.3

func StringsContain(items []string, item string) bool

func TopologicalSort added in v0.14.3

func TopologicalSort(components map[string]schema.Component) ([]string, error)

func UnsupportedDictParamTypeError added in v0.14.3

func UnsupportedDictParamTypeError(unsupportedType string, paramName string, param interface{}) error

func UnsupportedParamTypeError added in v0.14.3

func UnsupportedParamTypeError(param interface{}, paramName string) error

func UnsupportedPathParamError added in v0.14.3

func UnsupportedPathParamError(param interface{}, paramName string) error

Types

type ComponentParamChecker added in v0.14.3

type ComponentParamChecker struct {
	Components    map[string]schema.Component // 需要传入相关的所有 step,以判断依赖是否合法
	SysParams     map[string]string           // sysParams 的值和 step 相关,需要传入
	DisabledSteps []string                    // 被disabled的节点列表
	UseFs         bool                        // 表示是否挂载Fs
	CompTempletes map[string]schema.Component // 对应WorkflowSource中的Components的内容
}

1.4.3后,Checker承担了Parameters的处理任务,如dict形式的param替换为实际值、请求的参数替换节点参数

func (*ComponentParamChecker) Check added in v0.14.3

func (s *ComponentParamChecker) Check(currentComponent string, isComp bool) error

type DictParam added in v0.14.3

type DictParam struct {
	Type    string
	Default interface{}
}

func (*DictParam) From added in v0.14.3

func (p *DictParam) From(origin interface{}) error

type NodeType

type NodeType string

type ResourceHandler added in v0.14.3

type ResourceHandler struct {
	// contains filtered or unexported fields
}

* resourceHandler

func NewResourceHandler added in v0.14.3

func NewResourceHandler(runID string, fsID string, logger *log.Entry) (ResourceHandler, error)

func (*ResourceHandler) ClearResource added in v0.14.3

func (resourceHandler *ResourceHandler) ClearResource() error

func (*ResourceHandler) GenerateOutAtfPath added in v0.14.3

func (resourceHandler *ResourceHandler) GenerateOutAtfPath(pplName, rootPath, stepName, runtimeName string,
	seq int, outatfName string, toInit bool) (string, error)

type VariableChecker

type VariableChecker struct {
}

func (*VariableChecker) CheckCompName added in v0.14.3

func (VariableChecker *VariableChecker) CheckCompName(compName string) error

func (*VariableChecker) CheckRefArgument added in v0.14.4

func (variableChecker *VariableChecker) CheckRefArgument(varValue string) error

检查是否使用了模板,如 {{xxx}} 或 {{xxx.xxx}}

func (*VariableChecker) CheckRefUpstreamStep

func (variableChecker *VariableChecker) CheckRefUpstreamStep(varValue string) error

func (*VariableChecker) CheckRunAndPPLName added in v0.14.5

func (variableChecker *VariableChecker) CheckRunAndPPLName(varName string) error

func (*VariableChecker) CheckVarName

func (variableChecker *VariableChecker) CheckVarName(varName string) error

type ViewType

type ViewType string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL