简体   繁体   English

GitHub Actions 和 Jenkins 等其他 CI 工具有什么区别?

[英]What are the differences between GitHub Actions and other CI tools like Jenkins?

GitHub announced an upcoming feature, GitHub Actions . GitHub 宣布了一项即将推出的功能,即GitHub Actions

I'm positive on the benefits of CI tools like Jenkins for automatic building or testing, which GitHub Actions is aimed to be used for in the future.我对 Jenkins 等 CI 工具在自动构建或测试方面的优势持积极态度,GitHub Actions 旨在在未来使用这些工具。

Having a repository on GitHub and using an external CI tool has the huge benefit of allowing to move the repository to another Git repository platform (or even local) without rewriting of the whole CI process.在 GitHub 上拥有一个存储库并使用外部 CI 工具具有巨大的好处,即允许将存储库移动到另一个 Git 存储库平台(甚至本地)而无需重写整个 CI 过程。 With GitHub Actions, you're more or less tied to the GitHub ecosystem.使用 GitHub Actions,您或多或少会与 GitHub 生态系统联系在一起。

I assume the integration of GitHub's Actions will be more fluent in the native environment, but are there any other advantages or disadvantages besides that?我认为 GitHub 的 Actions 的集成在原生环境中会更加流畅,但除此之外还有其他优点或缺点吗?

I've been working with GitHub actions full time for a couple of months now.几个月以来,我一直在全职使用 GitHub 操作。

It's still early days (June 2019), but here's my list:现在还为时尚早(2019 年 6 月),但这是我的清单:

Advantages:好处:

  1. GitHub actions are just consecutive docker runs. GitHub 操作只是连续的 docker 运行。 Very easy to reason about and debug.很容易推理和调试。 Reproducing the build environment for container-based Travis is possible , but more difficult.基于容器的 Travis重现构建环境是可能的,但更困难。 On GitHub actions it's just a docker build docker run away.在 GitHub 上,它只是一个docker build docker run away。
  2. The individual actions in a workflow are isolated by default.默认情况下,工作流中的各个操作是隔离的。 You can use a completely different computing environment for, say, compilation and testing.您可以使用完全不同的计算环境进行编译和测试。 Travis CI (and I think other "traditional" CI) would run all "stages" (~ actions) in the same computing environment. Travis CI(我认为其他“传统”CI)会在同一计算环境中运行所有“阶段”(~动作)。 Again, GitHub actions are much easier to reason about and debug.同样,GitHub 操作更容易推理和调试。
  3. The main.workflow spec (a subset of the HCL and really just a directed acyclic graph) is open source . main.workflow规范(HCL 的一个子集,实际上只是一个有向无环图)是开源的 The whole thing is a pretty thin wrapper around Docker anyway, so platform lock-in is arguably minimal.无论如何,整个事情都是围绕 Docker 的一个非常薄的包装器,因此平台锁定可以说是最小的。
  4. There are already open-source reimplementations of GitHub actions, such as act for local testing.已经有GitHub的动作,如开放源代码重新实现的行为进行本地测试。
  5. You have ready access to the GitHub API with (somewhat limited) authentication out of the box.您可以通过开箱即用的(有些有限的)身份验证访问 GitHub API。
  6. There might be a vibrant community (marketplace?) where people can share actions.可能会有一个充满活力的社区(市场?),人们可以在其中分享行动。 For example, I'm reusing deploy actions build by different people in different ecosystems.例如,我正在重用由不同生态系统中的不同人员构建的部署操作。
  7. A directed acyclic graph (DAG) and the visual editor for main.workflow s is perhaps a good way to model CI/CD in particular and workflows in general.有向无环图 (DAG) 和main.workflow的可视化编辑器可能是对 CI/CD 和一般工作流进行建模的好方法。 Takes some getting used to, but generalises well.需要一些时间来适应,但概括性很好。
  8. GitHub actions can do a whole lot more than just CI! GitHub 操作可以做的不仅仅是 CI! You've got basically the whole API at your fingertips as inputs and outputs.基本上,整个 API 作为输入和输出都唾手可得。

Disadvantages:缺点:

