Skip to content

Commit

Permalink
feat(orchestrator): orchestrator plugin entry page & workflows table (j…
Browse files Browse the repository at this point in the history
  • Loading branch information
jkilzi authored and JudeNiroshan committed Nov 29, 2023
1 parent c832db5 commit 1a20bed
Show file tree
Hide file tree
Showing 12 changed files with 852 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,19 @@
"@rjsf/utils": "5.7.3",
"@rjsf/validator-ajv8": "5.7.3",
"json-schema": "^0.4.0",
"moment": "^2.29.0",
"react-hook-form": "^7.45.1",
"react-json-view": "^1.21.3",
"moment": "^2.29.0",
"react-moment": "^1.1.3",
"react-use": "^17.4.0",
"vscode-languageserver-types": "^3.16.0"
},
"devDependencies": {
"@backstage/cli": "0.23.0",
"@backstage/dev-utils": "1.0.22",
"@backstage/test-utils": "^1.4.4",
"@janus-idp/cli": "1.4.0",
"@storybook/react": "^7.5.3",
"@types/json-schema": "^7.0.12"
},
"peerDependencies": {
Expand Down
17 changes: 17 additions & 0 deletions plugins/orchestrator/src/__fixtures__/fakeProcessInstance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {
ProcessInstance,
ProcessInstanceState,
} from '@janus-idp/backstage-plugin-orchestrator-common';

export const fakeProcessInstance: ProcessInstance = {
id: '12f767c1-9002-43af-9515-62a72d0eafb2',
processName: 'Workflow name',
processId: 'workflow_actions',
state: ProcessInstanceState.Error,
start: new Date('2023-11-16T10:50:34.346Z'),
lastUpdate: new Date('2023-11-16T10:50:34.5Z'),
nodes: [],
variables: {},
end: new Date('2023-11-16T10:50:34.5Z'),
endpoint: '',
};
246 changes: 246 additions & 0 deletions plugins/orchestrator/src/__fixtures__/fakeWorkflowItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
import { WorkflowItem } from '@janus-idp/backstage-plugin-orchestrator-common';

export const fakeWorkflowItem: WorkflowItem = {
uri: 'quarkus-backend-workflow-ci-switch.sw.yaml',
definition: {
id: 'quarkus-backend-workflow-ci-switch',
version: '1.0',
specVersion: '0.8',
name: '[WF] Create a starter Quarkus Backend application with a CI pipeline - CI Switch',
description:
'[WF] Create a starter Quarkus Backend application with a CI pipeline - CI Switch',
functions: [
{
name: 'runActionTemplateFetch',
operation: 'specs/actions-openapi.json#fetch:template',
},
{
name: 'runActionPublishGithub',
operation: 'specs/actions-openapi.json#publish:github',
},
{
name: 'runActionCatalogRegister',
operation: 'specs/actions-openapi.json#catalog:register',
},
],
start: 'Generating the Source Code Component',
states: [
{
name: 'Generating the Source Code Component',
type: 'operation',
actionMode: 'sequential',
actions: [
{
name: 'Fetch Template Action - Source Code',
functionRef: {
refName: 'runActionTemplateFetch',
arguments: {
url: 'https://github.com/janus-idp/software-templates/tree/main/templates/github/quarkus-backend/skeleton',
values: {
githubOrg: '.githubOrg',
repoName: '.repoName',
owner: '.owner',
system: '.system',
applicationType: 'api',
description: '.description',
namespace: '.namespace',
imageUrl: 'imageUrl',
imageBuilder: '.imageBuilder',
imageRepository: '.imageRepository',
port: '.port',
ci: '.ci',
groupId: '.groupId',
artifactId: '.artifactId',
javaPackageName: '.javaPackageName',
},
},
},
actionDataFilter: {
toStateData: '.actionFetchTemplateSourceCodeResult',
},
},
],
transition: 'Generating the CI Component',
},
{
name: 'Generating the CI Component',
type: 'switch',
dataConditions: [
{
condition: '${ .ci == "github" }',
transition: 'Generating the CI Component - GitHub',
},
{
condition: '${ .ci == "tekton" }',
transition: 'Generating the CI Component - Tekton',
},
],
defaultCondition: {
transition: 'Generating the CI Component - GitHub',
},
},
{
name: 'Generating the CI Component - GitHub',
type: 'operation',
actionMode: 'sequential',
actions: [
{
name: 'Run Template Fetch Action - CI - GitHub',
functionRef: {
refName: 'runActionTemplateFetch',
arguments: {
url: 'https://github.com/janus-idp/software-templates/tree/main/skeletons/github-actions',
copyWithoutTemplating: ['".github/workflows/"'],
values: {
githubOrg: '.githubOrg',
repoName: '.repoName',
owner: '.owner',
system: '.system',
applicationType: 'api',
description: '.description',
namespace: '.namespace',
imageUrl: 'imageUrl',
imageBuilder: '.imageBuilder',
imageRepository: '.imageRepository',
port: '.port',
ci: '.ci',
groupId: '.groupId',
artifactId: '.artifactId',
javaPackageName: '.javaPackageName',
},
},
},
actionDataFilter: {
toStateData: '.actionTemplateFetchCIResult',
},
},
],
transition: 'Generating the Catalog Info Component',
},
{
name: 'Generating the CI Component - Tekton',
type: 'operation',
actionMode: 'sequential',
actions: [
{
name: 'Run Template Fetch Action - CI - Tekton',
functionRef: {
refName: 'runActionTemplateFetch',
arguments: {
url: 'https://github.com/janus-idp/software-templates/tree/main/skeletons/tekton',
copyWithoutTemplating: ['".tekton/workflows/"'],
values: {
githubOrg: '.githubOrg',
repoName: '.repoName',
owner: '.owner',
system: '.system',
applicationType: 'api',
description: '.description',
namespace: '.namespace',
imageUrl: 'imageUrl',
imageBuilder: '.imageBuilder',
imageRepository: '.imageRepository',
port: '.port',
ci: '.ci',
groupId: '.groupId',
artifactId: '.artifactId',
javaPackageName: '.javaPackageName',
},
},
},
actionDataFilter: {
toStateData: '.actionTemplateFetchCIResult',
},
},
],
transition: 'Generating the Catalog Info Component',
},
{
name: 'Generating the Catalog Info Component',
type: 'operation',
actions: [
{
name: 'Fetch Template Action - Catalog Info',
functionRef: {
refName: 'runActionTemplateFetch',
arguments: {
url: 'https://github.com/janus-idp/software-templates/tree/main/skeletons/catalog-info',
values: {
githubOrg: '.githubOrg',
repoName: '.repoName',
owner: '.owner',
system: '.system',
applicationType: 'api',
description: '.description',
namespace: '.namespace',
imageUrl: 'imageUrl',
imageBuilder: '.imageBuilder',
imageRepository: '.imageRepository',
port: '.port',
ci: '.ci',
groupId: '.groupId',
artifactId: '.artifactId',
javaPackageName: '.javaPackageName',
},
},
},
actionDataFilter: {
toStateData: '.actionFetchTemplateCatalogInfoResult',
},
},
],
transition: 'Publishing to the Source Code Repository',
},
{
name: 'Publishing to the Source Code Repository',
type: 'operation',
actionMode: 'sequential',
actions: [
{
name: 'Publish Github Action',
functionRef: {
refName: 'runActionPublishGithub',
arguments: {
allowedHosts: ['"github.com"'],
description: 'Workflow Action',
repoUrl:
'"github.com?owner=" + .githubOrg + "&repo=" + .repoName',
defaultBranch: '.defaultBranch',
gitCommitMessage: '.gitCommitMessage',
allowAutoMerge: true,
allowRebaseMerge: true,
},
},
actionDataFilter: {
toStateData: '.actionPublishResult',
},
},
],
transition: 'Registering the Catalog Info Component',
},
{
name: 'Registering the Catalog Info Component',
type: 'operation',
actionMode: 'sequential',
actions: [
{
name: 'Catalog Register Action',
functionRef: {
refName: 'runActionCatalogRegister',
arguments: {
repoContentsUrl: '.actionPublishResult.repoContentsUrl',
catalogInfoPath: '"/catalog-info.yaml"',
},
},
actionDataFilter: {
toStateData: '.actionCatalogRegisterResult',
},
},
],
end: true,
},
],
dataInputSchema:
'schemas/quarkus-backend-workflow-ci-switch__main_schema.json',
},
};
Loading

0 comments on commit 1a20bed

Please sign in to comment.