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
c2a30862
Commit
c2a30862
authored
Mar 02, 2020
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Combine license mgmt and scanning jobs
- split and rename effort was going on and missed it
parent
0f5efcfc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+14
-2
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+0
-1
No files found.
ee/lib/ee/gitlab/usage_data.rb
View file @
c2a30862
...
@@ -194,7 +194,7 @@ module EE
...
@@ -194,7 +194,7 @@ module EE
# Omitted because no user, creator or author associated: `auto_devops_disabled`, `auto_devops_enabled`
# Omitted because no user, creator or author associated: `auto_devops_disabled`, `auto_devops_enabled`
# Omitted because not in use anymore: `gcp_clusters`, `gcp_clusters_disabled`, `gcp_clusters_enabled`
# Omitted because not in use anymore: `gcp_clusters`, `gcp_clusters_disabled`, `gcp_clusters_enabled`
# rubocop:
disable CodeReuse/ActiveRecord
# rubocop:disable CodeReuse/ActiveRecord
def
usage_activity_by_stage_configure
(
time_period
)
def
usage_activity_by_stage_configure
(
time_period
)
{
{
clusters_applications_cert_managers:
::
Clusters
::
Applications
::
CertManager
.
where
(
time_period
).
distinct_by_user
,
clusters_applications_cert_managers:
::
Clusters
::
Applications
::
CertManager
.
where
(
time_period
).
distinct_by_user
,
...
@@ -314,14 +314,26 @@ module EE
...
@@ -314,14 +314,26 @@ module EE
# container_scanning_jobs, dast_jobs, dependency_scanning_jobs, license_management_jobs, sast_jobs
# container_scanning_jobs, dast_jobs, dependency_scanning_jobs, license_management_jobs, sast_jobs
# Once https://gitlab.com/gitlab-org/gitlab/merge_requests/17568 is merged, this might be doable
# Once https://gitlab.com/gitlab-org/gitlab/merge_requests/17568 is merged, this might be doable
def
usage_activity_by_stage_secure
(
time_period
)
def
usage_activity_by_stage_secure
(
time_period
)
prefix
=
'user_'
results
=
{
results
=
{
user_preferences_group_overview_security_dashboard:
count
(
::
User
.
active
.
group_view_security_dashboard
.
where
(
time_period
))
user_preferences_group_overview_security_dashboard:
count
(
::
User
.
active
.
group_view_security_dashboard
.
where
(
time_period
))
}
}
SECURE_PRODUCT_TYPES
.
each_with_object
(
results
)
do
|
(
secure_type
,
type_with_name
),
response
|
SECURE_PRODUCT_TYPES
.
each_with_object
(
results
)
do
|
(
secure_type
,
type_with_name
),
response
|
response
[
"
user_
#{
type_with_name
}
"
.
to_sym
]
=
distinct_count
(
::
Ci
::
Build
.
where
(
name:
secure_type
).
where
(
time_period
),
:user_id
)
response
[
"
#{
prefix
}
#{
type_with_name
}
"
.
to_sym
]
=
distinct_count
(
::
Ci
::
Build
.
where
(
name:
secure_type
).
where
(
time_period
),
:user_id
)
end
end
# handle license rename https://gitlab.com/gitlab-org/gitlab/issues/8911
combined_license_key
=
"
#{
prefix
}
license_management_jobs"
.
to_sym
license_scan_count
=
results
.
delete
(
"
#{
prefix
}
license_scanning_jobs"
.
to_sym
)
if
license_scan_count
&&
results
[
combined_license_key
]
results
[
combined_license_key
]
+=
license_scan_count
end
results
end
end
# rubocop:enable CodeReuse/ActiveRecord
end
end
end
end
end
end
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
c2a30862
...
@@ -353,7 +353,6 @@ describe Gitlab::UsageData do
...
@@ -353,7 +353,6 @@ describe Gitlab::UsageData do
user_dast_jobs:
0
,
user_dast_jobs:
0
,
user_dependency_scanning_jobs:
0
,
user_dependency_scanning_jobs:
0
,
user_license_management_jobs:
0
,
user_license_management_jobs:
0
,
user_license_scanning_jobs:
0
,
user_sast_jobs:
0
user_sast_jobs:
0
)
)
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