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
f515c1dc
Commit
f515c1dc
authored
Jul 23, 2021
by
Philip Cunningham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused association code from DAST models
- Removes unused code and updates tests
parent
86d5d922
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
29 additions
and
43 deletions
+29
-43
ee/app/models/dast/profile.rb
ee/app/models/dast/profile.rb
+0
-3
ee/app/models/dast/profiles_pipeline.rb
ee/app/models/dast/profiles_pipeline.rb
+2
-2
ee/app/models/dast/scanner_profiles_build.rb
ee/app/models/dast/scanner_profiles_build.rb
+2
-2
ee/app/models/dast/site_profiles_build.rb
ee/app/models/dast/site_profiles_build.rb
+2
-2
ee/app/models/dast/site_profiles_pipeline.rb
ee/app/models/dast/site_profiles_pipeline.rb
+2
-2
ee/app/models/dast_scanner_profile.rb
ee/app/models/dast_scanner_profile.rb
+0
-3
ee/app/models/dast_site_profile.rb
ee/app/models/dast_site_profile.rb
+0
-6
ee/app/models/ee/ci/build.rb
ee/app/models/ee/ci/build.rb
+2
-2
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+2
-2
ee/spec/models/ci/build_spec.rb
ee/spec/models/ci/build_spec.rb
+5
-1
ee/spec/models/ci/pipeline_spec.rb
ee/spec/models/ci/pipeline_spec.rb
+2
-2
ee/spec/models/dast/profile_spec.rb
ee/spec/models/dast/profile_spec.rb
+0
-2
ee/spec/models/dast/profiles_pipeline_spec.rb
ee/spec/models/dast/profiles_pipeline_spec.rb
+3
-3
ee/spec/models/dast/scanner_profiles_build_spec.rb
ee/spec/models/dast/scanner_profiles_build_spec.rb
+2
-2
ee/spec/models/dast/site_profiles_build_spec.rb
ee/spec/models/dast/site_profiles_build_spec.rb
+2
-2
ee/spec/models/dast/site_profiles_pipeline_spec.rb
ee/spec/models/dast/site_profiles_pipeline_spec.rb
+2
-2
ee/spec/models/dast_scanner_profile_spec.rb
ee/spec/models/dast_scanner_profile_spec.rb
+0
-2
ee/spec/models/dast_site_profile_spec.rb
ee/spec/models/dast_site_profile_spec.rb
+0
-2
ee/spec/support/shared_examples/graphql/mutations/dast_on_demand_scans_shared_examples.rb
...graphql/mutations/dast_on_demand_scans_shared_examples.rb
+1
-1
No files found.
ee/app/models/dast/profile.rb
View file @
f515c1dc
...
...
@@ -10,9 +10,6 @@ module Dast
has_many
:secret_variables
,
through: :dast_site_profile
,
class_name:
'Dast::SiteProfileSecretVariable'
has_many
:dast_profiles_pipelines
,
class_name:
'Dast::ProfilesPipeline'
,
foreign_key: :dast_profile_id
,
inverse_of: :dast_profile
has_many
:ci_pipelines
,
class_name:
'Ci::Pipeline'
,
through: :dast_profiles_pipelines
has_many
:dast_profile_schedules
,
class_name:
'Dast::ProfileSchedule'
,
foreign_key: :dast_profile_id
,
inverse_of: :dast_profile
validates
:description
,
length:
{
maximum:
255
}
...
...
ee/app/models/dast/profiles_pipeline.rb
View file @
f515c1dc
...
...
@@ -6,7 +6,7 @@ module Dast
self
.
table_name
=
'dast_profiles_pipelines'
belongs_to
:ci_pipeline
,
class_name:
'Ci::Pipeline'
,
optional:
false
,
inverse_of: :dast_profiles_pipeline
belongs_to
:dast_profile
,
class_name:
'Dast::Profile'
,
optional:
false
,
inverse_of: :dast_profiles_pipelines
belongs_to
:ci_pipeline
,
class_name:
'Ci::Pipeline'
,
optional:
false
belongs_to
:dast_profile
,
class_name:
'Dast::Profile'
,
optional:
false
end
end
ee/app/models/dast/scanner_profiles_build.rb
View file @
f515c1dc
...
...
@@ -6,8 +6,8 @@ module Dast
self
.
table_name
=
'dast_scanner_profiles_builds'
belongs_to
:ci_build
,
class_name:
'Ci::Build'
,
optional:
false
,
inverse_of: :dast_scanner_profiles_build
belongs_to
:dast_scanner_profile
,
class_name:
'DastScannerProfile'
,
optional:
false
,
inverse_of: :dast_scanner_profiles_builds
belongs_to
:ci_build
,
class_name:
'Ci::Build'
,
optional:
false
belongs_to
:dast_scanner_profile
,
class_name:
'DastScannerProfile'
,
optional:
false
validates
:ci_build_id
,
:dast_scanner_profile_id
,
presence:
true
...
...
ee/app/models/dast/site_profiles_build.rb
View file @
f515c1dc
...
...
@@ -6,8 +6,8 @@ module Dast
self
.
table_name
=
'dast_site_profiles_builds'
belongs_to
:ci_build
,
class_name:
'Ci::Build'
,
optional:
false
,
inverse_of: :dast_site_profiles_build
belongs_to
:dast_site_profile
,
class_name:
'DastSiteProfile'
,
optional:
false
,
inverse_of: :dast_site_profiles_builds
belongs_to
:ci_build
,
class_name:
'Ci::Build'
,
optional:
false
belongs_to
:dast_site_profile
,
class_name:
'DastSiteProfile'
,
optional:
false
validates
:ci_build_id
,
:dast_site_profile_id
,
presence:
true
...
...
ee/app/models/dast/site_profiles_pipeline.rb
View file @
f515c1dc
...
...
@@ -6,8 +6,8 @@ module Dast
self
.
table_name
=
'dast_site_profiles_pipelines'
belongs_to
:ci_pipeline
,
class_name:
'Ci::Pipeline'
,
optional:
false
,
inverse_of: :dast_site_profiles_pipeline
belongs_to
:dast_site_profile
,
class_name:
'DastSiteProfile'
,
optional:
false
,
inverse_of: :dast_site_profiles_pipelines
belongs_to
:ci_pipeline
,
class_name:
'Ci::Pipeline'
,
optional:
false
belongs_to
:dast_site_profile
,
class_name:
'DastSiteProfile'
,
optional:
false
validates
:ci_pipeline_id
,
:dast_site_profile_id
,
presence:
true
...
...
ee/app/models/dast_scanner_profile.rb
View file @
f515c1dc
...
...
@@ -3,9 +3,6 @@
class
DastScannerProfile
<
ApplicationRecord
belongs_to
:project
has_many
:dast_scanner_profiles_builds
,
class_name:
'Dast::ScannerProfilesBuild'
,
foreign_key: :dast_scanner_profile_id
,
inverse_of: :dast_scanner_profile
has_many
:ci_builds
,
class_name:
'Ci::Build'
,
through: :dast_scanner_profiles_builds
validates
:project_id
,
presence:
true
validates
:name
,
length:
{
maximum:
255
},
uniqueness:
{
scope: :project_id
},
presence:
true
...
...
ee/app/models/dast_site_profile.rb
View file @
f515c1dc
...
...
@@ -6,12 +6,6 @@ class DastSiteProfile < ApplicationRecord
has_many
:secret_variables
,
class_name:
'Dast::SiteProfileSecretVariable'
has_many
:dast_site_profiles_pipelines
,
class_name:
'Dast::SiteProfilesPipeline'
,
foreign_key: :dast_site_profile_id
,
inverse_of: :dast_site_profile
has_many
:ci_pipelines
,
class_name:
'Ci::Pipeline'
,
through: :dast_site_profiles_pipelines
has_many
:dast_site_profiles_builds
,
class_name:
'Dast::SiteProfilesBuild'
,
foreign_key: :dast_site_profile_id
,
inverse_of: :dast_site_profile
has_many
:ci_builds
,
class_name:
'Ci::Build'
,
through: :dast_site_profiles_builds
validates
:excluded_urls
,
length:
{
maximum:
25
}
validates
:auth_url
,
addressable_url:
true
,
length:
{
maximum:
1024
},
allow_nil:
true
validates
:auth_username_field
,
:auth_password_field
,
:auth_username
,
length:
{
maximum:
255
}
...
...
ee/app/models/ee/ci/build.rb
View file @
f515c1dc
...
...
@@ -32,10 +32,10 @@ module EE
has_many
:security_scans
,
class_name:
'Security::Scan'
has_one
:dast_site_profiles_build
,
class_name:
'Dast::SiteProfilesBuild'
,
foreign_key: :ci_build_id
,
inverse_of: :ci_build
has_one
:dast_site_profiles_build
,
class_name:
'Dast::SiteProfilesBuild'
,
foreign_key: :ci_build_id
has_one
:dast_site_profile
,
class_name:
'DastSiteProfile'
,
through: :dast_site_profiles_build
has_one
:dast_scanner_profiles_build
,
class_name:
'Dast::ScannerProfilesBuild'
,
foreign_key: :ci_build_id
,
inverse_of: :ci_build
has_one
:dast_scanner_profiles_build
,
class_name:
'Dast::ScannerProfilesBuild'
,
foreign_key: :ci_build_id
has_one
:dast_scanner_profile
,
class_name:
'DastScannerProfile'
,
through: :dast_scanner_profiles_build
after_commit
:track_ci_secrets_management_usage
,
on: :create
...
...
ee/app/models/ee/ci/pipeline.rb
View file @
f515c1dc
...
...
@@ -20,11 +20,11 @@ module EE
has_many
:security_scans
,
class_name:
'Security::Scan'
,
through: :builds
has_many
:security_findings
,
class_name:
'Security::Finding'
,
through: :security_scans
,
source: :findings
has_one
:dast_profiles_pipeline
,
class_name:
'Dast::ProfilesPipeline'
,
foreign_key: :ci_pipeline_id
,
inverse_of: :ci_pipeline
has_one
:dast_profiles_pipeline
,
class_name:
'Dast::ProfilesPipeline'
,
foreign_key: :ci_pipeline_id
has_one
:dast_profile
,
class_name:
'Dast::Profile'
,
through: :dast_profiles_pipeline
# Temporary location to be moved in the future. Please see gitlab-org/gitlab#330950 for more info.
has_one
:dast_site_profiles_pipeline
,
class_name:
'Dast::SiteProfilesPipeline'
,
foreign_key: :ci_pipeline_id
,
inverse_of: :ci_pipeline
has_one
:dast_site_profiles_pipeline
,
class_name:
'Dast::SiteProfilesPipeline'
,
foreign_key: :ci_pipeline_id
has_one
:dast_site_profile
,
class_name:
'DastSiteProfile'
,
through: :dast_site_profiles_pipeline
has_one
:source_project
,
class_name:
'Ci::Sources::Project'
,
foreign_key: :pipeline_id
...
...
ee/spec/models/ci/build_spec.rb
View file @
f515c1dc
...
...
@@ -41,7 +41,11 @@ RSpec.describe Ci::Build do
end
describe
'associations'
do
it
{
is_expected
.
to
have_many
(
:security_scans
)
}
it
{
is_expected
.
to
have_many
(
:security_scans
).
class_name
(
'Security::Scan'
)
}
it
{
is_expected
.
to
have_one
(
:dast_site_profiles_build
).
class_name
(
'Dast::SiteProfilesBuild'
).
with_foreign_key
(
:ci_build_id
)
}
it
{
is_expected
.
to
have_one
(
:dast_site_profile
).
class_name
(
'DastSiteProfile'
).
through
(
:dast_site_profiles_build
)
}
it
{
is_expected
.
to
have_one
(
:dast_scanner_profiles_build
).
class_name
(
'Dast::ScannerProfilesBuild'
).
with_foreign_key
(
:ci_build_id
)
}
it
{
is_expected
.
to
have_one
(
:dast_scanner_profile
).
class_name
(
'DastScannerProfile'
).
through
(
:dast_scanner_profiles_build
)
}
end
describe
'#shared_runners_minutes_limit_enabled?'
do
...
...
ee/spec/models/ci/pipeline_spec.rb
View file @
f515c1dc
...
...
@@ -18,9 +18,9 @@ RSpec.describe Ci::Pipeline do
it
{
is_expected
.
to
have_many
(
:downstream_bridges
)
}
it
{
is_expected
.
to
have_many
(
:vulnerability_findings
).
through
(
:vulnerabilities_finding_pipelines
).
class_name
(
'Vulnerabilities::Finding'
)
}
it
{
is_expected
.
to
have_many
(
:vulnerabilities_finding_pipelines
).
class_name
(
'Vulnerabilities::FindingPipeline'
)
}
it
{
is_expected
.
to
have_one
(
:dast_profiles_pipeline
).
class_name
(
'Dast::ProfilesPipeline'
).
with_foreign_key
(
:ci_pipeline_id
)
.
inverse_of
(
:ci_pipeline
)
}
it
{
is_expected
.
to
have_one
(
:dast_profiles_pipeline
).
class_name
(
'Dast::ProfilesPipeline'
).
with_foreign_key
(
:ci_pipeline_id
)
}
it
{
is_expected
.
to
have_one
(
:dast_profile
).
class_name
(
'Dast::Profile'
).
through
(
:dast_profiles_pipeline
)
}
it
{
is_expected
.
to
have_one
(
:dast_site_profiles_pipeline
).
class_name
(
'Dast::SiteProfilesPipeline'
).
with_foreign_key
(
:ci_pipeline_id
)
.
inverse_of
(
:ci_pipeline
)
}
it
{
is_expected
.
to
have_one
(
:dast_site_profiles_pipeline
).
class_name
(
'Dast::SiteProfilesPipeline'
).
with_foreign_key
(
:ci_pipeline_id
)
}
it
{
is_expected
.
to
have_one
(
:dast_site_profile
).
class_name
(
'DastSiteProfile'
).
through
(
:dast_site_profiles_pipeline
)
}
end
...
...
ee/spec/models/dast/profile_spec.rb
View file @
f515c1dc
...
...
@@ -12,8 +12,6 @@ RSpec.describe Dast::Profile, type: :model do
it
{
is_expected
.
to
belong_to
(
:dast_site_profile
)
}
it
{
is_expected
.
to
belong_to
(
:dast_scanner_profile
)
}
it
{
is_expected
.
to
have_many
(
:secret_variables
).
through
(
:dast_site_profile
).
class_name
(
'Dast::SiteProfileSecretVariable'
)
}
it
{
is_expected
.
to
have_many
(
:dast_profiles_pipelines
).
class_name
(
'Dast::ProfilesPipeline'
).
with_foreign_key
(
:dast_profile_id
).
inverse_of
(
:dast_profile
)
}
it
{
is_expected
.
to
have_many
(
:ci_pipelines
).
through
(
:dast_profiles_pipelines
).
class_name
(
'Ci::Pipeline'
)
}
it
{
is_expected
.
to
have_many
(
:dast_profile_schedules
).
class_name
(
'Dast::ProfileSchedule'
).
with_foreign_key
(
:dast_profile_id
).
inverse_of
(
:dast_profile
)
}
end
...
...
ee/spec/models/dast/profiles_pipeline_spec.rb
View file @
f515c1dc
...
...
@@ -2,11 +2,11 @@
require
'spec_helper'
RSpec
.
describe
Dast
::
Profile
,
type: :model
do
RSpec
.
describe
Dast
::
Profile
sPipeline
,
type: :model
do
subject
{
create
(
:dast_profiles_pipeline
)
}
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:ci_pipeline
).
class_name
(
'Ci::Pipeline'
).
inverse_of
(
:dast_profiles_pipeline
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_profile
).
class_name
(
'Dast::Profile'
).
inverse_of
(
:dast_profiles_pipelines
).
required
}
it
{
is_expected
.
to
belong_to
(
:ci_pipeline
).
class_name
(
'Ci::Pipeline'
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_profile
).
class_name
(
'Dast::Profile'
).
required
}
end
end
ee/spec/models/dast/scanner_profiles_build_spec.rb
View file @
f515c1dc
...
...
@@ -6,8 +6,8 @@ RSpec.describe Dast::ScannerProfilesBuild, type: :model do
subject
{
create
(
:dast_scanner_profiles_build
)
}
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:ci_build
).
class_name
(
'Ci::Build'
).
inverse_of
(
:dast_scanner_profiles_build
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_scanner_profile
).
class_name
(
'DastScannerProfile'
).
inverse_of
(
:dast_scanner_profiles_builds
).
required
}
it
{
is_expected
.
to
belong_to
(
:ci_build
).
class_name
(
'Ci::Build'
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_scanner_profile
).
class_name
(
'DastScannerProfile'
).
required
}
end
describe
'validations'
do
...
...
ee/spec/models/dast/site_profiles_build_spec.rb
View file @
f515c1dc
...
...
@@ -6,8 +6,8 @@ RSpec.describe Dast::SiteProfilesBuild, type: :model do
subject
{
create
(
:dast_site_profiles_build
)
}
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:ci_build
).
class_name
(
'Ci::Build'
).
inverse_of
(
:dast_site_profiles_build
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_site_profile
).
class_name
(
'DastSiteProfile'
).
inverse_of
(
:dast_site_profiles_builds
).
required
}
it
{
is_expected
.
to
belong_to
(
:ci_build
).
class_name
(
'Ci::Build'
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_site_profile
).
class_name
(
'DastSiteProfile'
).
required
}
end
describe
'validations'
do
...
...
ee/spec/models/dast/site_profiles_pipeline_spec.rb
View file @
f515c1dc
...
...
@@ -6,8 +6,8 @@ RSpec.describe Dast::SiteProfilesPipeline, type: :model do
subject
{
create
(
:dast_site_profiles_pipeline
)
}
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:ci_pipeline
).
class_name
(
'Ci::Pipeline'
).
inverse_of
(
:dast_site_profiles_pipeline
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_site_profile
).
class_name
(
'DastSiteProfile'
).
inverse_of
(
:dast_site_profiles_pipelines
).
required
}
it
{
is_expected
.
to
belong_to
(
:ci_pipeline
).
class_name
(
'Ci::Pipeline'
).
required
}
it
{
is_expected
.
to
belong_to
(
:dast_site_profile
).
class_name
(
'DastSiteProfile'
).
required
}
end
describe
'validations'
do
...
...
ee/spec/models/dast_scanner_profile_spec.rb
View file @
f515c1dc
...
...
@@ -7,8 +7,6 @@ RSpec.describe DastScannerProfile, type: :model do
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
have_many
(
:dast_scanner_profiles_builds
).
class_name
(
'Dast::ScannerProfilesBuild'
).
with_foreign_key
(
:dast_scanner_profile_id
).
inverse_of
(
:dast_scanner_profile
)
}
it
{
is_expected
.
to
have_many
(
:ci_builds
).
class_name
(
'Ci::Build'
).
through
(
:dast_scanner_profiles_builds
)
}
end
describe
'validations'
do
...
...
ee/spec/models/dast_site_profile_spec.rb
View file @
f515c1dc
...
...
@@ -11,8 +11,6 @@ RSpec.describe DastSiteProfile, type: :model do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
belong_to
(
:dast_site
)
}
it
{
is_expected
.
to
have_many
(
:secret_variables
).
class_name
(
'Dast::SiteProfileSecretVariable'
)
}
it
{
is_expected
.
to
have_many
(
:dast_site_profiles_builds
).
class_name
(
'Dast::SiteProfilesBuild'
).
with_foreign_key
(
:dast_site_profile_id
).
inverse_of
(
:dast_site_profile
)
}
it
{
is_expected
.
to
have_many
(
:ci_builds
).
class_name
(
'Ci::Build'
).
through
(
:dast_site_profiles_builds
)
}
end
describe
'validations'
do
...
...
ee/spec/support/shared_examples/graphql/mutations/dast_on_demand_scans_shared_examples.rb
View file @
f515c1dc
...
...
@@ -28,7 +28,7 @@ RSpec.shared_examples 'it creates a DAST on-demand scan pipeline' do
it
'creates an association between the dast_profile and the ci_pipeline'
do
subject
expect
(
dast_profile
.
ci_pipelines
).
to
include
(
pipelin
e
)
expect
(
pipeline
.
dast_profile
).
to
eq
(
dast_profil
e
)
end
it
'returns the pipeline_url'
do
...
...
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