generated from redhat-developer/new-project-template
-
Notifications
You must be signed in to change notification settings - Fork 53
RHIDP-8632: Update the Bulk Import Plugin to Integrate with Existing Backstage Templates and Orchestrator Workflows #1444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jmagak
wants to merge
13
commits into
redhat-developer:main
Choose a base branch
from
jmagak:RHIDP-8632-Update-the-Bulk-Import-Plugin-to-Integrate-with-Existing-Backstage-Templates-and-Orchestrator-Workflows
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+149
−0
Open
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
65538cb
Bulk import
invalid-email-address 70fae7b
Bulk Import plugin
invalid-email-address fd6aa27
Bulk Import plugin
invalid-email-address 7673b0b
Update bulk import
invalid-email-address 060d3eb
Update bulk import
invalid-email-address 013bd2e
Update bulk import
invalid-email-address 7d83ea2
Update bulk import
invalid-email-address 89c5075
Add a new module
invalid-email-address c37298b
Apply suggestions
invalid-email-address 2d262b6
Apply suggestions
invalid-email-address 150a9f2
Apply peers suggestions
invalid-email-address 668c8c0
Apply new suggestion
invalid-email-address 7c9ca19
Apply suggestions
invalid-email-address File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
66 changes: 66 additions & 0 deletions
66
modules/importing-repositories/procedure-bulk-import-scaffolder-template.adoc
This file contains hidden or 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,66 @@ | ||
:_mod-docs-content-type: PROCEDURE | ||
|
||
[id="procedure-bulk-import-scaffolder-template"] | ||
= Understanding Bulk Import Scaffolder template input parameters | ||
|
||
You can use the Bulk Import plugin to run a Scaffolder template task with specified parameters. As an administrator, you must use these parameters within the template. | ||
|
||
The Bulk Import plugin analyzes Git repository information and provides the following parameters for the Scaffolder template task: | ||
|
||
`repoUrl`:: Normalized repository URL in the following format: | ||
+ | ||
[source,yaml] | ||
---- | ||
${gitProviderHost}?owner=${owner}&repo=${repository-name} | ||
---- | ||
+ | ||
For example, when you run the process, the plugin transforms `https://github.com/redhat-developer/rhdh-plugins` into `github.com?owner=redhat-developer&repo=rhdh-plugins`. | ||
|
||
`name`:: The repository name. | ||
+ | ||
For example, for `https://github.com/redhat-developer/rhdh-plugins`, the `name` is `rhdh-plugins`. | ||
|
||
`organization`:: The repository owner, which can be a user nickname or organization name. | ||
+ | ||
For example, for `https://github.com/redhat-developer/rhdh-plugins`, the `organization` is `redhat-developer`. | ||
|
||
`branchName`:: The proposed repository branch. By default, the proposed repository branch is `bulk-import-catalog-entity`. | ||
|
||
`targetBranchName`:: The default branch of the Git repository. | ||
|
||
`gitProviderHost`:: The Git provider host parsed from the repository URL. | ||
+ | ||
For example, for `https://github.com/redhat-developer/rhdh-plugins`, the `gitProviderHost` is `github.com`. You can use this parameter to write `Git-provider-agnostic` templates. | ||
|
||
To use these parameters in a Scaffolder template: | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
[source,yaml] | ||
---- | ||
parameters: | ||
- title: Repository details | ||
required: | ||
- repoUrl | ||
- branchName | ||
- targetBranchName | ||
- name | ||
- organization | ||
properties: | ||
repoUrl: | ||
type: string | ||
title: Repository URL (Backstage format) | ||
description: github.com?owner=Org&repo=repoName | gitlab.com?owner=Org&repo=repoName | ||
organization: | ||
type: string | ||
title: Owner of the repository | ||
name: | ||
type: string | ||
title: Name of the repository | ||
branchName: | ||
type: string | ||
title: Branch to add the catalog entity to | ||
targetBranchName: | ||
type: string | ||
title: Branch to target the PR/MR to | ||
gitProviderHost: | ||
type: string | ||
title: Git provider host | ||
---- |
17 changes: 17 additions & 0 deletions
17
...s/importing-repositories/procedure-data-handoff-and-custom-workflow-design.adoc
This file contains hidden or 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,17 @@ | ||
:_mod-docs-content-type: PROCEDURE | ||
|
||
[id="full-data-handoff-and-custom-workflow-design"] | ||
|
||
= Data handoff and custom workflow design | ||
|
||
When you configure the Bulk Import plugin by setting the importAPI field to `scaffolder`, the Bulk Import Backend ensures all necessary context is passed directly to the Scaffolder API. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Your control over input data:: The Orchestrator workflow receives the input data required to automate processing for every selected repository. For each repository in that list, the bulk import launches the scaffolder template once and passes the data for that single repository to the template run. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
As an administrator, you can define the Scaffolder template workflow and structure the workflow to do the following: | ||
|
||
Consume the input:: The Scaffolder template receives the repository data as template parameters for the current execution. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Iterate and process:: The orchestrator handles iterating through the repository list and launches the template for each repository. Within a single template run, implement the custom logic for that single repository. For example, create the `catalog-info.yaml` if needed, run compliance checks, then register with the catalog. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Manage lifecycle:: The Scaffolder template workflow owns the entire import lifecycle for the repository list, providing a single point of management and traceability. |
66 changes: 66 additions & 0 deletions
66
...repositories/procedure-integrating-bulk-import-with-orchestrator-workflows.adoc
This file contains hidden or 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,66 @@ | ||
:_mod-docs-content-type: PROCEDURE | ||
|
||
[id="integrating-bulk-import-with-orchestrator-workflows"] | ||
= Setting up a custom Scaffolder workflow for Bulk Import | ||
|
||
As an administrator, you can create a Scaffolder template specifically for the Bulk Import plugin within the configuration of your application. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
You can run the following tasks with this integration: | ||
|
||
* Import existing catalog entities from a repository | ||
* Create pull requests for cleanup | ||
* Call webhooks for external system integration | ||
|
||
[NOTE] | ||
==== | ||
This is not a full list of tasks. The actual Scaffolder tasks in your workflow depend on the actions defined in your template, and the import steps automatically adjust based on your template content when you create and run your workflow. | ||
==== | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
You can execute a custom automation workflow of a Scaffolder template on multiple selected repositories using the bulk import plugin. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
.Prerequisites | ||
|
||
* You created a Scaffolder template specifically designed for the Bulk Import function and provided the Scaffolder template within the configuration of your application. This template is the core definition of your customized import scenario. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
.Procedure | ||
|
||
* Configure your {my-app-config-file} configuration to instruct the Bulk Import plugin to use your custom templates. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
+ | ||
You can direct the Bulk Import plugin to hand off the entire list of selected repositories to a custom Orchestrator workflow. | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
+ | ||
To configure the Bulk Import workflow: | ||
+ | ||
[source,yaml] | ||
---- | ||
bulkImport: | ||
importTemplate: your-template-entity-reference-or-template-name | ||
importAPI: `open-pull-requests` | `scaffolder`; | ||
---- | ||
+ | ||
where: | ||
|
||
`importTemplate:`:: | ||
Enter your Scaffolder template entity reference. | ||
|
||
`importAPI`:: | ||
Set the API to 'scaffolder' to trigger the defined workflow for high-fidelity automation. This field defines the import workflow and currently supports two following options: | ||
|
||
`open-pull-requests`:: This is the default import workflow, which includes the logic for creating pull requests for every selected repository. | ||
|
||
`scaffolder`:: This workflow uses an import scenario defined in the Scaffolder template to create import jobs. Select this option to use the custom import scenario defined in your Scaffolder template. | ||
+ | ||
[IMPORTANT] | ||
==== | ||
The Scaffolder template must be generic and not specific to a single repository if you want your custom Scaffolder template to run successfully for every repository in the bulk list. | ||
==== | ||
|
||
* For the {product-very-short} instance to use the Scaffolder functionality, you must run it with the following environment variable enabled: | ||
|
||
[source,yaml] | ||
---- | ||
export NODE_OPTIONS=--no-node-snapshot | ||
---- | ||
|
||
.Verification | ||
|
||
* The Bulk Import plugin executes the custom Scaffolder template for the list of repositories using the `/task-imports` API endpoint (the `createTaskImportJobs` method). | ||
jmagak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.