GitHub actions (still?) has sometimes surprisingly foundational limitations at this point (june 2019). GitHub 操作(仍然?)在这一点上(2019 年 6 月)有时具有令人惊讶的基本限制。

  1. No native caching.没有本机缓存。 You get image and layer caching (it's complicated ), but nothing else.您可以获得图像图层缓存(它很复杂),但没有别的。 For build artefacts, you have to roll your own cache (via AWS, Azure, etc. ...), which can be a lot of work.对于构建工件,您必须滚动自己的缓存(通过 AWS、Azure 等...),这可能需要大量工作。 (You can see a hacky setup here . (你可以在这里看到一个hacky 设置
  2. Surprisingly, no support for pull requests from forks .令人惊讶的是,不支持来自 fork 的拉取请求 It's again a bit complicated , and understandable from a security standpoint, but it's currently not possible to run actions a) against the secrets of the receiving repo of a fork PR (base), and/or b) against the would-be merge result of a fork PR (that's what travis does).这又有点复杂,从安全角度可以理解,但目前无法针对分叉 PR(基础)的接收回购的秘密运行操作,和/或 b)针对可能的合并结果一个 fork PR(这就是 travis 所做的)。 For a workflow that involves forks, that makes GitHub actions largely unuseable as CI/CD tool.对于涉及分叉的工作流,这使得 GitHub 操作在很大程度上无法用作 CI/CD 工具。
  3. Single platform, it's just whatever you can run inside docker, so some Linux distro.单一平台,它只是你可以在 docker 中运行的任何东西,所以一些 Linux 发行版。 That seems unlikely to change, but might be an acceptable limitation.这似乎不太可能改变,但可能是一个可以接受的限制。 You can always add an action to call other cross-platfrom CI/CD services.您始终可以添加一个操作来调用其他跨平台 CI/CD 服务。
  4. The documentation is still pretty sparse.文档仍然非常稀少。 Not much in the way of best practices or scaffolding.最佳实践或脚手架的方式并不多。
  5. The quality and breadth of published GitHub actions (at least on the marketplace) is still pretty low / limited.已发布的 GitHub 操作(至少在市场上)的质量和广度仍然很低/有限。 We'll see whether that takes off.我们会看看它是否会起飞。
  6. No great way to unit-test actions.没有很好的方法来单元测试操作。 (Ihacked something together, but I'm not too sure about it). (我一起破解了一些东西,但我不太确定)。

Having a repository on GitHub and using an external CI tool has the huge benefit of allowing to move the repository to another Git repository platform (or even local) without rewriting of the whole CI process.在 GitHub 上拥有一个存储库并使用外部 CI 工具具有巨大的好处,即允许将存储库移动到另一个 Git 存储库平台(甚至本地)而无需重写整个 CI 过程。
With GitHub Actions, you're more or less tied to the GitHub ecosystem.使用 GitHub Actions,您或多或少会与 GitHub 生态系统联系在一起。

Yes, and starting November 2019, slightly less so:是的,从 2019 年 11 月开始,略有下降:

See Joe Bourne 's annoucement " Self-hosted runners for GitHub Actions is now in beta ".请参阅Joe Bourne的公告“ GitHub Actions 的自托管运行器现已处于测试阶段”。

You can have self-hosted runners, which means:您可以拥有自托管的运行器,这意味着:

  • Your environment, your tools ,你的环境,你的工具
  • Any size machine or configuration ,任何尺寸的机器或配置
  • Secure access and networking ,安全访问和网络
  • Large workload support .大工作量支持

To support using self-hosted runners in your workflows, we've expanded the experience of using the runs-on key.为了支持在您的工作流程中使用自托管runs-on ,我们扩展了使用runs-on键的体验。
When registering your self-hosted runners, they're each given a read-only label self-hosted which you can use with runs-on .在注册您的自托管运行器时,它们每个都会获得一个只读标签 self-hosted,您可以将其与runs-on
Here's an example:下面是一个例子:

 # Use Any available Self-hosted runners connected to repo runs-on: self-hosted

See the documentation at " Hosting your own runners ".请参阅“ 托管您自己的跑步者”中的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM