Skip to content
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

Hook Workflow into BuildEngine #1020

Draft
wants to merge 28 commits into
base: feature/svelte-workflows
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f42812e
Add documentation comment to Session.user.roles
FyreByrd Oct 16, 2024
ad35026
Methods to interact with BuildEngine
FyreByrd Sep 30, 2024
e9d70ea
Get default url and token from env
FyreByrd Oct 1, 2024
fb15bbe
Update job execution to Micah's suggestion
FyreByrd Oct 1, 2024
feb8d6e
Spawn jobs from workflow
FyreByrd Oct 16, 2024
ff2c5d6
Add jobs to check build and publish status
FyreByrd Oct 3, 2024
15958c6
Add stub for recurring system status check job
FyreByrd Oct 3, 2024
d0a5862
Add Project Creation
FyreByrd Oct 4, 2024
59b3932
Return Project.Id from databaseProxy/Projects#create
FyreByrd Oct 16, 2024
fbfacbf
Add product creation to frontend
FyreByrd Oct 16, 2024
c1e610b
Change Content-Type header
FyreByrd Oct 7, 2024
8951729
Consolidate response status types
FyreByrd Oct 7, 2024
a20ce85
Rewrite ReassignUserTasks to ModifyUserTasks
FyreByrd Oct 16, 2024
3f773b6
Rename and Reorganize Jobs
FyreByrd Oct 10, 2024
a6a5c6f
Add new queue
FyreByrd Oct 10, 2024
b5b5916
Delete Product from BuildEngine
FyreByrd Oct 10, 2024
0f1fb9b
Add permission check for new project
FyreByrd Oct 10, 2024
95bb408
Remove UserTasks for deleted author
FyreByrd Oct 15, 2024
88c64ec
Imitate correct build/publish failure output
FyreByrd Oct 18, 2024
eb3e89e
Handle post-build artifact creation
FyreByrd Oct 18, 2024
c311ec3
Fix database write for artifacts
FyreByrd Oct 18, 2024
2b83b40
Add DateCreated and DateUpdated to userTasks job
FyreByrd Oct 18, 2024
e98ce10
Handle special artifact types in build
FyreByrd Oct 18, 2024
5aa752e
Update ProductPublications in publish
FyreByrd Oct 18, 2024
1f319b3
Change BuildEngine token method
FyreByrd Oct 18, 2024
9ccf9a1
Add a worker to actually process the default recurring queue
FyreByrd Oct 18, 2024
f2cd320
Return ErrorResponse from try-catch in request
FyreByrd Oct 18, 2024
80dcca3
SystemStatusCheck Job
FyreByrd Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 158 additions & 7 deletions source/SIL.AppBuilder.Portal/common/BullJobTypes.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,167 @@
import { Channels } from './build-engine-api/types.js';
import { RoleId } from './public/prisma.js';

export enum ScriptoriaJobType {
// Build Tasks
Build_Product = 'Build Product',
Build_Check = 'Check Product Build',
// Notification Tasks
Notify_Reviewers = 'Notify Reviewers',
// Product Tasks
Product_Create = 'Create Product',
Product_Delete = 'Delete Product',
// Project Tasks
Project_Create = 'Create Project',
Project_Check = 'Check Project Creation',
// Publishing Tasks
Publish_Product = 'Publish Product',
Publish_Check = 'Check Product Publish',
// System Tasks
System_CheckStatuses = 'Check System Statuses',
// Test
Test = 'Test',
ReassignUserTasks = 'ReassignUserTasks'
// Other Tasks (for now)
UserTasks_Modify = 'Modify UserTasks'
}

export interface TestJob {
export namespace Build {
export interface Product {
type: ScriptoriaJobType.Build_Product;
productId: string;
targets?: string;
environment: { [key: string]: string };
}

export interface Check {
type: ScriptoriaJobType.Build_Check;
organizationId: number;
productId: string;
jobId: number;
buildId: number;
productBuildId: number;
}
}

export namespace Notify {
export interface Reviewers {
type: ScriptoriaJobType.Notify_Reviewers;
productId: string;
}
}

export namespace Product {
export interface Create {
type: ScriptoriaJobType.Product_Create;
productId: string;
}
export interface Delete {
type: ScriptoriaJobType.Product_Delete;
organizationId: number;
workflowJobId: number;
}
}

export namespace Project {
export interface Create {
type: ScriptoriaJobType.Project_Create;
projectId: number;
}

export interface Check {
type: ScriptoriaJobType.Project_Check;
workflowProjectId: number;
organizationId: number;
projectId: number;
}
}

export namespace UserTasks {
export enum OpType {
Delete = 'Delete',
Update = 'Update',
Create = 'Create',
Reassign = 'Reassign'
}

type Config =
| ({
type: OpType.Delete | OpType.Create | OpType.Update;
} & (
| { by: 'All' }
| { by: 'Role'; roles: RoleId[] }
| {
by: 'UserId';
users: number[];
}
))
| {
type: OpType.Reassign;
by?: 'UserIdMapping'; // <- This is literally just so TS doesn't complain
userMapping: { from: number; to: number }[];
};

// Using type here instead of interface for easier composition
export type Modify = (
| {
scope: 'Project';
projectId: number;
}
| {
scope: 'Product';
productId: string;
}
) & {
type: ScriptoriaJobType.UserTasks_Modify;
comment?: string; // just ignore comment for Delete and Reassign
operation: Config;
};
}

export namespace Publish {
export interface Product {
type: ScriptoriaJobType.Publish_Product;
productId: string;
channel: Channels;
targets: string;
environment: { [key: string]: any };
}

export interface Check {
type: ScriptoriaJobType.Publish_Check;
organizationId: number;
productId: string;
jobId: number;
buildId: number;
releaseId: number;
publicationId: number;
}
}

export namespace System {
export interface CheckStatuses {
type: ScriptoriaJobType.System_CheckStatuses;
}
}

export interface Test {
type: ScriptoriaJobType.Test;
time: number;
}

export interface SyncUserTasksJob {
type: ScriptoriaJobType.ReassignUserTasks;
projectId: number;
}
export type ScriptoriaJob = JobTypeMap[keyof JobTypeMap];

export type ScriptoriaJob = TestJob | SyncUserTasksJob;
export type JobTypeMap = {
[ScriptoriaJobType.Build_Product]: Build.Product;
[ScriptoriaJobType.Build_Check]: Build.Check;
[ScriptoriaJobType.Notify_Reviewers]: Notify.Reviewers;
[ScriptoriaJobType.Product_Create]: Product.Create;
[ScriptoriaJobType.Product_Delete]: Product.Delete;
[ScriptoriaJobType.Project_Create]: Project.Create;
[ScriptoriaJobType.Project_Check]: Project.Check;
[ScriptoriaJobType.Publish_Product]: Publish.Product;
[ScriptoriaJobType.Publish_Check]: Publish.Check;
[ScriptoriaJobType.UserTasks_Modify]: UserTasks.Modify;
[ScriptoriaJobType.System_CheckStatuses]: System.CheckStatuses;
[ScriptoriaJobType.Test]: Test;
// Add more mappings here as needed
};
2 changes: 2 additions & 0 deletions source/SIL.AppBuilder.Portal/common/build-engine-api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * as Types from './types.js';
export * as Requests from './requests.js';
Loading