Skip to content

新增/更新流水线

OpenAPI Specification

yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/pi/pipeline/save:
    post:
      summary: 新增/更新流水线
      deprecated: false
      description: _authOnly_
      operationId: pipelinecontroller_save
      tags:
        - 用户级别/pipeline
        - pipeline
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PipelineSaveDTO'
      responses:
        '200':
          description: OK
          headers: {}
          x-apifox-name: ''
      security:
        - apikey-header-x-certd-token: []
      x-apifox-folder: 用户级别/pipeline
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/5768667/apis/api-427945322-run
components:
  schemas:
    PipelineSaveDTO:
      type: object
      properties:
        id:
          description: Id,修改时必传
          type: number
        title:
          description: 标题
          type: string
        content:
          description: 流水线详细配置,json格式的字符串
          type: string
          examples:
            - |-

              // 流水线配置示例,实际传送时要去掉注释
              {
                "title": "handsfree.work证书自动化", //标题
                "runnableType": "pipeline", //类型,固定为pipeline
                "projectId": 1, // 项目ID, 未开启企业模式,无需传递
                "type": "cert", // 流水线类型,cert:证书自动化, custom :自定义流水线
                "from": "", // 来源,cert:证书自动化, upload :证书托管
                "stages": [  //流水线阶段,多个阶段串行执行
                  {
                    "id": "edKopnpp2wvOCQ2vkV8Ii" // 阶段ID, 由客户端生成,流水线内部全局唯一即可
                    "title": "证书申请阶段", //阶段标题
                    "runnableType": "stage", // 类型标识
                    "tasks": [ // 任务列表,多个任务并行执行
                      {
                        "id": "Lb8I7Dj10cGh6gqIIkmKv" // 任务ID, 由客户端生成,流水线内部全局唯一即可
                        "title": "证书申请任务", // 任务标题
                        "runnableType": "task", // 类型标识
                        "steps": [ // 步骤列表,同一个任务下的多个步骤串行执行
                          {
                            "id": "zc8X1L2f0N0KgbrqFU3gz" // 步骤ID, 由客户端生成,流水线内部全局唯一即可
                            "type": "CertApply", // 插件类型
                            "title": "申请证书", // 步骤标题
                            "runnableType": "step", // 类型标识
                            "input": { //输入参数 ,根据插件的配置有不同的参数,具体参数建议通过浏览器F12进行查看
                              "renewDays": 15,
                            },
                            "strategy": { // 策略
                              "runStrategy": 0 // 运行策略,0:正常执行,1:成功后跳过
                            },
                          }
                        ],
                      }
                    ],
                  }
                ],
                "triggers": [ // 触发器配置
                  {
                    "id": "pt3865qfIAkULBS5sOQf7", // 触发器ID, 由客户端生成,流水线内部全局唯一即可
                    "title": "定时触发",
                    "type": "timer", // 触发器类型,timer:定时触发
                    "props": {
                      "cron": "0 34 5 * * *" // 定时表达式
                    },
                  }
                ],
                "notifications": [ // 通知配置
                  {
                    "id": "5pb1gZTnDEjdHkR5tDd6g" // 通知ID, 由客户端生成,流水线内部全局唯一即可
                    "title": "使用默认通知",// 通知标题
                    "type": "custom", // 通知类型,固定为custom 
                    "when": [ // 触发条件,error:错误时触发,turnToSuccess:失败转成功后触发,success: 成功时触发
                      "error",
                      "turnToSuccess"
                    ],
                    "notificationId": 0, // 通知ID, 0为使用默认通知
                  }
                ],
              }
        keepHistoryCount:
          description: 保留历史版本数量
          type: number
        groupId:
          description: 分组ID
          type: number
        remark:
          description: 备注
          type: string
        status:
          description: 状态
          type: string
        disabled:
          description: 是否禁用
          type: boolean
        type:
          description: 类型
          type: string
        webhookKey:
          description: Webhook密钥
          type: string
        from:
          description: 来源
          type: string
        order:
          description: 排序
          type: number
        projectId:
          description: 项目ID
          type: number
        validTime:
          description: 流水线有效期,单位秒
          type: number
        addToMonitorEnabled:
          description: 是否增加证书监控
          type: boolean
        addToMonitorDomains:
          description: 增加证书监控的域名,逗号分隔
          type: string
      x-apifox-orders:
        - id
        - title
        - content
        - keepHistoryCount
        - groupId
        - remark
        - status
        - disabled
        - type
        - webhookKey
        - from
        - order
        - projectId
        - validTime
        - addToMonitorEnabled
        - addToMonitorDomains
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
  securitySchemes:
    header-x-certd-token:
      type: apikey
      in: header
      name: x-certd-token
    apikey-header-x-certd-token:
      type: apiKey
      in: header
      name: x-certd-token
servers:
  - url: http://127.0.0.1:7001
    description: 开发环境
  - url: https://certd.handfree.work
    description: 测试环境
  - url: http://your-certd-server.com
    description: 正式环境
  - url: ''
    description: 自定义
security:
  - apikey-header-x-certd-token: []

产品文档中心 · 文档即代码