mirror of
https://github.com/usual2970/certimate.git
synced 2025-07-28 09:28:33 +00:00
refactor: clean code
This commit is contained in:
@@ -31,7 +31,7 @@ func NewApplyNode(node *domain.WorkflowNode) *applyNode {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *applyNode) Run(ctx context.Context) error {
|
||||
func (n *applyNode) Process(ctx context.Context) error {
|
||||
n.AddOutput(ctx, n.node.Name, "开始执行")
|
||||
|
||||
// 查询上次执行结果
|
||||
|
@@ -18,7 +18,7 @@ func NewConditionNode(node *domain.WorkflowNode) *conditionNode {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *conditionNode) Run(ctx context.Context) error {
|
||||
func (n *conditionNode) Process(ctx context.Context) error {
|
||||
// 此类型节点不需要执行任何操作,直接返回
|
||||
n.AddOutput(ctx, n.node.Name, "完成")
|
||||
|
||||
|
@@ -29,7 +29,7 @@ func NewDeployNode(node *domain.WorkflowNode) *deployNode {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *deployNode) Run(ctx context.Context) error {
|
||||
func (n *deployNode) Process(ctx context.Context) error {
|
||||
n.AddOutput(ctx, n.node.Name, "开始执行")
|
||||
|
||||
// 查询上次执行结果
|
||||
|
@@ -18,7 +18,7 @@ func NewExecuteFailureNode(node *domain.WorkflowNode) *executeFailureNode {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *executeFailureNode) Run(ctx context.Context) error {
|
||||
func (n *executeFailureNode) Process(ctx context.Context) error {
|
||||
// 此类型节点不需要执行任何操作,直接返回
|
||||
n.AddOutput(ctx, n.node.Name, "进入执行失败分支")
|
||||
|
||||
|
@@ -18,7 +18,7 @@ func NewExecuteSuccessNode(node *domain.WorkflowNode) *executeSuccessNode {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *executeSuccessNode) Run(ctx context.Context) error {
|
||||
func (n *executeSuccessNode) Process(ctx context.Context) error {
|
||||
// 此类型节点不需要执行任何操作,直接返回
|
||||
n.AddOutput(ctx, n.node.Name, "进入执行成功分支")
|
||||
|
||||
|
@@ -24,7 +24,7 @@ func NewNotifyNode(node *domain.WorkflowNode) *notifyNode {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *notifyNode) Run(ctx context.Context) error {
|
||||
func (n *notifyNode) Process(ctx context.Context) error {
|
||||
n.AddOutput(ctx, n.node.Name, "开始执行")
|
||||
|
||||
nodeConfig := n.node.GetConfigForNotify()
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type NodeProcessor interface {
|
||||
Run(ctx context.Context) error
|
||||
Process(ctx context.Context) error
|
||||
GetLog(ctx context.Context) *domain.WorkflowRunLog
|
||||
AddOutput(ctx context.Context, title, content string, err ...string)
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ func NewStartNode(node *domain.WorkflowNode) *startNode {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *startNode) Run(ctx context.Context) error {
|
||||
func (n *startNode) Process(ctx context.Context) error {
|
||||
// 此类型节点不需要执行任何操作,直接返回
|
||||
n.AddOutput(ctx, n.node.Name, "完成")
|
||||
|
||||
|
@@ -29,9 +29,7 @@ func NewUploadNode(node *domain.WorkflowNode) *uploadNode {
|
||||
}
|
||||
}
|
||||
|
||||
// Run 上传证书节点执行
|
||||
// 包含上传证书的工作流,理论上应该手动执行,如果每天定时执行,也只是重新保存一下
|
||||
func (n *uploadNode) Run(ctx context.Context) error {
|
||||
func (n *uploadNode) Process(ctx context.Context) error {
|
||||
n.AddOutput(ctx, n.node.Name, "进入上传证书节点")
|
||||
|
||||
nodeConfig := n.node.GetConfigForUpload()
|
||||
|
Reference in New Issue
Block a user