Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
9bea3c0f
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9bea3c0f
编写于
11月 15, 2018
作者:
K
Kirill Zaitsev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add glob for CI changes detection
上级
97e3d5ce
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
1 deletion
+20
-1
changelogs/unreleased/added-glob-for-ci-changes-detection.yml
...gelogs/unreleased/added-glob-for-ci-changes-detection.yml
+5
-0
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+2
-0
lib/gitlab/ci/build/policy/changes.rb
lib/gitlab/ci/build/policy/changes.rb
+1
-1
spec/lib/gitlab/ci/build/policy/changes_spec.rb
spec/lib/gitlab/ci/build/policy/changes_spec.rb
+12
-0
未找到文件。
changelogs/unreleased/added-glob-for-ci-changes-detection.yml
0 → 100644
浏览文件 @
9bea3c0f
---
title
:
Added glob for CI changes detection
merge_request
:
23128
author
:
Kirill Zaitsev
type
:
added
doc/ci/yaml/README.md
浏览文件 @
9bea3c0f
...
...
@@ -476,6 +476,7 @@ docker build:
-
Dockerfile
-
docker/scripts/*
-
dockerfiles/**/*
-
more_scripts/*.{rb,py,sh}
```
In the scenario above, if you are pushing multiple commits to GitLab to an
...
...
@@ -485,6 +486,7 @@ one of the commits contains changes to either:
-
The
`Dockerfile`
file.
-
Any of the files inside
`docker/scripts/`
directory.
-
Any of the files and subfolders inside
`dockerfiles`
directory.
-
Any of the files with
`rb`
,
`py`
,
`sh`
extensions inside
`more_scripts`
directory.
CAUTION:
**Warning:**
There are some caveats when using this feature with new branches and tags. See
...
...
lib/gitlab/ci/build/policy/changes.rb
浏览文件 @
9bea3c0f
...
...
@@ -14,7 +14,7 @@ module Gitlab
pipeline
.
modified_paths
.
any?
do
|
path
|
@globs
.
any?
do
|
glob
|
File
.
fnmatch?
(
glob
,
path
,
File
::
FNM_PATHNAME
|
File
::
FNM_DOTMATCH
)
File
.
fnmatch?
(
glob
,
path
,
File
::
FNM_PATHNAME
|
File
::
FNM_DOTMATCH
|
File
::
FNM_EXTGLOB
)
end
end
end
...
...
spec/lib/gitlab/ci/build/policy/changes_spec.rb
浏览文件 @
9bea3c0f
...
...
@@ -49,6 +49,12 @@ describe Gitlab::Ci::Build::Policy::Changes do
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
it
'is satisfied by matching a pattern with a glob'
do
policy
=
described_class
.
new
(
%w[some/**/*.{rb,txt}]
)
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
it
'is not satisfied when pattern does not match path'
do
policy
=
described_class
.
new
(
%w[some/*.rb]
)
...
...
@@ -61,6 +67,12 @@ describe Gitlab::Ci::Build::Policy::Changes do
expect
(
policy
).
not_to
be_satisfied_by
(
pipeline
,
seed
)
end
it
'is not satified when pattern with glob does not match'
do
policy
=
described_class
.
new
(
%w[invalid/*.{md,rake}]
)
expect
(
policy
).
not_to
be_satisfied_by
(
pipeline
,
seed
)
end
context
'when pipelines does not run for a branch update'
do
before
do
pipeline
.
before_sha
=
Gitlab
::
Git
::
BLANK_SHA
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录