Skip to content

Commit

Permalink
fix(orchestrator): stop fetching workflow URI (janus-idp#1297)
Browse files Browse the repository at this point in the history
* fix(orchestrator): stop fetching workflow uri

* Fix description

* Fixes after rebase
  • Loading branch information
caponetto authored Mar 3, 2024
1 parent 08872bc commit 2456a28
Show file tree
Hide file tree
Showing 47 changed files with 1,842 additions and 1,972 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { JsonObject } from '@backstage/types';

import { JSONSchema7 } from 'json-schema';

import { WorkflowItem } from '@janus-idp/backstage-plugin-orchestrator-common';
import { WorkflowDefinition } from '@janus-idp/backstage-plugin-orchestrator-common';

const schema = {
$id: 'classpath:/schemas/yamlgreet__main-schema.json',
Expand Down Expand Up @@ -38,78 +38,75 @@ const schema = {
required: ['name'],
} as JSONSchema7;

const workflowItem = {
uri: 'yamlgreet.sw.yaml',
definition: {
id: 'yamlgreet',
version: '1.0',
specVersion: '0.8',
name: 'Greeting workflow',
description: 'YAML based greeting workflow',
dataInputSchema: 'schemas/yamlgreet__main-schema.json',
start: 'ChooseOnLanguage',
functions: [
{
name: 'greetFunction',
type: 'custom',
operation: 'sysout',
},
],
states: [
{
name: 'ChooseOnLanguage',
type: 'switch',
dataConditions: [
{
condition: '${ .language.language == "English" }',
transition: 'GreetInEnglish',
},
{
condition: '${ .language.language == "Spanish" }',
transition: 'GreetInSpanish',
},
],
defaultCondition: {
const workflowDefinition = {
id: 'yamlgreet',
version: '1.0',
specVersion: '0.8',
name: 'Greeting workflow',
description: 'YAML based greeting workflow',
dataInputSchema: 'schemas/yamlgreet__main-schema.json',
start: 'ChooseOnLanguage',
functions: [
{
name: 'greetFunction',
type: 'custom',
operation: 'sysout',
},
],
states: [
{
name: 'ChooseOnLanguage',
type: 'switch',
dataConditions: [
{
condition: '${ .language.language == "English" }',
transition: 'GreetInEnglish',
},
},
{
name: 'GreetInEnglish',
type: 'inject',
data: {
greeting: 'Hello from YAML Workflow, ',
{
condition: '${ .language.language == "Spanish" }',
transition: 'GreetInSpanish',
},
transition: 'GreetPerson',
],
defaultCondition: {
transition: 'GreetInEnglish',
},
{
name: 'GreetInSpanish',
type: 'inject',
data: {
greeting: 'Saludos desde YAML Workflow, ',
},
transition: 'GreetPerson',
},
{
name: 'GreetInEnglish',
type: 'inject',
data: {
greeting: 'Hello from YAML Workflow, ',
},
transition: 'GreetPerson',
},
{
name: 'GreetInSpanish',
type: 'inject',
data: {
greeting: 'Saludos desde YAML Workflow, ',
},
{
name: 'GreetPerson',
type: 'operation',
actions: [
{
name: 'greetAction',
functionRef: {
refName: 'greetFunction',
arguments: {
message: '.greeting+.name.name',
},
transition: 'GreetPerson',
},
{
name: 'GreetPerson',
type: 'operation',
actions: [
{
name: 'greetAction',
functionRef: {
refName: 'greetFunction',
arguments: {
message: '.greeting+.name.name',
},
},
],
end: {
terminate: true,
},
],
end: {
terminate: true,
},
],
},
} as WorkflowItem;
},
],
} as WorkflowDefinition;

const variables = {
workflowdata: {
Expand All @@ -125,8 +122,8 @@ const variables = {

const mockData: {
schema: JSONSchema7;
workflowItem: WorkflowItem;
workflowDefinition: WorkflowDefinition;
variables: JsonObject;
} = { schema, workflowItem, variables };
} = { schema, workflowDefinition, variables };

export default mockData;
129 changes: 63 additions & 66 deletions plugins/orchestrator-backend/__fixtures__/mockGreetingWorkflowData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { JsonObject } from '@backstage/types';

import { JSONSchema7 } from 'json-schema';

import { WorkflowItem } from '@janus-idp/backstage-plugin-orchestrator-common';
import { WorkflowDefinition } from '@janus-idp/backstage-plugin-orchestrator-common';

const schema = {
$id: 'classpath:/schemas/yamlgreet__main-schema.json',
Expand All @@ -27,78 +27,75 @@ const schema = {
required: ['name'],
} as JSONSchema7;

const workflowItem = {
uri: 'yamlgreet.sw.yaml',
definition: {
id: 'yamlgreet',
version: '1.0',
specVersion: '0.8',
name: 'Greeting workflow',
description: 'YAML based greeting workflow',
dataInputSchema: 'schemas/yamlgreet__main-schema.json',
start: 'ChooseOnLanguage',
functions: [
{
name: 'greetFunction',
type: 'custom',
operation: 'sysout',
},
],
states: [
{
name: 'ChooseOnLanguage',
type: 'switch',
dataConditions: [
{
condition: '${ .language == "English" }',
transition: 'GreetInEnglish',
},
{
condition: '${ .language == "Spanish" }',
transition: 'GreetInSpanish',
},
],
defaultCondition: {
const workflowDefinition = {
id: 'yamlgreet',
version: '1.0',
specVersion: '0.8',
name: 'Greeting workflow',
description: 'YAML based greeting workflow',
dataInputSchema: 'schemas/yamlgreet__main-schema.json',
start: 'ChooseOnLanguage',
functions: [
{
name: 'greetFunction',
type: 'custom',
operation: 'sysout',
},
],
states: [
{
name: 'ChooseOnLanguage',
type: 'switch',
dataConditions: [
{
condition: '${ .language == "English" }',
transition: 'GreetInEnglish',
},
},
{
name: 'GreetInEnglish',
type: 'inject',
data: {
greeting: 'Hello from YAML Workflow, ',
{
condition: '${ .language == "Spanish" }',
transition: 'GreetInSpanish',
},
transition: 'GreetPerson',
],
defaultCondition: {
transition: 'GreetInEnglish',
},
{
name: 'GreetInSpanish',
type: 'inject',
data: {
greeting: 'Saludos desde YAML Workflow, ',
},
transition: 'GreetPerson',
},
{
name: 'GreetInEnglish',
type: 'inject',
data: {
greeting: 'Hello from YAML Workflow, ',
},
transition: 'GreetPerson',
},
{
name: 'GreetInSpanish',
type: 'inject',
data: {
greeting: 'Saludos desde YAML Workflow, ',
},
{
name: 'GreetPerson',
type: 'operation',
actions: [
{
name: 'greetAction',
functionRef: {
refName: 'greetFunction',
arguments: {
message: '.greeting+.name',
},
transition: 'GreetPerson',
},
{
name: 'GreetPerson',
type: 'operation',
actions: [
{
name: 'greetAction',
functionRef: {
refName: 'greetFunction',
arguments: {
message: '.greeting+.name',
},
},
],
end: {
terminate: true,
},
],
end: {
terminate: true,
},
],
},
} as WorkflowItem;
},
],
} as WorkflowDefinition;

const variables = {
workflowdata: {
Expand All @@ -110,8 +107,8 @@ const variables = {

const mockData: {
schema: JSONSchema7;
workflowItem: WorkflowItem;
workflowDefinition: WorkflowDefinition;
variables: JsonObject;
} = { schema, workflowItem, variables };
} = { schema, workflowDefinition, variables };

export default mockData;
Loading

0 comments on commit 2456a28

Please sign in to comment.