Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6b0bfda8
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 搜索 >>
提交
6b0bfda8
编写于
7月 17, 2018
作者:
K
Kamil Trzciński
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add `runner_unsupported` CI failure
上级
6cccf59c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
49 addition
and
18 deletion
+49
-18
app/models/ci/build.rb
app/models/ci/build.rb
+13
-5
app/models/commit_status.rb
app/models/commit_status.rb
+2
-1
app/presenters/commit_status_presenter.rb
app/presenters/commit_status_presenter.rb
+3
-2
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+19
-7
lib/api/runner.rb
lib/api/runner.rb
+9
-1
lib/gitlab/ci/status/build/failed.rb
lib/gitlab/ci/status/build/failed.rb
+2
-1
spec/presenters/ci/build_presenter_spec.rb
spec/presenters/ci/build_presenter_spec.rb
+1
-1
未找到文件。
app/models/ci/build.rb
浏览文件 @
6b0bfda8
...
...
@@ -174,10 +174,6 @@ module Ci
end
end
before_transition
any
=>
[
:running
]
do
|
build
|
build
.
validates_dependencies!
unless
Feature
.
enabled?
(
'ci_disable_validates_dependencies'
)
end
after_transition
pending: :running
do
|
build
|
build
.
ensure_metadata
.
update_timeout_state
end
...
...
@@ -343,6 +339,10 @@ module Ci
{
trace_sections:
true
}
end
def
runner_required_features
%w(variables)
end
def
merge_request
return
@merge_request
if
defined?
(
@merge_request
)
...
...
@@ -581,7 +581,9 @@ module Ci
options
[
:dependencies
]
&
.
empty?
end
def
validates_dependencies!
def
valid_build_dependencies?
return
unless
Feature
.
enabled?
(
'ci_disable_validates_dependencies'
)
dependencies
.
each
do
|
dependency
|
raise
MissingDependenciesError
unless
dependency
.
valid_dependency?
end
...
...
@@ -594,6 +596,12 @@ module Ci
true
end
def
supported_runner?
(
features
)
runner_required_features
.
all?
do
|
feature_name
|
features
[
feature_name
]
end
end
def
hide_secrets
(
trace
)
return
unless
trace
...
...
app/models/commit_status.rb
浏览文件 @
6b0bfda8
...
...
@@ -46,7 +46,8 @@ class CommitStatus < ActiveRecord::Base
api_failure:
2
,
stuck_or_timeout_failure:
3
,
runner_system_failure:
4
,
missing_dependency_failure:
5
missing_dependency_failure:
5
,
runner_unsupported:
6
,
}
##
...
...
app/presenters/commit_status_presenter.rb
浏览文件 @
6b0bfda8
...
...
@@ -6,7 +6,8 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
api_failure:
'There has been an API failure, please try again'
,
stuck_or_timeout_failure:
'There has been a timeout failure or the job got stuck. Check your timeout limits or try again'
,
runner_system_failure:
'There has been a runner system failure, please try again'
,
missing_dependency_failure:
'There has been a missing dependency failure'
missing_dependency_failure:
'There has been a missing dependency failure'
,
# COMMENTED to check if tests gonna fail: runner_unsupported: 'Your runner is unsupported. Upgrade runner to use new features of your Pipeline',
}.
freeze
presents
:build
...
...
@@ -20,6 +21,6 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
end
def
unrecoverable?
script_failure?
||
missing_dependency_failure?
script_failure?
||
missing_dependency_failure?
||
runner_unsupported?
end
end
app/services/ci/register_job_service.rb
浏览文件 @
6b0bfda8
...
...
@@ -41,16 +41,10 @@ module Ci
begin
# In case when 2 runners try to assign the same build, second runner will be declined
# with StateMachines::InvalidTransition or StaleObjectError when doing run! or save method.
begin
build
.
runner_id
=
runner
.
id
build
.
runner_session_attributes
=
params
[
:session
]
if
params
[
:session
].
present?
build
.
run!
if
assign_runner!
(
build
,
params
)
register_success
(
build
)
return
Result
.
new
(
build
,
true
)
# rubocop:disable Cop/AvoidReturnFromBlocks
rescue
Ci
::
Build
::
MissingDependenciesError
build
.
drop!
(
:missing_dependency_failure
)
end
rescue
StateMachines
::
InvalidTransition
,
ActiveRecord
::
StaleObjectError
# We are looping to find another build that is not conflicting
...
...
@@ -72,6 +66,24 @@ module Ci
private
def
assign_runner!
(
build
,
params
)
build
.
runner_id
=
runner
.
id
build
.
runner_session_attributes
=
params
[
:session
]
if
params
[
:session
].
present?
unless
build
.
valid_build_dependencies?
build
.
drop!
(
:missing_dependency_failure
)
return
false
end
unless
build
.
supported_runner?
(
params
.
dig
(
:info
,
:features
))
build
.
drop!
(
:runner_unsupported
)
return
false
end
build
.
run!
return
true
end
def
builds_for_shared_runner
new_builds
.
# don't run projects which have not enabled shared runners and builds
...
...
lib/api/runner.rb
浏览文件 @
6b0bfda8
...
...
@@ -80,7 +80,15 @@ module API
params
do
requires
:token
,
type:
String
,
desc:
%q(Runner's authentication token)
optional
:last_update
,
type:
String
,
desc:
%q(Runner's queue last_update token)
optional
:info
,
type:
Hash
,
desc:
%q(Runner's metadata)
optional
:info
,
type:
Hash
,
desc:
%q(Runner's metadata)
do
optional
:name
,
type:
String
,
desc:
%q(Runner's name)
optional
:version
,
type:
String
,
desc:
%q(Runner's version)
optional
:revision
,
type:
String
,
desc:
%q(Runner's revision)
optional
:platform
,
type:
String
,
desc:
%q(Runner's platform)
optional
:architecture
,
type:
String
,
desc:
%q(Runner's architecture)
optional
:executor
,
type:
String
,
desc:
%q(Runner's executor)
optional
:features
,
type:
Hash
,
desc:
%q(Runner's features)
end
optional
:session
,
type:
Hash
,
desc:
%q(Runner's session data)
do
optional
:url
,
type:
String
,
desc:
%q(Session's url)
optional
:certificate
,
type:
String
,
desc:
%q(Session's certificate)
...
...
lib/gitlab/ci/status/build/failed.rb
浏览文件 @
6b0bfda8
...
...
@@ -9,7 +9,8 @@ module Gitlab
'api_failure'
=>
'API failure'
,
'stuck_or_timeout_failure'
=>
'stuck or timeout failure'
,
'runner_system_failure'
=>
'runner system failure'
,
'missing_dependency_failure'
=>
'missing dependency failure'
'missing_dependency_failure'
=>
'missing dependency failure'
,
# COMMENTED to check if CI fails: 'runner_unsupported' => 'unsuported runner',
}.
freeze
def
status_tooltip
...
...
spec/presenters/ci/build_presenter_spec.rb
浏览文件 @
6b0bfda8
...
...
@@ -231,7 +231,7 @@ describe Ci::BuildPresenter do
let
(
:build
)
{
create
(
:ci_build
,
:failed
,
:script_failure
)
}
context
'when is a script or missing dependency failure'
do
let
(
:failure_reasons
)
{
%w(script_failure missing_dependency_failure)
}
let
(
:failure_reasons
)
{
%w(script_failure missing_dependency_failure
runner_unsupported
)
}
it
'should return false'
do
failure_reasons
.
each
do
|
failure_reason
|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录