Gerrit到GitHub / GitLab
项目描述
gerrit-to-platform
Gerrit钩子,允许使用GitHub和GitLab作为CI平台。
要使用,安装Gerrit 钩子 插件,然后从安装了该软件包的虚拟环境创建钩子的符号链接。
Python 3.8或更高版本的环境
使用CI平台的存储库必须配置了完整的镜像复制。具体来说,refs/* 必须在复制集中,而不是 refs/heads/*
要激活特定的钩子,在gerrit钩子目录中创建已安装钩子的符号链接。
需要两个配置文件。这些文件是
~gerrituser/.config/gerrit_to_platform/gerrit_to_platform.ini
~gerrituser/.config/gerrit_to_platform/replication.config
replication.config 文件应是一个指向标准 Gerrit replication.config 文件的符号链接
gerrit_to_platform.ini 文件的格式如下
[mapping "content-added"] recheck = verify remerge = merge [github.com] token = <a_token_that_allows_triggering_actions> [gitlab.com] token = <a_token_that_allows_triggering_workflows>
content-added 映射部分是针对评论触发器到相应的流程名称或文件名的键值对
GitHub 工作流程配置
gerrit-to-platform 处理以下三个钩子
patchset-created(搜索过滤器:verify)
change-merged(搜索过滤器:merge)
comment-added(关键字到搜索过滤器的评论映射)
触发的工作流的配置必须满足以下要求
工作流程文件名必须包含‘gerrit’
工作流程文件名必须包含搜索过滤器
必需的工作流必须是 ORGANIZATION/.github 魔法仓库的一部分。这些工作流文件名还必须包含‘required’
例如:.github/workflows/gerrit-verify.yaml 或 .github/workflows/gerrit-required-verify.yaml
标准工作流(非必需的)必须有以下主要配置
--- name: Gerrit Verify # yamllint disable-line rule:truthy on: workflow_dispatch: inputs: GERRIT_BRANCH: description: 'Branch that change is against' required: true type: string GERRIT_CHANGE_ID: description: 'The ID for the change' required: true type: string GERRIT_CHANGE_NUMBER: description: 'The Gerrit number' required: true type: string GERRIT_CHANGE_URL: description: 'URL to the change' required: true type: string GERRIT_EVENT_TYPE: description: 'Gerrit event type' required: true type: string GERRIT_PATCHSET_NUMBER: description: 'The patch number for the change' required: true type: string GERRIT_PATCHSET_REVISION: description: 'The revision sha' required: true type: string GERRIT_PROJECT: description: 'Project in Gerrit' required: true type: string GERRIT_REFSPEC: description: 'Gerrit refspec of change' required: true type: string concurrency: group: ${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }} cancel-in-progress: true jobs: <your_job_configurations>
必需的工作流必须有以下额外输入
TARGET_REPO: description: 'The target GitHub repository needing the required workflow' required: true type: string
修改内容 & 贡献
该项目使用 pre-commit,请在进行任何更改之前确保安装它
pip install pre-commit cd gerrit_to_platform pre-commit install pre-commit install -t commit-msg
别忘了告诉您的贡献者也安装并使用 pre-commit。
注意
PyScaffold 4.4 提供了初始项目设置。有关 PyScaffold 的详细信息和使用信息,请参阅 https://pyscaffold.org/。
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。
源分发
构建分发
gerrit_to_platform-0.2.2.tar.gz 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 16cb2de219ec83e2e2a7de93d063fae6200c01a23589574e518dcc51cf8c161c |
|
MD5 | edd873f11d137f24e78804da5f3b7e2b |
|
BLAKE2b-256 | acb2964bbce36f15167f7410eb4f19fe5e4ad1b810aa41988e629f94175bb305 |
gerrit_to_platform-0.2.2-py3-none-any.whl 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 900b8d3524c93d4f978cecf6c42d228f87695cdb6656b627fe9d79b9a7341c93 |
|
MD5 | 8969853a0ab76ba4bf743fc8fc499875 |
|
BLAKE2b-256 | 0c7bd9392bf86537680c90f28293b3998b6bbe567b40d20bf650f181bfca7d53 |