git - github API 提交状态 "failure"和 "error"之间的差异?

标签 git github github-api git-commit

github API 提交状态“失败”和“错误”有什么区别?

最佳答案

GitHub API Statuses包括将提交标记为成功、失败、错误或挂起状态。
通常,在 continuous integration context 中,提交是:

  • 标记为 failed因为作业未能完成
  • 标记为 error因为作业确实完成了,但以非零状态退出
  • 标记为 成功 因为作业确实完成了,并以零状态退出

  • (作业作为由 job scheduler 运行的任务)

    自 2014 年以来,GitHub 与 CI 的集成确实在发展。
    2018 年 5 月,您拥有“Introducing the Checks API, a better way to connect integrations and code”。
    它引入了 的概念checks

    Rather than binary pass/fail build statuses, integrations can report rich statuses, annotate lines of code with detailed information, and kick off reruns.


    您在(检查的)新上下文中发现失败
    https://developer.github.com/assets/images/check_runs.png

    When someone pushes code to a repository, GitHub creates a check suite for the last commit. GitHub Apps with the checks:write permission receive a check_suite webhook with the requested action. When your GitHub App receives the check_suite event, it can create new check runs for the latest commit.


    这适用于:
  • Travis-CI (从那时起 deprecated the GitHub commit status API updates for GitHub Apps-managed repositories )
  • Circle-CI

  • 在那个新环境中( New Checks API public beta ):
  • 失败与运行的检查相关联,但以非零状态退出,
  • 错误与甚至无法运行的检查相关联

  • Questions :

    How are check runs different than commit statuses?

    Commit statuses allow for a simple pass or fail state.
    Check runs allow for much more granular information: they can conclude as either success, failure, neutral, cancelled, timed_out, or action_required. Check runs are more flexible than commit statuses.



    来自 the comments
    Juraj Martinka :

    In unit testing terminology:

    • "failure" usually represents a failed test, that is the code under the test returned an answer but this is different from the expected one;
    • "error" represents an unexpected error in the code like an exception being thrown.

    This is also what I've seen to be used in CI such as Travis:

    • "build failed" means that your change breaks some tests, has linter errors, etc.
    • "build error" means unexpected build job error (early termination).

    Bob Bell同意:

    I use:

    • "failure" to say "the test failed against the criteria", and
    • "error" to be "the test was not able to be executed properly".

    I consider "failure" and "success" to be opposite, the two results of a completed test, while "error" is the outlier, the result of an aborted test.

    关于git - github API 提交状态 "failure"和 "error"之间的差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26294590/

    相关文章:

    git - 如何通过 Github API 创建组织名称而不是手动创建?

    GitHub:在本地使用 wiki:初始推送到 GitHub wiki 时出错

    git - 连接到 Github 时为 "Cannot spawn ssh",但 ssh -T git@github.com 有效吗?

    php - Github API,解码 "date"

    git - 在网站部署中使用 git 的最佳实践

    git - 推送到 Git 服务器时 SSL 证书无效

    git - 设置git pull 和推送所有分支

    github - 如何修复 Github Pages 上的 HTTP 404?

    go - 如何使用 go 获取 github api 的通知

    github-api - 如何从GitHub API获取提交的所有标签