|
| 1 | +# ⚙️ Workflows tab for Catalog Entities |
| 2 | + |
| 3 | +## 📌 Overview |
| 4 | + |
| 5 | +The Workflows tab lets users discover, run, and track workflows associated with a catalog entity. Powered by the Orchestrator plugin, it surfaces relevant workflows for a Component or Resource and shows their recent runs and status. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 🛠️ Enabling the Workflows Tab |
| 10 | + |
| 11 | +### **1️⃣ Add Entity Annotation** |
| 12 | + |
| 13 | +Add the `orchestrator.io/workflows` annotation to enable the **Workflows** tab for an entity: |
| 14 | + |
| 15 | +```yaml |
| 16 | +metadata: |
| 17 | + name: example-component |
| 18 | + annotations: |
| 19 | + orchestrator.io/workflows: '[deploy_to_staging,deploy_to_production]' |
| 20 | +``` |
| 21 | +
|
| 22 | +Or, enable the tab without pre-listing workflows by using an empty array: |
| 23 | +
|
| 24 | +```yaml |
| 25 | +annotations: |
| 26 | + orchestrator.io/workflows: '[]' |
| 27 | +``` |
| 28 | +
|
| 29 | +> When no workflows are listed, the tab will display workflows inferred from historical runs. |
| 30 | +
|
| 31 | +--- |
| 32 | +
|
| 33 | +### **2️⃣ Plugin Configuration** |
| 34 | +
|
| 35 | +#### **Option A – Dynamic Plugin** |
| 36 | +
|
| 37 | +The `entityTabs` and `mountPoint` fields are required for this catalog integration. |
| 38 | + |
| 39 | +```yaml |
| 40 | +dynamicPlugins: |
| 41 | + frontend: |
| 42 | + red-hat-developer-hub.backstage-plugin-orchestrator: |
| 43 | + entityTabs: |
| 44 | + - path: /workflows |
| 45 | + title: Workflows |
| 46 | + mountPoint: entity.page.workflows |
| 47 | + mountPoints: |
| 48 | + - mountPoint: entity.page.workflows/cards |
| 49 | + importName: OrchestratorCatalogTab |
| 50 | + config: |
| 51 | + layout: |
| 52 | + gridColumn: '1 / -1' |
| 53 | + if: |
| 54 | + anyOf: |
| 55 | + - IsOrchestratorCatalogTabAvailable |
| 56 | +``` |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +#### **Option B – Static Plugin** |
| 61 | + |
| 62 | +To expose workflows directly on the entity page, update |
| 63 | +`packages/app/src/components/catalog/EntityPage.tsx`: |
| 64 | + |
| 65 | +```tsx |
| 66 | +import { |
| 67 | + OrchestratorCatalogTab, |
| 68 | + IsOrchestratorCatalogTabAvailable, |
| 69 | +} from '@red-hat-developer-hub/backstage-plugin-orchestrator'; |
| 70 | +
|
| 71 | +const serviceEntityPage = ( |
| 72 | + <EntityLayout> |
| 73 | + {/* ...existing tabs... */} |
| 74 | +
|
| 75 | + <EntityLayout.Route |
| 76 | + if={IsOrchestratorCatalogTabAvailable} |
| 77 | + path="/workflows" |
| 78 | + title="Workflows" |
| 79 | + > |
| 80 | + <OrchestratorCatalogTab /> |
| 81 | + </EntityLayout.Route> |
| 82 | + </EntityLayout> |
| 83 | +); |
| 84 | +``` |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## 🔹 Workflow Execution Flows for Entities |
| 89 | + |
| 90 | +### **🧩 Option 1 – Via Software Templates** |
| 91 | + |
| 92 | +1. Select a template from the **Create** page. |
| 93 | +2. Fill in workflow inputs and select a **target entity**. |
| 94 | +3. The run is associated with that entity and visible in its tab. |
| 95 | + |
| 96 | +Note: If no entity is selected, the template’s associated entity is used. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +### **📂 Option 2 – Via Entity “Workflows” Tab** |
| 101 | + |
| 102 | +1. Navigate to an entity’s **Workflows** tab. |
| 103 | +2. Select a workflow from the list. |
| 104 | +3. Fill in workflow inputs. |
| 105 | +4. The entity is linked automatically and the run is visible in its tab. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## 🚀 Templates That Create an Entity and Trigger a Workflow |
| 110 | + |
| 111 | +A software template can: |
| 112 | + |
| 113 | +1. Create a new catalog entity (e.g., Component, Resource). |
| 114 | +2. Trigger a workflow via Orchestrator backend actions. |
| 115 | +3. Automatically link the workflow run to the newly created entity. |
| 116 | + |
| 117 | +This flow runs without showing an **EntityPicker** to the user. |
| 118 | +📄 **Example template:** [greet-with-new-component](https://github.com/redhat-developer/rhdh-plugins/tree/main/workspaces/orchestrator/entities/greet-with-new-component) |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +``` |
| 123 | + |
| 124 | +``` |
0 commit comments