Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
58a56a03
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,体验更适合开发者的 AI 搜索 >>
提交
58a56a03
编写于
12月 17, 2015
作者:
K
Kamil Trzcinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't create CI status for refs that doesn't have .gitlab-ci.yml, even if the builds are enabled
上级
b2c593da
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
20 deletion
+30
-20
CHANGELOG
CHANGELOG
+1
-0
app/models/ci/commit.rb
app/models/ci/commit.rb
+0
-10
app/services/create_commit_builds_service.rb
app/services/create_commit_builds_service.rb
+16
-2
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+1
-1
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+1
-1
spec/services/create_commit_builds_service_spec.rb
spec/services/create_commit_builds_service_spec.rb
+11
-6
未找到文件。
CHANGELOG
浏览文件 @
58a56a03
...
...
@@ -26,6 +26,7 @@ v 8.3.0 (unreleased)
- Migrate all CI::Services and CI::WebHooks to Services and WebHooks
- Don't show project fork event as "imported"
- Add API endpoint to fetch merge request commits list
- Don't create CI status for refs that doesn't have .gitlab-ci.yml, even if the builds are enabled
- Expose events API with comment information and author info
- Fix: Ensure "Remove Source Branch" button is not shown when branch is being deleted. #3583
- Run custom Git hooks when branch is created or deleted.
...
...
app/models/ci/commit.rb
浏览文件 @
58a56a03
...
...
@@ -218,16 +218,6 @@ module Ci
update!
(
committed_at:
DateTime
.
now
)
end
##
# This method checks if build status should be displayed.
#
# Build status should be available only if builds are enabled
# on project level and `.gitlab-ci.yml` file is present.
#
def
show_build_status?
project
.
builds_enabled?
&&
ci_yaml_file
end
private
def
save_yaml_error
(
error
)
...
...
app/services/create_commit_builds_service.rb
浏览文件 @
58a56a03
...
...
@@ -16,9 +16,23 @@ class CreateCommitBuildsService
return
false
end
tag
=
Gitlab
::
Git
.
tag_ref?
(
origin_ref
)
commit
=
project
.
ensure_ci_commit
(
sha
)
commit
=
project
.
ci_commit
(
sha
)
unless
commit
commit
=
project
.
ci_commits
.
new
(
sha:
sha
)
# Skip creating ci_commit when no gitlab-ci.yml is found
unless
commit
.
ci_yaml_file
return
false
end
# Create a new ci_commit
commit
.
save!
end
# Skip creating builds for commits that have [ci skip]
unless
commit
.
skip_ci?
# Create builds for commit
tag
=
Gitlab
::
Git
.
tag_ref?
(
origin_ref
)
commit
.
update_committed!
commit
.
create_builds
(
ref
,
tag
,
user
)
end
...
...
app/views/projects/commit/_commit_box.html.haml
浏览文件 @
58a56a03
...
...
@@ -40,7 +40,7 @@
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
parent
),
class:
"monospace"
-
if
@ci_commit
&&
@ci_commit
.
show_build_status?
-
if
@ci_commit
.pull-right
=
link_to
ci_status_path
(
@ci_commit
),
class:
"ci-status ci-
#{
@ci_commit
.
status
}
"
do
=
ci_status_icon
(
@ci_commit
)
...
...
app/views/projects/commits/_commit.html.haml
浏览文件 @
58a56a03
...
...
@@ -17,7 +17,7 @@
%a
.text-expander.js-toggle-button
...
.pull-right
-
if
ci_commit
&&
ci_commit
.
show_build_status?
-
if
ci_commit
=
render_ci_status
(
ci_commit
)
=
clipboard_button
(
clipboard_text:
commit
.
id
)
...
...
spec/services/create_commit_builds_service_spec.rb
浏览文件 @
58a56a03
...
...
@@ -52,7 +52,7 @@ describe CreateCommitBuildsService, services: true do
end
end
it
'skips c
ommit
s without .gitlab-ci.yml'
do
it
'skips c
reating ci_commit for ref
s without .gitlab-ci.yml'
do
stub_ci_commit_yaml_file
(
nil
)
result
=
service
.
execute
(
project
,
user
,
ref:
'refs/heads/0_1'
,
...
...
@@ -60,13 +60,11 @@ describe CreateCommitBuildsService, services: true do
after:
'31das312'
,
commits:
[{
message:
'Message'
}]
)
expect
(
result
).
to
be_persisted
expect
(
result
.
builds
.
any?
).
to
be_falsey
expect
(
result
.
status
).
to
eq
(
'skipped'
)
expect
(
result
.
yaml_errors
).
to
be_nil
expect
(
result
).
to
be_falsey
expect
(
Ci
::
Commit
.
count
).
to
eq
(
0
)
end
it
'
skip
s commits if yaml is invalid'
do
it
'
fail
s commits if yaml is invalid'
do
message
=
'message'
allow_any_instance_of
(
Ci
::
Commit
).
to
receive
(
:git_commit_message
)
{
message
}
stub_ci_commit_yaml_file
(
'invalid: file: file'
)
...
...
@@ -77,6 +75,7 @@ describe CreateCommitBuildsService, services: true do
after:
'31das312'
,
commits:
commits
)
expect
(
commit
).
to
be_persisted
expect
(
commit
.
builds
.
any?
).
to
be
false
expect
(
commit
.
status
).
to
eq
(
'failed'
)
expect
(
commit
.
yaml_errors
).
to_not
be_nil
...
...
@@ -97,6 +96,7 @@ describe CreateCommitBuildsService, services: true do
after:
'31das312'
,
commits:
commits
)
expect
(
commit
).
to
be_persisted
expect
(
commit
.
builds
.
any?
).
to
be
false
expect
(
commit
.
status
).
to
eq
(
"skipped"
)
end
...
...
@@ -112,6 +112,7 @@ describe CreateCommitBuildsService, services: true do
commits:
commits
)
expect
(
commit
).
to
be_persisted
expect
(
commit
.
builds
.
first
.
name
).
to
eq
(
"staging"
)
end
...
...
@@ -124,6 +125,7 @@ describe CreateCommitBuildsService, services: true do
after:
'31das312'
,
commits:
commits
)
expect
(
commit
).
to
be_persisted
expect
(
commit
.
builds
.
any?
).
to
be
false
expect
(
commit
.
status
).
to
eq
(
"skipped"
)
expect
(
commit
.
yaml_errors
).
to
be_nil
...
...
@@ -140,6 +142,7 @@ describe CreateCommitBuildsService, services: true do
after:
'31das312'
,
commits:
commits
)
expect
(
commit
).
to
be_persisted
expect
(
commit
.
builds
.
count
(
:all
)).
to
eq
(
2
)
commit
=
service
.
execute
(
project
,
user
,
...
...
@@ -148,6 +151,7 @@ describe CreateCommitBuildsService, services: true do
after:
'31das312'
,
commits:
commits
)
expect
(
commit
).
to
be_persisted
expect
(
commit
.
builds
.
count
(
:all
)).
to
eq
(
2
)
end
...
...
@@ -163,6 +167,7 @@ describe CreateCommitBuildsService, services: true do
commits:
commits
)
expect
(
commit
).
to
be_persisted
expect
(
commit
.
status
).
to
eq
(
"failed"
)
expect
(
commit
.
builds
.
any?
).
to
be
false
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录