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
9acfe49a
Commit
9acfe49a
authored
Nov 09, 2021
by
Allen Cook
Committed by
Matthias Käppler
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add wiki migration to projects and groups
Changelog: added EE: true
parent
f02c40eb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
133 additions
and
0 deletions
+133
-0
ee/lib/ee/bulk_imports/groups/stage.rb
ee/lib/ee/bulk_imports/groups/stage.rb
+4
-0
ee/spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
...c/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
+25
-0
ee/spec/lib/ee/bulk_imports/groups/stage_spec.rb
ee/spec/lib/ee/bulk_imports/groups/stage_spec.rb
+1
-0
lib/bulk_imports/common/pipelines/wiki_pipeline.rb
lib/bulk_imports/common/pipelines/wiki_pipeline.rb
+42
-0
lib/bulk_imports/projects/stage.rb
lib/bulk_imports/projects/stage.rb
+4
-0
spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
+25
-0
spec/lib/bulk_imports/projects/stage_spec.rb
spec/lib/bulk_imports/projects/stage_spec.rb
+1
-0
spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
...s/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
+31
-0
No files found.
ee/lib/ee/bulk_imports/groups/stage.rb
View file @
9acfe49a
...
...
@@ -18,6 +18,10 @@ module EE
pipeline:
::
BulkImports
::
Groups
::
Pipelines
::
EpicsPipeline
,
stage:
2
},
wiki:
{
pipeline:
::
BulkImports
::
Common
::
Pipelines
::
WikiPipeline
,
stage:
2
},
# Override the CE stage value for the EntityFinisher Pipeline
finisher:
{
stage:
4
...
...
ee/spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
0 → 100644
View file @
9acfe49a
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
BulkImports
::
Common
::
Pipelines
::
WikiPipeline
do
describe
'#run'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:parent
)
{
create
(
:group
)
}
let_it_be
(
:bulk_import
)
{
create
(
:bulk_import
,
user:
user
)
}
let_it_be
(
:entity
)
do
create
(
:bulk_import_entity
,
:group_entity
,
bulk_import:
bulk_import
,
source_full_path:
'source/full/path'
,
destination_name:
'My Destination Wiki'
,
destination_namespace:
parent
.
full_path
,
group:
parent
)
end
it_behaves_like
'wiki pipeline imports a wiki for an entity'
end
end
ee/spec/lib/ee/bulk_imports/groups/stage_spec.rb
View file @
9acfe49a
...
...
@@ -16,6 +16,7 @@ RSpec.describe BulkImports::Groups::Stage do
[
1
,
BulkImports
::
Groups
::
Pipelines
::
ProjectEntitiesPipeline
],
[
2
,
BulkImports
::
Common
::
Pipelines
::
BoardsPipeline
],
[
2
,
BulkImports
::
Groups
::
Pipelines
::
EpicsPipeline
],
[
2
,
BulkImports
::
Common
::
Pipelines
::
WikiPipeline
],
[
4
,
BulkImports
::
Common
::
Pipelines
::
EntityFinisher
]
]
end
...
...
lib/bulk_imports/common/pipelines/wiki_pipeline.rb
0 → 100644
View file @
9acfe49a
# frozen_string_literal: true
module
BulkImports
module
Common
module
Pipelines
class
WikiPipeline
include
Pipeline
def
extract
(
*
)
BulkImports
::
Pipeline
::
ExtractedData
.
new
(
data:
{
url:
url_from_parent_path
(
context
.
entity
.
source_full_path
)
})
end
def
transform
(
_
,
data
)
data
&
.
slice
(
:url
)
end
def
load
(
context
,
data
)
return
unless
context
.
portable
.
wiki
url
=
data
[
:url
].
sub
(
"://"
,
"://oauth2:
#{
context
.
configuration
.
access_token
}
@"
)
Gitlab
::
UrlBlocker
.
validate!
(
url
,
allow_local_network:
allow_local_requests?
,
allow_localhost:
allow_local_requests?
)
context
.
portable
.
wiki
.
ensure_repository
context
.
portable
.
wiki
.
repository
.
fetch_as_mirror
(
url
)
end
private
def
url_from_parent_path
(
parent_path
)
wiki_path
=
parent_path
+
".wiki.git"
root
=
context
.
configuration
.
url
Gitlab
::
Utils
.
append_path
(
root
,
wiki_path
)
end
def
allow_local_requests?
Gitlab
::
CurrentSettings
.
allow_local_requests_from_web_hooks_and_services?
end
end
end
end
end
lib/bulk_imports/projects/stage.rb
View file @
9acfe49a
...
...
@@ -35,6 +35,10 @@ module BulkImports
pipeline:
BulkImports
::
Projects
::
Pipelines
::
ExternalPullRequestsPipeline
,
stage:
4
},
wiki:
{
pipeline:
BulkImports
::
Common
::
Pipelines
::
WikiPipeline
,
stage:
5
},
uploads:
{
pipeline:
BulkImports
::
Common
::
Pipelines
::
UploadsPipeline
,
stage:
5
...
...
spec/lib/bulk_imports/common/pipelines/wiki_pipeline_spec.rb
0 → 100644
View file @
9acfe49a
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
BulkImports
::
Common
::
Pipelines
::
WikiPipeline
do
describe
'#run'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:bulk_import
)
{
create
(
:bulk_import
,
user:
user
)
}
let_it_be
(
:parent
)
{
create
(
:project
)
}
let_it_be
(
:entity
)
do
create
(
:bulk_import_entity
,
:project_entity
,
bulk_import:
bulk_import
,
source_full_path:
'source/full/path'
,
destination_name:
'My Destination Wiki'
,
destination_namespace:
parent
.
full_path
,
project:
parent
)
end
it_behaves_like
'wiki pipeline imports a wiki for an entity'
end
end
spec/lib/bulk_imports/projects/stage_spec.rb
View file @
9acfe49a
...
...
@@ -12,6 +12,7 @@ RSpec.describe BulkImports::Projects::Stage do
[
4
,
BulkImports
::
Common
::
Pipelines
::
BoardsPipeline
],
[
4
,
BulkImports
::
Projects
::
Pipelines
::
MergeRequestsPipeline
],
[
4
,
BulkImports
::
Projects
::
Pipelines
::
ExternalPullRequestsPipeline
],
[
5
,
BulkImports
::
Common
::
Pipelines
::
WikiPipeline
],
[
5
,
BulkImports
::
Common
::
Pipelines
::
UploadsPipeline
],
[
6
,
BulkImports
::
Common
::
Pipelines
::
EntityFinisher
]
]
...
...
spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
0 → 100644
View file @
9acfe49a
# frozen_string_literal: true
RSpec
.
shared_examples
'wiki pipeline imports a wiki for an entity'
do
describe
'#run'
do
let_it_be
(
:bulk_import_configuration
)
{
create
(
:bulk_import_configuration
,
bulk_import:
bulk_import
)
}
let_it_be
(
:tracker
)
{
create
(
:bulk_import_tracker
,
entity:
entity
)
}
let_it_be
(
:context
)
{
BulkImports
::
Pipeline
::
Context
.
new
(
tracker
)
}
let
(
:extracted_data
)
{
BulkImports
::
Pipeline
::
ExtractedData
.
new
(
data:
{})
}
context
'successfully imports wiki for an entity'
do
subject
{
described_class
.
new
(
context
)
}
before
do
allow_next_instance_of
(
BulkImports
::
Common
::
Extractors
::
GraphqlExtractor
)
do
|
extractor
|
allow
(
extractor
).
to
receive
(
:extract
).
and_return
(
extracted_data
)
end
end
it
'imports new wiki into destination project'
do
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
url
=
"https://oauth2:token@gitlab.example/
#{
entity
.
source_full_path
}
.wiki.git"
expect
(
repository_service
).
to
receive
(
:fetch_remote
).
with
(
url
,
any_args
).
and_return
0
end
subject
.
run
end
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