Import Flows
An import flow lets you take existing source code, help generate entities and import those into TIBCO Developer Hub. It is designed in such a way that you can decide your own level of granularity (details or abstractions used in the software design).
Import flows are the same as templates with the tags: import-flow. You can import new entities like components, templates, APIs, and more, in TIBCO Developer Hub using import flows.
On the upper-right corner of import flows, click the vertical ellipsis icon to view the following options:
To search for an available import flow, use the searching, sorting, and filtering options. You can star import flows to add favorites and locate those easily in Starred.
To change an import flow yaml file, choose an import flow and then click the vertical ellipsis icon from the upper-right corner of the import flow form, and click Edit Configuration.
Import flows use the following custom actions:
-
Extract Parameters (
tibco:extract-parameters)- When importing a project, thetibco:extract-parametershelps you get the information from the code. There are 4 ways of extracting parameters:-
XML (using JSONPath or xPath). See, xpath.
-
JSON (using JSONPath). See, JSONPath.
-
File (using RegEx). See, Regular Expressions.
-
Workspace (using RegEx) on the directory structure. See, Regular Expressions.
You can see this custom action in the Installed Actions.
Examples Sample Code Extract parameters when the extract type is XML. steps: - action: tibco:extract-parameters name: Extract parameters input: failOnError: true sourcePath: <Source path> extractParameters: extract_parameter: type: xml filePath: <File path relative to root> xPath: "<Xpath query (Refer: https://www.w3schools.com/xml/xpath_syntax.asp , https://www.npmjs.com/package/xpath)>"Output parameters when the extract type is XML, the value of the output parameter key is always an array. {"output":{"extract_parameter":["<Xpath query output>"]}}Extract parameters when the extract type is XML supporting jsonpath. steps: - action: tibco:extract-parameters name: Extract parameters input: failOnError: true sourcePath: <Source path> extractParameters: extract_parameter: type: xml filePath: <File path relative to root> jsonPath: "<jsonPath query (Refer: https://assertible.com/docs/guide/json-path, https://www.npmjs.com/package/jsonpath)>"Output parameters when the extract type is XML supporting jsonpath, the value of the output parameter key is always an array. {"output":{"extract_parameter":["<Jsonpath query output>"]}}Extract parameters when the extract type is JSON. steps: - action: tibco:extract-parameters name: Extract parameters input: failOnError: true sourcePath: <Source path> extractParameters: extract_parameter: type: json filePath: <File path relative to root> jsonPath: "<jsonPath query (Refer: https://assertible.com/docs/guide/json-path , https://www.npmjs.com/package/jsonpath)>"Output parameters when the extract type is JSON, the value of the output parameter key is always an array. {"output":{"extract_parameter":["<Jsonpath query output>"]}}Extract parameters when the extract type is a file and regex as string. steps: - action: tibco:extract-parameters name: Extract parameters input: failOnError: true sourcePath: <Source path> extractParameters: extract_parameter: type: file filePath: <File path relative to root> regex: "<String or Regular expression to match in the file content (Refer: https://www.w3schools.com/jsref/jsref_match.asp)>"Output parameters when extract type is file and regex as string, the value of output parameter key will be always an array. {"output":{"extract_parameter":["<Regular expression match output>"]}}Extract parameters when extract type is file and regex as object containing regexPattern and regexFlags steps: - action: tibco:extract-parameters name: Extract parameters input: failOnError: true sourcePath: <Source path> extractParameters: extract_parameter: type: file filePath: <File path relative to root> regex: regexPattern: '<Regular expression pattern to match in the file content, Ex: "foo?" (Refer: https://www.w3schools.com/jsref/jsref_match.asp)>' regexFlags: '<Regular expression flags, Ex: "i", "gim" (Refer: https://www.w3schools.com/jsref/jsref_match.asp)>'Output parameters when extract type is file and regex as object containing regexPattern and regexFlags, the value of output parameter key will be always an array {"output":{"extract_parameter":["<Regular expression match output>"]}}Extract parameters when extract type is workspace and regex as string steps: - action: tibco:extract-parameters name: Extract parameters input: failOnError: true sourcePath: <Source path> extractParameters: extract_parameter: type: workspace directoryPath: <Directory path relative to root> glob: "<Glob pattern to find the paths in the directory, optional, default is `**/*` (Refer: https://www.npmjs.com/package/glob)>" onlyName: <Boolean value, optional, default is false, if true will return only file or directory name instead of path> regex: "<String or Regular expression to match the file or directory path (Refer: https://www.w3schools.com/jsref/jsref_match.asp)>"Output parameters when extract type is workspace and regex as string, the value of output parameter key will be always an array {"output":{"extract_parameter":["<Regular expression match output>"]}}Extract parameters when extract type is workspace and regex as object containing regexPattern and regexFlags steps: - action: tibco:extract-parameters name: Extract parameters input: failOnError: true sourcePath: <Source path> extractParameters: extract_parameter: type: workspace directoryPath: <Directory path relative to root> glob: "<Glob pattern to find the paths in the directory, optional, default is `**/*` (Refer: https://www.npmjs.com/package/glob)>" onlyName: <Boolean value, optional, default is false, if true will return only file or directory name instead of path> regex: regexPattern: '<Regular expression pattern to match the file or directory path, Ex: "foo?" (Refer: https://www.w3schools.com/jsref/jsref_match.asp)>' regexFlags: '<Regular expression flags, Ex: "i", "gim" (Refer: https://www.w3schools.com/jsref/jsref_match.asp)>'Output parameters when extract type is workspace and regex as object containing regexPattern and regexFlags, the value of output parameter key will be always an array {"output":{"extract_parameter":["<Regular expression match output>"]}} -
-
Create YAML (
tibco:create-yaml)- When importing a project, thetibco:create-yamlcreates ayamlfile, so that you can create entities, such as components, APIs, templates, users, groups, domains, and systems.You can see this custom action in the Installed Actions.
Example Sample Code Create a yamlfile with example outputStructure.steps: - action: tibco:create-yaml name: Create yaml file input: failOnError: true sourcePath: <Source path> outputFile: <output-file.yaml> outputStructure: apiVersion: backstage.io/v1alpha1 kind: "Component (You can change this to any TIBCO Developer Hub entity, ex: API, Resource, System)" metadata: name: <${{ steps.extract.output.extract_parameter_name[0]}}> description: <${{ steps.extract.output.extract_parameter_desc[0] }}> tags: - <Tag1> - <Tag2> annotations: github.com/project-slug: <${{ "https://" + (parameters.repoUrl | parseRepoUrl).host + "/" + (parameters.repoUrl | parseRepoUrl).owner + "/" + (parameters.repoUrl | parseRepoUrl).repo }}> backstage.io/techdocs-ref: dir:. links: - title: <Link title> url: <Link URL> spec: type: <Type of the application> lifecycle: production owner: <${{ parameters.owner }}>Create yaml file with example outputStructure accepting multiple catalog entity as array steps: - action: tibco:create-yaml name: Create yaml file with multiple catalog entity input: failOnError: true sourcePath: <Source path> outputFile: <output-file.yaml> outputStructure: - apiVersion: backstage.io/v1alpha1 kind: "Component1 (You can change this to any TIBCO Developer Hub entity, ex: API, Resource, System)" metadata: name: <${{ steps.extract.output.extract_parameter_name[0] }}> description: <${{ steps.extract.output.extract_parameter_desc[0] }}> tags: - <Tag1> - <Tag2> annotations: github.com/project-slug: <${{ "https://" + (parameters.repoUrl | parseRepoUrl).host + "/" + (parameters.repoUrl | parseRepoUrl).owner + "/" + (parameters.repoUrl | parseRepoUrl).repo }}> backstage.io/techdocs-ref: dir:. links: - title: <Link title1> url: <Link URL1> spec: type: <Type of the application1> lifecycle: production1 owner: <${{ parameters.owner1 }}> - apiVersion: backstage.io/v1alpha1 kind: "Component2 (You can change this to any TIBCO Developer Hub entity, ex: API, Resource, System)" metadata: name: <${{ steps.extract.output.extract_parameter_name[1] }}> description: <${{ steps.extract.output.extract_parameter_desc[1] }}> tags: - <Tag3> - <Tag4> annotations: github.com/project-slug: <${{ "https://" + (parameters.repoUrl | parseRepoUrl).host + "/" + (parameters.repoUrl | parseRepoUrl).owner + "/" + (parameters.repoUrl | parseRepoUrl).repo }}> backstage.io/techdocs-ref: dir:. links: - title: <Link title2> url: <Link URL2> spec: type: <Type of the application2> lifecycle: production2 owner: <${{ parameters.owner2 }}>
Git Clone (tibco:git:clone): When importing a project, the tibco:git:clone clones a Git repository to your workspace.
You can see this custom action in the Installed Actions.
| Example | Sample Code |
|---|---|
| Git clone with minimal inputs | steps:
- action: tibco:git:clone
name: Clone repository
input:
repoUrl: https://github.com/owner/repo.git
|
| Git clone with all available inputs | steps:
- action: tibco:git:clone
name: Clone repository
input:
failOnError: true
sourcePath: source-path
branch: branch-name
repoUrl: https://github.com/owner/repo.git
token: authentication-token
|
Git Push (tibco:git:push): When importing a project, the tibco:git:push commits and pushes the changes to a git repository for previously cloned Git repository.
| Example | Sample Code |
|---|---|
| Git push with minimal inputs | steps:
- action: tibco:git:push
name: Push to repository
|
| Git push with all available inputs | steps:
- action: tibco:git:push
name: Push to repository
input:
failOnError: true
sourcePath: source-path
commitMessage: Commit message
gitAuthorName: Author Name
gitAuthorEmail: Author Email
branch: branch-name
|
Import flows use the following custom filters:
Decode Base64 (decodeBase64)- When creating the import flow, you can use the decodeBase64 filter which will convert the base64 formatted string to decoded string.
Example:
description: ${{ parameters.base64EncodedString | decodeBase64}}
Encode Base64 (encodeBase64)- When creating the import flow, you can use the encodeBase64 filter which will convert the string to base64 encoded string.
Example:
description: ${{ parameters.string | encodeBase64}}