diff --git a/.vitepress/config.js b/.vitepress/config.js index d83f0e0c68bb0363cea713667b2cf37de695f776..048eef6a630d36e2c85f7592c79de7e5e56e1c97 100644 --- a/.vitepress/config.js +++ b/.vitepress/config.js @@ -1,89 +1,95 @@ module.exports = { - title: '持续集成平台', - description: 'jianmu持续集成平台文档', - lang: 'zh-CN', - head: [ - // 改变title的图标 - [ - 'link', - { - rel: 'icon', - href: '/favicon.ico', - }, + title: '持续集成平台', + description: 'jianmu持续集成平台文档', + lang: 'zh-CN', + head: [ + // 改变title的图标 + [ + 'link', + { + rel: 'icon', + href: '/favicon.ico', + }, + ], ], - ], - // 主题配置 - themeConfig: { - // 侧边导航 - sidebar: [{ - text: '首页', - link: '/guide/index', - }, { - text: '如何安装', - children: [{ - text: 'Docker环境安装', - link: '/guide/installation-docker', - }, { - text: 'Linux环境安装', - link: '/guide/installation-linux' - },] - }, { - text: '如何使用', - children: [{ - text: '快速开始', - link: '/guide/quick-start', - }, { - text: '触发器', - children: [{ - text: '事件桥接器', - link: '/guide/event-bridge' + // 主题配置 + themeConfig: { + // 侧边导航 + sidebar: [{ + text: '首页', + link: '/guide/index', }, { - text: 'Cron', - link: '/guide/cron', - }], - // }, { - // text: 'Webhooks', - // link: '/guide/webhooks' - }, { - text: '流程编排', - children: [{ - text: '流程定义', - link: '/guide/flow-dsl' + text: '如何安装', + children: [{ + text: 'Docker环境安装', + link: '/guide/installation-docker', + }, { + text: 'Linux环境安装', + link: '/guide/installation-linux' + },] }, { - text: '管道定义', - link: '/guide/pipeline-dsl' - }], - }, { - text: '节点定义', - link: '/guide/node-dsl' - }, { - text: '密钥管理', - link: '/guide/secrets' - }], - }, { - text: '高级主题', - children: [{ - text: '变量', - link: '/guide/vars', - }, { - text: "表达式", - link: "/guide/expression" - }, - // { - // text: '网关', - // link: '/guide/gateway' - // }, { - // text: '运维', - // link: '/guide/operation' - // }, - { - text: '自定义节点', - link: '/guide/custom-node' + text: '如何使用', + children: [{ + text: '快速开始', + link: '/guide/quick-start', + }, { + text: '触发器', + children: [{ + text: '事件桥接器', + link: '/guide/event-bridge' + }, { + text: 'Cron', + link: '/guide/cron', + }], + // }, { + // text: 'Webhooks', + // link: '/guide/webhooks' + }, { + text: '流程编排', + children: [{ + text: '流程定义', + link: '/guide/flow-dsl' + }, { + text: '管道定义', + link: '/guide/pipeline-dsl' + }], + }, { + text: '节点定义', + link: '/guide/node-dsl' + }, { + text: '密钥管理', + link: '/guide/secrets' + }], }, { - text: '第三方库', - link: '/guide/license-mixing' - } - ], - }], - } + text: '高级主题', + children: [{ + text: '参数', + link: '/guide/vars', + }, { + text: "表达式", + link: "/guide/expression" + }, { + text: '内置节点', + children: [{ + text: "开始/结束节点", + link: "/guide/start-end-node" + }, { + text: "网关节点", + link: "/guide/gateway" + }] + }, + // { + // text: '运维', + // link: '/guide/operation' + // }, + { + text: '自定义节点', + link: '/guide/custom-node' + }, { + text: '第三方库', + link: '/guide/license-mixing' + } + ], + }], + } } \ No newline at end of file diff --git a/guide/flow-dsl.md b/guide/flow-dsl.md index 5e62b1e9540520b68f119955065d380dda04b2c6..8d3022154058851e32c07bc3e2a30b89b21749cf 100644 --- a/guide/flow-dsl.md +++ b/guide/flow-dsl.md @@ -2,7 +2,7 @@ CI/CD流程使用Yaml来定义 -### Workflow +### workflow 流程定义在workflow段落下: @@ -63,7 +63,7 @@ workflow: `start`与`end`可以分别省略`sources`和`targets`定义,一个节点可以定义多个上游或下游节点 -当存在多个下游节点时,当前节点执行成功后会并行触发下游节点 +当存在多个下游节点时,当前节点执行成功后会并发触发下游节点 当存在多个上游节点时,当前节点会等待上游节点全部执行成功后才开始执行 diff --git a/guide/gateway.md b/guide/gateway.md index c5ee36fd9825887904157100dc857c35de20ef8f..80c8cc4f2ced6f77f85fc5ab267f2f7369206e1e 100644 --- a/guide/gateway.md +++ b/guide/gateway.md @@ -1 +1,53 @@ -# 网关节点 \ No newline at end of file +# 网关节点 +### 并发网关 + +**概念** + +在[流程定义](./flow-dsl.md)中,一个节点有多个上游/下游节点 +![concurrent_node.png](./images/concurrent_node.png) + +当存在多个下游节点时,当前节点执行成功后会并发触发下游节点 + +当存在多个上游节点时,当前节点会等待上游节点全部执行成功后才开始执行 + +**语法** + +通过`sources`定义多个上游节点 +``` +end: + sources: + - feishu_notice_post1 + - feishu_notice_post2 + type: end +``` +通过`targets`定义多个下游节点 +``` +start: + targets: + - git_clone1 + - git_clone2 + type: start +``` + +### 条件网关 + +**概念** + +在[流程定义](./flow-dsl.md)中,使用`condition`节点,定义表达式`expression`,具体参考[表达式](./expression.md)一览 + +通过条件`cases`判断true / false,执行对应的节点 + +![condition_node.png](./images/condition_node.png) + +**语法** +``` +condition: + sources: + - start + type: condition + expression: ${event.number}>100 + cases: + true: feishu_notice_post1 + false: feishu_notice_post2 +``` +其中,`${event.number}`为事件参数,也可以为`常量`或其他[参数](./vars.md) diff --git a/guide/images/concurrent_node.png b/guide/images/concurrent_node.png new file mode 100644 index 0000000000000000000000000000000000000000..a3df7ff5fd3e60c20a1f2eaca1a70688785286b1 Binary files /dev/null and b/guide/images/concurrent_node.png differ diff --git a/guide/images/condition_node.png b/guide/images/condition_node.png new file mode 100644 index 0000000000000000000000000000000000000000..e0692672d9e034a60432befe7dd04c691d4dcc09 Binary files /dev/null and b/guide/images/condition_node.png differ diff --git a/guide/start-end-node.md b/guide/start-end-node.md new file mode 100644 index 0000000000000000000000000000000000000000..6025edb6e0112188e5cbf4b7dba2a5524df55844 --- /dev/null +++ b/guide/start-end-node.md @@ -0,0 +1,26 @@ +# 开始/结束节点 +### 开始节点 +**概念** + +[流程定义](./flow-dsl.md)中的开始节点,无上游节点 + +**语法** +``` +start: + targets: + - git_clone + type: start +``` + +### 结束节点 +**概念** + +[流程定义](./flow-dsl.md)中的结束节点,无下游节点 + +**语法** +``` +end: + sources: + - feishu_notice_post + type: end +``` \ No newline at end of file diff --git a/guide/vars.md b/guide/vars.md index 32cc735e5d2ae16f53708789a8abefaba4b4ba7e..e9eaf45307d998396d35989640356e2779f806d3 100644 --- a/guide/vars.md +++ b/guide/vars.md @@ -1,8 +1,8 @@ -# 变量 +# 参数 -### 全局变量 +### 全局参数 -可以在流程定义的`param`段落中定义全局变量,语法如下: +可以在流程定义的`param`段落中定义全局参数,语法如下: ``` param: image_name: jianmudev/private