
Import a Workflow from a Zip File into a Repository Folder
importWorkflow.RdThis function imports a workflow from a specified zip file into a given repository folder. It reconstructs the workflow structure, maintains step dependencies, handles file links, and applies optional tool and link mappings for environment portability.
Arguments
- workflowFile
Character. Path to the workflow zip file to import. The zip file should contain a single folder with:
workflow.json- Required. Contains workflow metadata and step definitionsinternalLinks.json- Optional. Defines dependencies between workflow stepslinks/- Optional directory containing external file dependenciesStep folders named by handle containing
inputFiles/andoutputFiles/
- importRepoFolder
Character. Path to the repository folder where the workflow will be imported. Must be an existing folder in the improve repository.
Value
None. The function is called for its side effects. Steps are created in the target repository with preserved dependencies and file relationships.
Details
The import process includes the following steps:
Extracts the workflow zip file to a temporary directory
Validates the workflow structure and required files
Creates workflow and step template environments
Reconstructs step dependencies from internalLinks.json
Uploads external link files to the repository
Applies optional link mappings from
<workflowName>LinkMapping.jsonApplies optional tool mappings from
<workflowName>ToolMapping.jsonCreates steps in dependency order
Uploads input and output files for each step
Mapping Files
Two optional JSON mapping files can be placed alongside the workflow zip:
LinkMapping.json - Maps external file references to existing repository resources:
[
{
"key": "unique-file-identifier",
"ident": "repository-resource-id",
"name": "optional-display-name"
}
]
ToolMapping.json - Maps tool configurations between environments:
[
{
"key": "sourceServer:::sourceTool:::sourceInstance:::gridTool",
"runserverLabel": "targetServer",
"toolLabel": "targetTool",
"toolInstance": "targetInstance",
"gridTool": true/false
}
]
See also
exportWorkflow for creating workflow export files
Examples
if (FALSE) { # \dontrun{
# Basic import
importWorkflow("myWorkflow.zip", "/Projects/TargetFolder")
# Import with link mapping
# Create myWorkflowLinkMapping.json in same directory as zip
# Then import:
importWorkflow("myWorkflow.zip", "/Projects/TargetFolder")
# Import with tool mapping for different environment
# Create myWorkflowToolMapping.json for server configuration
importWorkflow("myWorkflow.zip", "/Projects/Production")
} # }