审批确认任务模板

更新时间: 2023-12-01 10:57:59

应用中心内置了审批确认任务模板,用于加入简单的人工卡点逻辑。本文介绍审批确认任务模板的实现原理、描述示例和使用方法。

实现原理

应用中心会在使用该模板的任务执行流水线时,主动将当前任务挂起,从而阻塞后续依赖它的任务执行。等待人工审批确认后,当前任务进入完成状态,不再阻塞后续依赖它的任务执行。

审批确认任务模板描述示例

以下是审批确认任务模板的描述示例。需要声明spec.worker.presetWorkerneed-approval

name: need-approval
kind: TaskTemplate
labels:
  source: system
resourceVersion: 0
spec:
  description: |-
    This task will be on hold until someone with the corresponding authorities resumes it manually.
    任务将被挂起,直到有权限的人手动继续执行。
  worker:
    presetWorker: need-approval
  executeCondition:
    expression: enable == true
            

使用方法

审批确认任务模板可以在流水线模板中使用。使用示例如下。

---
kind: PipelineTemplate
name: demo-template
description: 用于审批确认的流水线模板。
spec:
  tasks:
  - name: block-me
    context:
      data:
        enable: true
    # 采用内置的need-approval模板。
    taskTemplate: need-approval
---
阿里云首页 函数计算(旧版) 相关技术圈