如何使用GitLab CI only:with only:refs进行更改? [英] How to use GitLab CI only:changes with only:refs?

查看:1854
本文介绍了如何使用GitLab CI only:with only:refs进行更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.gitlab-ci.yml配置的工作类似于:

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"

与实际作业的唯一区别是tags.其他所有东西都完全一样.

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

是的,当创建Thorfile未被 更改的合并请求时,仍将创建"Lint虚拟"作业.

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

摘自2019年3月14日的文档(

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.

例如:

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

我正在使用GitLab 11.7.5.

I am using GitLab 11.7.5.

推荐答案

仅支持:更改将在下一版本中提供:

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

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

现已发布(版本11.9).这是文档:

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

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

这篇关于如何使用GitLab CI only:with only:refs进行更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