Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1deeb21e
Commit
1deeb21e
authored
Sep 17, 2021
by
Marius Bobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check project settings when assigning a build to a runner
Check project settings when assigning a build to a runner
parent
2428ecbd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
10 deletions
+66
-10
app/models/concerns/enums/ci/commit_status.rb
app/models/concerns/enums/ci/commit_status.rb
+1
-0
app/presenters/commit_status_presenter.rb
app/presenters/commit_status_presenter.rb
+2
-1
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+9
-0
config/feature_flags/development/ci_queueing_builds_enabled_checks.yml
...e_flags/development/ci_queueing_builds_enabled_checks.yml
+8
-0
lib/gitlab/ci/status/build/failed.rb
lib/gitlab/ci/status/build/failed.rb
+2
-1
spec/services/ci/register_job_service_spec.rb
spec/services/ci/register_job_service_spec.rb
+44
-8
No files found.
app/models/concerns/enums/ci/commit_status.rb
View file @
1deeb21e
...
@@ -26,6 +26,7 @@ module Enums
...
@@ -26,6 +26,7 @@ module Enums
pipeline_loop_detected:
17
,
pipeline_loop_detected:
17
,
no_matching_runner:
18
,
# not used anymore, but cannot be deleted because of old data
no_matching_runner:
18
,
# not used anymore, but cannot be deleted because of old data
trace_size_exceeded:
19
,
trace_size_exceeded:
19
,
builds_disabled:
20
,
insufficient_bridge_permissions:
1_001
,
insufficient_bridge_permissions:
1_001
,
downstream_bridge_project_not_found:
1_002
,
downstream_bridge_project_not_found:
1_002
,
invalid_bridge_trigger:
1_003
,
invalid_bridge_trigger:
1_003
,
...
...
app/presenters/commit_status_presenter.rb
View file @
1deeb21e
...
@@ -27,7 +27,8 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
...
@@ -27,7 +27,8 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
user_blocked:
'The user who created this job is blocked'
,
user_blocked:
'The user who created this job is blocked'
,
ci_quota_exceeded:
'No more CI minutes available'
,
ci_quota_exceeded:
'No more CI minutes available'
,
no_matching_runner:
'No matching runner available'
,
no_matching_runner:
'No matching runner available'
,
trace_size_exceeded:
'The job log size limit was reached'
trace_size_exceeded:
'The job log size limit was reached'
,
builds_disabled:
'The CI/CD is disabled for this project'
}.
freeze
}.
freeze
private_constant
:CALLOUT_FAILURE_MESSAGES
private_constant
:CALLOUT_FAILURE_MESSAGES
...
...
app/services/ci/register_job_service.rb
View file @
1deeb21e
...
@@ -271,6 +271,15 @@ module Ci
...
@@ -271,6 +271,15 @@ module Ci
missing_dependency_failure:
->
(
build
,
_
)
{
!
build
.
has_valid_build_dependencies?
},
missing_dependency_failure:
->
(
build
,
_
)
{
!
build
.
has_valid_build_dependencies?
},
runner_unsupported:
->
(
build
,
params
)
{
!
build
.
supported_runner?
(
params
.
dig
(
:info
,
:features
))
},
runner_unsupported:
->
(
build
,
params
)
{
!
build
.
supported_runner?
(
params
.
dig
(
:info
,
:features
))
},
archived_failure:
->
(
build
,
_
)
{
build
.
archived?
}
archived_failure:
->
(
build
,
_
)
{
build
.
archived?
}
}.
merge
(
builds_enabled_checks
)
end
def
builds_enabled_checks
return
{}
unless
::
Feature
.
enabled?
(
:ci_queueing_builds_enabled_checks
,
runner
,
default_enabled: :yaml
)
{
project_deleted:
->
(
build
,
_
)
{
build
.
project
.
pending_delete?
},
builds_disabled:
->
(
build
,
_
)
{
!
build
.
project
.
builds_enabled?
}
}
}
end
end
end
end
...
...
config/feature_flags/development/ci_queueing_builds_enabled_checks.yml
0 → 100644
View file @
1deeb21e
---
name
:
ci_queueing_builds_enabled_checks
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70581
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/341131
milestone
:
'
14.4'
type
:
development
group
:
group::pipeline execution
default_enabled
:
false
lib/gitlab/ci/status/build/failed.rb
View file @
1deeb21e
...
@@ -32,7 +32,8 @@ module Gitlab
...
@@ -32,7 +32,8 @@ module Gitlab
user_blocked:
'pipeline user was blocked'
,
user_blocked:
'pipeline user was blocked'
,
ci_quota_exceeded:
'no more CI minutes available'
,
ci_quota_exceeded:
'no more CI minutes available'
,
no_matching_runner:
'no matching runner available'
,
no_matching_runner:
'no matching runner available'
,
trace_size_exceeded:
'log size limit exceeded'
trace_size_exceeded:
'log size limit exceeded'
,
builds_disabled:
'project builds are disabled'
}.
freeze
}.
freeze
private_constant
:REASONS
private_constant
:REASONS
...
...
spec/services/ci/register_job_service_spec.rb
View file @
1deeb21e
...
@@ -87,12 +87,30 @@ module Ci
...
@@ -87,12 +87,30 @@ module Ci
end
end
context
'for specific runner'
do
context
'for specific runner'
do
before
do
context
'with FF disabled'
do
stub_feature_flags
(
ci_pending_builds_project_runners_decoupling:
false
)
before
do
stub_feature_flags
(
ci_pending_builds_project_runners_decoupling:
false
,
ci_queueing_builds_enabled_checks:
false
)
end
it
'does not pick a build'
do
expect
(
execute
(
specific_runner
)).
to
be_nil
end
end
end
it
'does not pick a build'
do
context
'with FF enabled'
do
expect
(
execute
(
specific_runner
)).
to
be_nil
before
do
stub_feature_flags
(
ci_pending_builds_project_runners_decoupling:
true
,
ci_queueing_builds_enabled_checks:
true
)
end
it
'does not pick a build'
do
expect
(
execute
(
specific_runner
)).
to
be_nil
expect
(
pending_job
.
reload
).
to
be_failed
expect
(
pending_job
.
queuing_entry
).
to
be_nil
end
end
end
end
end
end
end
...
@@ -246,13 +264,31 @@ module Ci
...
@@ -246,13 +264,31 @@ module Ci
end
end
context
'and uses project runner'
do
context
'and uses project runner'
do
before
do
let
(
:build
)
{
execute
(
specific_runner
)
}
stub_feature_flags
(
ci_pending_builds_project_runners_decoupling:
false
)
context
'with FF disabled'
do
before
do
stub_feature_flags
(
ci_pending_builds_project_runners_decoupling:
false
,
ci_queueing_builds_enabled_checks:
false
)
end
it
{
expect
(
build
).
to
be_nil
}
end
end
let
(
:build
)
{
execute
(
specific_runner
)
}
context
'with FF enabled'
do
before
do
stub_feature_flags
(
ci_pending_builds_project_runners_decoupling:
true
,
ci_queueing_builds_enabled_checks:
true
)
end
it
{
expect
(
build
).
to
be_nil
}
it
'does not pick a build'
do
expect
(
build
).
to
be_nil
expect
(
pending_job
.
reload
).
to
be_failed
expect
(
pending_job
.
queuing_entry
).
to
be_nil
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment