diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 11a6724..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: CI -on: - push: - pull_request: -jobs: - verify: - runs-on: ubuntu-latest - env: - CI: true - NODE_OPTIONS: --max-old-space-size=4096 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: yarn install - - name: validate config - run: yarn backstage-cli config:check --lax - - name: type checking and declarations - run: yarn tsc:full - - name: prettier - run: yarn prettier:check - - name: build all packages - run: yarn backstage-cli repo build --all - - name: fetch branch main - # needed so the linter can run only against changed files - run: git fetch origin main - - name: lint changed packages - run: yarn lint - - name: ensure clean working directory - run: | - if files=$(git ls-files --exclude-standard --others --modified) && [[ -z "$files" ]]; then - exit 0 - else - echo "" - echo "Working directory has been modified:" - echo "" - git status --short - echo "" - exit 1 - fi diff --git a/package.json b/package.json index 8a638c0..3e9485b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "root", - "version": "1.2.0", + "version": "1.2.2", "private": true, "engines": { "node": "18 || 20" diff --git a/tibco-examples/import-flow/catalog-info.yaml b/tibco-examples/import-flow/catalog-info.yaml new file mode 100644 index 0000000..5569d33 --- /dev/null +++ b/tibco-examples/import-flow/catalog-info.yaml @@ -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: info@acme.com + children: [] +--- +apiVersion: backstage.io/v1alpha1 +kind: Location +metadata: + name: import-flow-locations +spec: + targets: + - ./import-flow-bwce.yaml + - ./import-flow-flogo.yaml diff --git a/tibco-examples/import-flow/import-flow-bwce.yaml b/tibco-examples/import-flow/import-flow-bwce.yaml new file mode 100644 index 0000000..8bbca6b --- /dev/null +++ b/tibco-examples/import-flow/import-flow-bwce.yaml @@ -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: +# jsonPath: +# example_parameter2: +# type: file +# filePath: +# regex: +# example_parameter3: +# type: workspace +# onlyName: true +# directoryPath: +# 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: '' +# 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 }} diff --git a/tibco-examples/import-flow/import-flow-flogo.yaml b/tibco-examples/import-flow/import-flow-flogo.yaml new file mode 100644 index 0000000..e442cd3 --- /dev/null +++ b/tibco-examples/import-flow/import-flow-flogo.yaml @@ -0,0 +1,163 @@ +apiVersion: scaffolder.backstage.io/v1beta3 +kind: Template +metadata: + name: import-flow-flogo + title: Import flow for Flogo projects + description: Import existing Flogo 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 Flogo Project + type: string + ui:field: RepoUrlPicker + ui:options: + allowedHosts: + - github.com + + - title: Fill in some steps + required: + - application + - owner + properties: + application: + title: Flogo Application + type: string + description: Name of the Flogo 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: + flogo_project_name: + type: json + filePath: ${{ parameters.application }} + jsonPath: $.name + flogo_project_description: + type: json + filePath: ${{ parameters.application }} + jsonPath: $.description + +# extractParameters type xml, file and workspace also supported +# example_parameter1: +# type: xml +# filePath: +# xPath: +# example_parameter2: +# type: file +# filePath: +# regex: +# example_parameter3: +# type: workspace +# onlyName: true +# directoryPath: +# regex: + + - id: crateYaml + name: Create YAML + action: tibco:create-yaml + input: + # Add application name + # outputFile: flogo-catalog-info.yaml + outputFile: ${{ parameters.application + "-flogo-catalog-info.yaml" }} + # outputFile: "catalog-info-flogo.yaml" + outputStructure: + apiVersion: backstage.io/v1alpha1 + kind: Component + metadata: + name: ${{ steps.extract.output.flogo_project_name[0]}} + description: ${{ steps.extract.output.flogo_project_description[0] }} + tags: + - flogo + links: + - title: TIBCO Flogo Enterprise + url: https://docs.tibco.com/products/tibco-flogo-enterprise + 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: flogo + 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 Flogo Skeleton template" +# listWorkspace: true +# flogo_project_name: ${{ steps.extract.output.flogo_project_name[0] }} +# flogo_project_description: ${{ steps.extract.output.flogo_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 file 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: '' +# 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 + "-flogo-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 }}