Bulk import content from directory

Created on 2 June 2024, 7 months ago
Updated 18 June 2024, 6 months ago

Problem/Motivation

We have a way to import content one file at a time using Drush or the UI. Additionally, we can bulk import content with a zip file, in that case the content should be at the root of the zip folder. Automating this process in a CI/CD pipeline could require assembling the .zip file as part of the deployment process. I'd like to have a way to organize the different YML files in a folder and import all the valid files from that directory with a Drush command, in a manner similar to configuration management.

Steps to reproduce

  1. Install, enable the module
  2. export yml files with drush command or UI
  3. Try to create different folders according to the entity type e.g. node, menu_link_content, taxonomy_term
  4. Create a zip file with the export directory including subdirectories
  5. Import the zip file

That command will import only the content in the root folder of the zip file.

Proposed resolution

In order to improve the management and organization of several files we should be able to create sub directories, creating a zip file could be useful but for some CI/CD processes could be redundant.

Remaining tasks

  1. Drush command should check if the path is a directory, zip or yml file
  2. Import command should get and import all subdirectories valid files as part of the batch process
✨ Feature request
Status

Needs review

Version

1.4

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia sergiogsanchez

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sergiogsanchez
  • πŸ‡¨πŸ‡΄Colombia sergiogsanchez

    Initial patch for bulk import of directory

  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • πŸ‡¨πŸ‡΄Colombia sergiogsanchez

    Patch is ready for review, it should work with subdirectories and import YML valid files within those folders, it should help when your deployment shouldn't depend on the zip file and you need to update that content from time to time.

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    I'll take a look next time I have to do imports. Right now I'm keeping zip files in git, and having individual files would be better to show the updates in the diffs.

    With this workflow, a dev could download the files from the UI and put them in the directory (is there a way to download them straight to there?).

    Otherwise, I think the export needs an option to do individual files for bulk updating.

  • Status changed to Needs work 6 months ago
  • πŸ‡¨πŸ‡΄Colombia jidrone

    There is a .DS_Store file in the patch, it needs to be removed.

  • Status changed to Needs review 6 months ago
  • πŸ‡¨πŸ‡΄Colombia sergiogsanchez

    I removed the .DS_Store file and tested the assets directory import recursively

Production build 0.71.5 2024