Adding gitlab ci file.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
id: images
|
||||
label: 'Import remote images.'
|
||||
source:
|
||||
plugin: url
|
||||
data_fetcher_plugin: http
|
||||
data_parser_plugin: json
|
||||
urls: 'https://jsonplaceholder.typicode.com/photos'
|
||||
item_selector: /
|
||||
constants:
|
||||
file_dest_dir: 'public://migrated-images/'
|
||||
jpeg: '.jpeg'
|
||||
ids:
|
||||
image_id:
|
||||
type: string
|
||||
fields:
|
||||
-
|
||||
name: image_id
|
||||
label: 'Image ID'
|
||||
selector: /id
|
||||
-
|
||||
name: image_title
|
||||
label: 'Image URL'
|
||||
selector: /title
|
||||
-
|
||||
name: image_url
|
||||
label: 'Image URL'
|
||||
selector: /url
|
||||
process:
|
||||
_prep_filename:
|
||||
-
|
||||
plugin: callback
|
||||
callable: basename
|
||||
source: image_url
|
||||
filename:
|
||||
plugin: concat
|
||||
source:
|
||||
- '@_prep_filename'
|
||||
- constants/jpeg
|
||||
_prep_file_destination:
|
||||
plugin: concat
|
||||
source:
|
||||
- constants/file_dest_dir
|
||||
- '@filename'
|
||||
uri:
|
||||
plugin: file_copy
|
||||
source:
|
||||
- image_url
|
||||
- '@_prep_file_destination'
|
||||
status:
|
||||
plugin: default_value
|
||||
default_value: 1
|
||||
alt: image_title
|
||||
destination:
|
||||
plugin: 'entity:file'
|
||||
@@ -0,0 +1,37 @@
|
||||
id: json_posts_to_posts
|
||||
label: 'JSON Migrate - Posts to Posts'
|
||||
migration_group: migrate_posts
|
||||
source:
|
||||
plugin: url
|
||||
data_fetcher_plugin: http
|
||||
data_parser_plugin: json
|
||||
urls: 'https://jsonplaceholder.typicode.com/posts'
|
||||
item_selector: /
|
||||
ids:
|
||||
post_id:
|
||||
type: string
|
||||
fields:
|
||||
-
|
||||
name: post_id
|
||||
label: 'Post ID'
|
||||
selector: /id
|
||||
-
|
||||
name: post_title
|
||||
label: 'Post Title'
|
||||
selector: /title
|
||||
-
|
||||
name: post_body
|
||||
label: 'Post Body'
|
||||
selector: /body
|
||||
process:
|
||||
title: post_title
|
||||
body/value: post_body
|
||||
field_image:
|
||||
plugin: migration_lookup
|
||||
migration: images
|
||||
source: post_id # this gets an image with the same ID as the post.
|
||||
|
||||
destination:
|
||||
plugin: 'entity:node'
|
||||
default_bundle: post
|
||||
migration_dependencies: { }
|
||||
Reference in New Issue
Block a user