-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from TIBCOSoftware/import-flow-example
Added import flow example for BWCE and FLOGO in tibco-examples folder.
- Loading branch information
Showing
5 changed files
with
351 additions
and
42 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "root", | ||
"version": "1.2.0", | ||
"version": "1.2.2", | ||
"private": true, | ||
"engines": { | ||
"node": "18 || 20" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Group | ||
metadata: | ||
name: tibco-imported | ||
description: Tibco importer group | ||
spec: | ||
type: organization | ||
profile: | ||
displayName: Tibco imported | ||
email: [email protected] | ||
children: [] | ||
--- | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Location | ||
metadata: | ||
name: import-flow-locations | ||
spec: | ||
targets: | ||
- ./import-flow-bwce.yaml | ||
- ./import-flow-flogo.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
apiVersion: scaffolder.backstage.io/v1beta3 | ||
kind: Template | ||
metadata: | ||
name: import-flow-bwce | ||
title: Import flow for BWCE projects | ||
description: Import existing BWCE projects into TIBCO Developer Hub | ||
tags: | ||
- import-flow | ||
- tibco | ||
- template | ||
- developer-hub | ||
spec: | ||
owner: group:default/tibco-imported | ||
type: import-flow | ||
|
||
parameters: | ||
- title: Repository Location | ||
required: | ||
- repoUrl | ||
properties: | ||
repoUrl: | ||
title: GitHub repository with Existing BWCE Project | ||
type: string | ||
ui:field: RepoUrlPicker | ||
ui:options: | ||
allowedHosts: | ||
- github.com | ||
|
||
- title: Fill in some steps | ||
required: | ||
- application | ||
- owner | ||
properties: | ||
application: | ||
title: BWCE Application | ||
type: string | ||
description: Name of the BWCE Application to import | ||
owner: | ||
title: Owner | ||
type: string | ||
description: Owner of the template | ||
ui:field: OwnerPicker | ||
ui:options: | ||
allowedKinds: | ||
- Group | ||
|
||
# The import flow consist out of 4 steps: | ||
# 1. Fetch the project from GitHub | ||
# 2. Generate the Component YAML | ||
# 3. Commit the Component YAML file back to the GitHub project branch creating a pull request | ||
# 4. Register the Component in the catalog | ||
|
||
steps: | ||
- id: fetch | ||
name: Fetch project | ||
action: fetch:plain | ||
input: | ||
url: ${{ "https://" + (parameters.repoUrl | parseRepoUrl).host + "/" + (parameters.repoUrl | parseRepoUrl).owner + "/" + (parameters.repoUrl | parseRepoUrl).repo }} | ||
|
||
- id: extract | ||
name: Extract Parameters | ||
action: tibco:extract-parameters | ||
input: | ||
failOnError: true | ||
extractParameters: | ||
bwce_project_name: | ||
type: xml | ||
filePath: ${{ parameters.application + "/" + parameters.application + ".application/.project" }} | ||
# For xml type extractParameters both json path and xpath are supported | ||
# jsonPath: $.projectDescription.name | ||
xPath: string(/projectDescription/name) | ||
bwce_project_description: | ||
type: xml | ||
filePath: ${{ parameters.application + "/" + parameters.application + ".application/.project" }} | ||
# For xml type extractParameters both json path and xpath are supported | ||
# jsonPath: $.projectDescription.comment | ||
xPath: string(/projectDescription/comment) | ||
|
||
# extractParameters type json, file and workspace also supported | ||
# example_parameter1: | ||
# type: json | ||
# filePath: <File path> | ||
# jsonPath: <Json path> | ||
# example_parameter2: | ||
# type: file | ||
# filePath: <File path> | ||
# regex: <Regex> | ||
# example_parameter3: | ||
# type: workspace | ||
# onlyName: true | ||
# directoryPath: <Directory path> | ||
# regex: <Regex> | ||
|
||
- id: crateYaml | ||
name: Create YAML | ||
action: tibco:create-yaml | ||
input: | ||
# Add application name | ||
outputFile: ${{ parameters.application + '/'+ parameters.application + "-bwce-catalog-info.yaml" }} | ||
# outputFile: "bwce-catalog-info.yaml" | ||
outputStructure: | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
# Output of the Extract Parameters action step will always be an array, so we are using first item from the array | ||
name: ${{ steps.extract.output.bwce_project_name[0]}} | ||
description: ${{ steps.extract.output.bwce_project_description[0] }} | ||
tags: | ||
- bwce | ||
links: | ||
- title: TIBCO Business Works | ||
url: https://www.tibco.com/products/tibco-businessworks | ||
annotations: | ||
github.com/project-slug: ${{ "https://" + (parameters.repoUrl | parseRepoUrl).host + "/" + (parameters.repoUrl | parseRepoUrl).owner + "/" + (parameters.repoUrl | parseRepoUrl).repo }} | ||
backstage.io/techdocs-ref: dir:. | ||
spec: | ||
type: bwce | ||
lifecycle: production | ||
owner: ${{ parameters.owner }} | ||
|
||
# The import flow debug step, enable it for debugging | ||
|
||
# - id: Log Debug | ||
# name: Debug Log | ||
# action: debug:log | ||
# input: | ||
# message: "Fetched the BWCE Skeleton template" | ||
# listWorkspace: true | ||
# bwce_project_name: ${{ steps.extract.output.bwce_project_name[0] }} | ||
# bwce_project_description: ${{ steps.extract.output.bwce_project_description[0] }} | ||
# repoUrl: ${{ parameters.repoUrl }} | ||
|
||
- id: cpr | ||
name: Create Pull Request in Current Repo | ||
action: publish:github:pull-request | ||
input: | ||
repoUrl: ${{ parameters.repoUrl }} | ||
update: true | ||
branchName: ${{ parameters.application.replace("/", ".") }} | ||
title: ${{ parameters.application }} | ||
description: This PR adds a Component YAML to this Repository. | ||
|
||
# Optionally you can leave this step out, if your developer hub synchronize with the GitHub organization | ||
# When the pull request is merged, the component will be registered by the GitHub catalog provider, below is the example configuration | ||
# catalog: | ||
# providers: | ||
# github: | ||
# providerId: | ||
# organization: '<organization>' | ||
# catalogPath: '**/*catalog-info.yaml' | ||
# schedule: | ||
# frequency: { minutes: 30 } | ||
|
||
- id: register | ||
name: Register | ||
action: catalog:register | ||
input: | ||
catalogInfoUrl: ${{ "https://" + (parameters.repoUrl | parseRepoUrl).host + "/" + (parameters.repoUrl | parseRepoUrl).owner + "/" + (parameters.repoUrl | parseRepoUrl).repo + "/blob/" + parameters.application.replace("/", ".") + "/" + parameters.application + "/" + parameters.application +"-bwce-catalog-info.yaml" }} | ||
|
||
output: | ||
links: | ||
# If you are not using register step above, remove the below Open in catalog link. | ||
- title: Open in catalog | ||
icon: catalog | ||
entityRef: ${{ steps.register.output.entityRef }} | ||
- title: Repository (Pull Request) | ||
url: ${{ steps.cpr.output.remoteUrl }} |
Oops, something went wrong.