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
d5fa32e4
Commit
d5fa32e4
authored
May 19, 2020
by
Saikat Sarkar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify usage for secret detection
Refactor code Refactor code
parent
f6697c96
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
6 deletions
+58
-6
db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb
...442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb
+36
-0
db/structure.sql
db/structure.sql
+3
-2
ee/changelogs/unreleased/telemetry-for-secret-detection.yml
ee/changelogs/unreleased/telemetry-for-secret-detection.yml
+5
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+4
-1
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+10
-3
No files found.
db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb
0 → 100644
View file @
d5fa32e4
# frozen_string_literal: true
class
UpdateIndexOnNameTypeEqCiBuildToCiBuilds
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
OLD_INDEX_NAME
=
'index_ci_builds_on_name_and_security_type_eq_ci_build'
NEW_INDEX_NAME
=
'index_security_ci_builds_on_name_and_id'
OLD_CLAUSE
=
"((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text,
('dast'::character varying)::text,
('dependency_scanning'::character varying)::text,
('license_management'::character varying)::text,
('sast'::character varying)::text,
('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)"
NEW_CLAUSE
=
"((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text,
('dast'::character varying)::text,
('dependency_scanning'::character varying)::text,
('license_management'::character varying)::text,
('sast'::character varying)::text,
('secret_detection'::character varying)::text,
('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)"
def
up
add_concurrent_index
:ci_builds
,
[
:name
,
:id
],
name:
NEW_INDEX_NAME
,
where:
NEW_CLAUSE
remove_concurrent_index_by_name
:ci_builds
,
OLD_INDEX_NAME
end
def
down
add_concurrent_index
:ci_builds
,
[
:name
,
:id
],
name:
OLD_INDEX_NAME
,
where:
OLD_CLAUSE
remove_concurrent_index_by_name
:ci_builds
,
NEW_INDEX_NAME
end
end
db/structure.sql
View file @
d5fa32e4
...
...
@@ -9235,8 +9235,6 @@ CREATE INDEX index_ci_builds_on_commit_id_and_type_and_name_and_ref ON public.ci
CREATE
INDEX
index_ci_builds_on_commit_id_and_type_and_ref
ON
public
.
ci_builds
USING
btree
(
commit_id
,
type
,
ref
);
CREATE
INDEX
index_ci_builds_on_name_and_security_type_eq_ci_build
ON
public
.
ci_builds
USING
btree
(
name
,
id
)
WHERE
(((
name
)::
text
=
ANY
(
ARRAY
[(
'container_scanning'
::
character
varying
)::
text
,
(
'dast'
::
character
varying
)::
text
,
(
'dependency_scanning'
::
character
varying
)::
text
,
(
'license_management'
::
character
varying
)::
text
,
(
'sast'
::
character
varying
)::
text
,
(
'license_scanning'
::
character
varying
)::
text
]))
AND
((
type
)::
text
=
'Ci::Build'
::
text
));
CREATE
INDEX
index_ci_builds_on_project_id_and_id
ON
public
.
ci_builds
USING
btree
(
project_id
,
id
);
CREATE
INDEX
index_ci_builds_on_project_id_and_name_and_ref
ON
public
.
ci_builds
USING
btree
(
project_id
,
name
,
ref
)
WHERE
(((
type
)::
text
=
'Ci::Build'
::
text
)
AND
((
status
)::
text
=
'success'
::
text
)
AND
((
retried
=
false
)
OR
(
retried
IS
NULL
)));
...
...
@@ -10607,6 +10605,8 @@ CREATE UNIQUE INDEX index_scim_identities_on_user_id_and_group_id ON public.scim
CREATE
UNIQUE
INDEX
index_scim_oauth_access_tokens_on_group_id_and_token_encrypted
ON
public
.
scim_oauth_access_tokens
USING
btree
(
group_id
,
token_encrypted
);
CREATE
INDEX
index_security_ci_builds_on_name_and_id
ON
public
.
ci_builds
USING
btree
(
name
,
id
)
WHERE
(((
name
)::
text
=
ANY
(
ARRAY
[(
'container_scanning'
::
character
varying
)::
text
,
(
'dast'
::
character
varying
)::
text
,
(
'dependency_scanning'
::
character
varying
)::
text
,
(
'license_management'
::
character
varying
)::
text
,
(
'sast'
::
character
varying
)::
text
,
(
'secret_detection'
::
character
varying
)::
text
,
(
'license_scanning'
::
character
varying
)::
text
]))
AND
((
type
)::
text
=
'Ci::Build'
::
text
));
CREATE
INDEX
index_self_managed_prometheus_alert_events_on_environment_id
ON
public
.
self_managed_prometheus_alert_events
USING
btree
(
environment_id
);
CREATE
INDEX
index_sent_notifications_on_noteable_type_noteable_id
ON
public
.
sent_notifications
USING
btree
(
noteable_id
)
WHERE
((
noteable_type
)::
text
=
'Issue'
::
text
);
...
...
@@ -13900,6 +13900,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200511220023
20200512085150
20200512164334
20200512195442
20200513160930
20200513171959
20200513224143
...
...
ee/changelogs/unreleased/telemetry-for-secret-detection.yml
0 → 100644
View file @
d5fa32e4
---
title
:
Update index_ci_builds_on_name_and_security_type_eq_ci_build index to support secret-detection
merge_request
:
31785
author
:
type
:
performance
ee/lib/ee/gitlab/usage_data.rb
View file @
d5fa32e4
...
...
@@ -23,6 +23,9 @@ module EE
},
sast:
{
name: :sast_jobs
},
secret_detection:
{
name: :secret_detection_jobs
}
}.
freeze
...
...
@@ -345,7 +348,7 @@ module EE
end
# Currently too complicated and to get reliable counts for these stats:
# 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
, secret_detection_jobs
# Once https://gitlab.com/gitlab-org/gitlab/merge_requests/17568 is merged, this might be doable
def
usage_activity_by_stage_secure
(
time_period
)
prefix
=
'user_'
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
d5fa32e4
...
...
@@ -24,6 +24,7 @@ describe Gitlab::UsageData do
create
(
:ci_build
,
name:
'license_management'
,
pipeline:
pipeline
)
create
(
:ee_ci_build
,
name:
'license_scanning'
,
pipeline:
pipeline
)
create
(
:ci_build
,
name:
'sast'
,
pipeline:
pipeline
)
create
(
:ci_build
,
name:
'secret_detection'
,
pipeline:
pipeline
)
create
(
:prometheus_alert
,
project:
projects
[
0
])
create
(
:prometheus_alert
,
project:
projects
[
0
])
...
...
@@ -106,6 +107,7 @@ describe Gitlab::UsageData do
projects_with_prometheus_alerts
projects_with_tracing_enabled
sast_jobs
secret_detection_jobs
status_page_projects
status_page_issues
user_preferences_group_overview_details
...
...
@@ -136,6 +138,7 @@ describe Gitlab::UsageData do
expect
(
count_data
[
:dependency_scanning_jobs
]).
to
eq
(
1
)
expect
(
count_data
[
:license_management_jobs
]).
to
eq
(
2
)
expect
(
count_data
[
:sast_jobs
]).
to
eq
(
1
)
expect
(
count_data
[
:secret_detection_jobs
]).
to
eq
(
1
)
end
it
'correctly shows failure for combined license management'
do
...
...
@@ -584,6 +587,7 @@ describe Gitlab::UsageData do
create
(
:ci_build
,
name:
'dependency_scanning'
,
user:
user
)
create
(
:ci_build
,
name:
'license_management'
,
user:
user
)
create
(
:ci_build
,
name:
'sast'
,
user:
user
)
create
(
:ci_build
,
name:
'secret_detection'
,
user:
user
)
end
end
...
...
@@ -594,7 +598,8 @@ describe Gitlab::UsageData do
user_dast_jobs:
1
,
user_dependency_scanning_jobs:
1
,
user_license_management_jobs:
1
,
user_sast_jobs:
1
user_sast_jobs:
1
,
user_secret_detection_jobs:
1
)
end
...
...
@@ -609,7 +614,8 @@ describe Gitlab::UsageData do
user_dast_jobs:
1
,
user_dependency_scanning_jobs:
1
,
user_license_management_jobs:
2
,
user_sast_jobs:
1
user_sast_jobs:
1
,
user_secret_detection_jobs:
1
)
end
...
...
@@ -623,7 +629,8 @@ describe Gitlab::UsageData do
user_dast_jobs:
-
1
,
user_dependency_scanning_jobs:
-
1
,
user_license_management_jobs:
-
1
,
user_sast_jobs:
-
1
user_sast_jobs:
-
1
,
user_secret_detection_jobs:
-
1
)
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