跳转到主要内容

Gerrit到GitHub / GitLab

项目描述

Build Status Coveralls Project generated with PyScaffold

gerrit-to-platform

GerritGitHub / GitLab(尚未提供)

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 (48.5 kB 查看散列

上传时间

构建分发

gerrit_to_platform-0.2.2-py3-none-any.whl (22.4 kB 查看散列

上传时间 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面