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
c9636fb9
Commit
c9636fb9
authored
Apr 07, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure groups are never empty
parent
efd68424
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
app/graphql/types/ci/stage_type.rb
app/graphql/types/ci/stage_type.rb
+28
-0
config/feature_flags/development/ci_no_empty_groups.yml
config/feature_flags/development/ci_no_empty_groups.yml
+8
-0
No files found.
app/graphql/types/ci/stage_type.rb
View file @
c9636fb9
...
@@ -36,6 +36,34 @@ module Types
...
@@ -36,6 +36,34 @@ module Types
jobs_for_pipeline
(
pl
,
indexed
.
keys
,
include_needs
).
each
do
|
stage_id
,
statuses
|
jobs_for_pipeline
(
pl
,
indexed
.
keys
,
include_needs
).
each
do
|
stage_id
,
statuses
|
key
=
indexed
[
stage_id
]
key
=
indexed
[
stage_id
]
groups
=
::
Ci
::
Group
.
fabricate
(
project
,
key
.
stage
,
statuses
)
groups
=
::
Ci
::
Group
.
fabricate
(
project
,
key
.
stage
,
statuses
)
if
Feature
.
enabled?
(
:ci_no_empty_groups
,
project
)
groups
.
each
do
|
group
|
rejected
=
group
.
jobs
.
reject
{
|
job
|
Ability
.
allowed?
(
current_user
,
:read_commit_status
,
job
)
}
group
.
jobs
.
select!
{
|
job
|
Ability
.
allowed?
(
current_user
,
:read_commit_status
,
job
)
}
next
unless
group
.
jobs
.
empty?
exc
=
StandardError
.
new
(
'Empty Ci::Group'
)
traces
=
rejected
.
map
do
|
job
|
trace
=
[]
policy
=
Ability
.
policy_for
(
current_user
,
job
)
policy
.
debug
(
:read_commit_status
,
trace
)
trace
end
extra
=
{
current_user_id:
current_user
&
.
id
,
project_id:
project
.
id
,
pipeline_id:
pl
.
id
,
stage_id:
stage_id
,
group_name:
group
.
name
,
rejected_job_ids:
rejected
.
map
(
&
:id
),
rejected_traces:
traces
}
Gitlab
::
ErrorTracking
.
track_exception
(
exc
,
extra
)
end
groups
.
reject!
{
|
group
|
group
.
jobs
.
empty?
}
end
loader
.
call
(
key
,
groups
)
loader
.
call
(
key
,
groups
)
end
end
end
end
...
...
config/feature_flags/development/ci_no_empty_groups.yml
0 → 100644
View file @
c9636fb9
---
name
:
ci_no_empty_groups
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58789
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/327139
milestone
:
'
13.11'
type
:
development
group
:
group::verify
default_enabled
:
false
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