| GitLab | include(项目/远程/模板)+ extends 合并且可覆盖 |
|---|---|
| GitHub | workflow_call 可复用工作流 + composite action 复合步骤 |
| Jenkins | Shared Library(vars/ 下全局步骤) |
GitHub 可复用工作流
GitHub 可复用工作流
# .github/workflows/build.yml(被复用)
on:
workflow_call:
inputs:
node:
type: string
jobs:
build:
runs-on: ubuntu-latest
steps: [{run: echo "node ${{ inputs.node }}"}]GitLab include
GitLab include
include:
- project: 'platform/ci-templates'
file: '/templates/node.yml'模板仓库同样要版本化:引用固定标签或提交,避免上游改动波及所有项目。