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
fc178334
Commit
fc178334
authored
Nov 09, 2020
by
Etienne Baqué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ExportedProtectedBranch model
Model to manage protected branch import export. Added specs accordingly.
parent
3e64c76b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
0 deletions
+41
-0
app/models/exported_protected_branch.rb
app/models/exported_protected_branch.rb
+5
-0
app/models/project.rb
app/models/project.rb
+1
-0
app/presenters/projects/import_export/project_export_presenter.rb
...enters/projects/import_export/project_export_presenter.rb
+4
-0
doc/user/project/settings/import_export.md
doc/user/project/settings/import_export.md
+3
-0
lib/gitlab/import_export/project/import_export.yml
lib/gitlab/import_export/project/import_export.yml
+1
-0
spec/factories/exported_protected_branches.rb
spec/factories/exported_protected_branches.rb
+5
-0
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
spec/models/exported_protected_branch_spec.rb
spec/models/exported_protected_branch_spec.rb
+21
-0
No files found.
app/models/exported_protected_branch.rb
0 → 100644
View file @
fc178334
# frozen_string_literal: true
class
ExportedProtectedBranch
<
ProtectedBranch
has_many
:push_access_levels
,
->
{
where
(
deploy_key_id:
nil
)
},
class_name:
"ProtectedBranch::PushAccessLevel"
,
foreign_key: :protected_branch_id
end
app/models/project.rb
View file @
fc178334
...
...
@@ -222,6 +222,7 @@ class Project < ApplicationRecord
has_many
:snippets
,
class_name:
'ProjectSnippet'
has_many
:hooks
,
class_name:
'ProjectHook'
has_many
:protected_branches
has_many
:exported_protected_branches
has_many
:protected_tags
has_many
:repository_languages
,
->
{
order
"share DESC"
}
has_many
:designs
,
inverse_of: :project
,
class_name:
'DesignManagement::Design'
...
...
app/presenters/projects/import_export/project_export_presenter.rb
View file @
fc178334
...
...
@@ -15,6 +15,10 @@ module Projects
self
.
respond_to?
(
:override_description
)
?
override_description
:
super
end
def
protected_branches
project
.
exported_protected_branches
end
private
def
converted_group_members
...
...
doc/user/project/settings/import_export.md
View file @
fc178334
...
...
@@ -51,6 +51,9 @@ Note the following:
then new branches associated with such merge requests will be created
within a project during the import/export. Thus, the number of branches
in the exported project could be bigger than in the original project.
-
Deploy keys allowed to push to protected branches are not exported. Therefore,
you will need to recreate this association by first enabling these deploy keys in your
imported project and then updating your protected branches accordingly.
## Version history
...
...
lib/gitlab/import_export/project/import_export.yml
View file @
fc178334
...
...
@@ -169,6 +169,7 @@ excluded_attributes:
-
:compliance_framework_setting
-
:show_default_award_emojis
-
:services
-
:exported_protected_branches
namespaces
:
-
:runners_token
-
:runners_token_encrypted
...
...
spec/factories/exported_protected_branches.rb
0 → 100644
View file @
fc178334
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:exported_protected_branch
,
class:
'ExportedProtectedBranch'
,
parent: :protected_branch
end
spec/lib/gitlab/import_export/all_models.yml
View file @
fc178334
...
...
@@ -552,6 +552,7 @@ project:
-
pipeline_artifacts
-
terraform_states
-
alert_management_http_integrations
-
exported_protected_branches
award_emoji
:
-
awardable
-
user
...
...
spec/models/exported_protected_branch_spec.rb
0 → 100644
View file @
fc178334
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
ExportedProtectedBranch
do
describe
'Associations'
do
it
{
is_expected
.
to
have_many
(
:push_access_levels
)
}
end
describe
'.push_access_levels'
do
it
'returns the correct push access levels'
do
exported_branch
=
create
(
:exported_protected_branch
,
:developers_can_push
)
deploy_key
=
create
(
:deploy_key
)
create
(
:deploy_keys_project
,
:write_access
,
project:
exported_branch
.
project
,
deploy_key:
deploy_key
)
create
(
:protected_branch_push_access_level
,
protected_branch:
exported_branch
,
deploy_key:
deploy_key
)
dev_push_access_level
=
exported_branch
.
push_access_levels
.
first
expect
(
exported_branch
.
push_access_levels
).
to
contain_exactly
(
dev_push_access_level
)
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