.gitlab-ci.yml在此提交中找不到

时间:2017-01-09 12:15:37

标签: gitlab

当我在 GitLab 中执行 mergeRequest 时,出现编译错误,其中包含说明:

  

对于4a0b9b43,CI构建失败,查看详细信息:.gitlab-ci.yml not                                                       在此提交中找到。

但我已与目标分支同步并在本机上编译成功,我该如何解决此问题?

1 个答案:

答案 0 :(得分:0)

必须首先将.gitlab-ci.yml文件放置到项目的根目录中。如果要在本地或从某个地方交叉引用其他CI配置(需要在远程位置上安装GitLab实例),则必须使用include标记

How-to

在使用include之前,请先检查您的GL实例版本。将您的实例版本与文档中所需的最低版本进行比较。如果需要升级,请备份所有内容并运行更新。您可能需要几个小时才能恢复营业。

要在本地交叉引用CI配置文件,请使用include:local。确保它们在同一分支上。如果在其他分支上,请使用ref

include:
 - local: '/templates/.gitlab-ci-template.yml'

如果要在实例中的某个地方交叉引用CI配置文件,请使用

include:
  - project: 'my-group/my-project'
    file: '/templates/.gitlab-ci-template.yml'

  # You can also specify ref, with the default being the head of the object.

  - project: 'my-group/my-project'
    ref: master # Git branch
    file: '/templates/.gitlab-ci-template.yml'

  - project: 'my-group/my-project'
    ref: v1.0.0 # Git tag
    file: '/templates/.gitlab-ci-template.yml'

  - project: 'my-group/my-project'
    ref: 787123b47f14b552955ca2786bc9542ae66fee5b # Git SHA
    file: '/templates/.gitlab-ci-template.yml'

如果您希望使用实例随附的CI配置模板,请使用include:templateCheck the GitLab's template collection了解更多详情。

include:
  - template: Auto-DevOps.gitlab-ci.yml

如果部署在实例边界之外,例如GitLab.com,请使用include:remote

include:
  - remote: 'https://gitlab.com/awesome-project/raw/master/.gitlab-ci-template.yml'

示例

第一个示例来自GitLab's CI config file for GitLab EE (gitlab-org/gitlab)

image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33"

stages:
  - sync
  - prepare
  - quick-test
  - test
  - post-test
  - review-prepare
  - review
  - qa
  - post-qa
  - notification
  - pages

variables:
  RAILS_ENV: "test"
  NODE_ENV: "test"
  SIMPLECOV: "true"
  GIT_DEPTH: "20"
  GIT_SUBMODULE_STRATEGY: "none"
  GET_SOURCES_ATTEMPTS: "3"
  KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/report-master.json
  FLAKY_RSPEC_SUITE_REPORT_PATH: rspec_flaky/report-suite.json
  BUILD_ASSETS_IMAGE: "false"
  ES_JAVA_OPTS: "-Xms256m -Xmx256m"
  ELASTIC_URL: "http://elastic:changeme@elasticsearch:9200"

after_script:
  - date

include:
  - local: .gitlab/ci/cache-repo.gitlab-ci.yml
  - local: .gitlab/ci/cng.gitlab-ci.yml
  - local: .gitlab/ci/docs.gitlab-ci.yml
  - local: .gitlab/ci/frontend.gitlab-ci.yml
  - local: .gitlab/ci/global.gitlab-ci.yml
  - local: .gitlab/ci/memory.gitlab-ci.yml
  - local: .gitlab/ci/notifications.gitlab-ci.yml
  - local: .gitlab/ci/pages.gitlab-ci.yml
  - local: .gitlab/ci/qa.gitlab-ci.yml
  - local: .gitlab/ci/reports.gitlab-ci.yml
  - local: .gitlab/ci/rails.gitlab-ci.yml
  - local: .gitlab/ci/review.gitlab-ci.yml
  - local: .gitlab/ci/setup.gitlab-ci.yml
  - local: .gitlab/ci/dev-fixtures.gitlab-ci.yml
  - local: .gitlab/ci/test-metadata.gitlab-ci.yml
  - local: .gitlab/ci/yaml.gitlab-ci.yml
  - local: .gitlab/ci/releases.gitlab-ci.yml

您可以看到更多示例on the .gitlab-ci.yml reference in the GitLab documentation