How to use GitLab CI only:changes with only:refs?

一个人想着一个人 提交于 2019-12-11 14:41:58

问题


My .gitlab-ci.yml configuration has a job like:

Lint dummy:
  stage: prepare
  tags: [my-tag]
  only:
    refs: [merge_requests]
    changes: [Thorfile]
  script: "/bin/true"

The only difference from the real job is the tags. Everything else is exactly the same.

Yes, when creating a merge request where Thorfile has not been changed, the "Lint dummy" job is still created.

From the documentation as of 2019.03.14 (https://docs.gitlab.com/ee/ci/yaml/README.html#using-changes-with-merge_requests)

With pipelines for merge requests, make it possible to define if a job should be created base on files modified in a merge request.

For example:

docker build service one:
  script: docker build -t my-service-one-image:$CI_COMMIT_REF_SLUG .
  only:
    refs:
      - merge_requests
    changes:
      - Dockerfile

I am using GitLab 11.7.5.


回答1:


Support for only:changes will be available in the next release:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24490

Edit:

released now (version 11.9). here is the documentation:

https://docs.gitlab.com/ee/ci/yaml/#using-changes-with-merge_requests



来源:https://stackoverflow.com/questions/55167844/how-to-use-gitlab-ci-onlychanges-with-onlyrefs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!