Commit graph

4829 commits

Author SHA1 Message Date
Mohamed Ali f85615fb8f
Set the default value for Interval to match DefaultValue (should fix #4818) (#4926) 2024-02-17 09:20:07 +01:00
MariusVuscanNx 177891c91b
Updated client to include inputs as part of workflow instance (#4955) 2024-02-16 22:50:49 +01:00
Sipke Schoorstra 99d7d0009b Update MassTransitBroker to use Memory
The code previously had the MassTransitBroker set to AzureServiceBus. This commit changes it to use in-memory MassTransitBroker. An "Memory" enumeration value is also added in the MassTransitBroker enumeration.
2024-02-16 22:46:29 +01:00
Raymond den Haan fd45171068 Update package prefix extraction logic in workflow 2024-02-16 11:58:26 +01:00
Raymond den Haan 4f20a8d5b4 Added fix path to package list 2024-02-16 11:58:26 +01:00
Raymond den Haan f0b5f750ac Fixed issue where updated and finished date where not set when cancelling a workflow 2024-02-16 11:58:26 +01:00
Sipke Schoorstra ef3431c57a
Implement dispatch channels (#4949)
* Add DispatchWorkflowOptions and update MassTransit configuration

Introduced a new class `DispatchWorkflowOptions` to provide workflow dispatch options. Updated MassTransit configuration to include NET6.0 and NET7.0 support, and ensure correct MassTransit version usage per target framework version.

* Add support for configurable MassTransit message dispatching

Implemented a feature which allows for configurable MassTransit message dispatching. Added support for specifying channels and message brokers. Message dispatching code was massively refactored and relevant endpoints and response models were updated to support new message dispatching features.

* Add IEndpointChannelFormatter interface and implementation

An interface for formatting channel queue names, 'IEndpointChannelFormatter', has been added, along with its default implementation 'DefaultEndpointChannelFormatter'. The code that uses hardcoded queue name formatting has been modified to use the new formatter instead, making it more configurable and reusable. The implementation of the formatter uses the 'Humanizer' library to kebab-case the channel names.

* Add channel dispatch option to workflow activities

Introduced `WorkflowDispatcherChannelOptionsProvider` to provide dropdown channel options for workflow dispatch-related activities. Updated `DispatchWorkflow` and `BulkDispatchWorkflows` activities to include a new dropdown input for specifying a dispatch channel. Also, included the selected channel name in the `DispatchWorkflowOptions` during workflow dispatching process.

* Update MassTransit configurations and remove unused code

The MassTransit setup in Elsa.MassTransit module has been simplified by removing conditional code for different .NET versions. Additionally, unused parameter '__X_Channel' in 'DispatchWorkflowDefinition' was removed. Lastly, the MassTransit broker in Elsa.Server.Web was switched from RabbitMq to AzureServiceBus.

* Refactor dispatch workflow classes and methods

Simplified the class, method and variable names related to workflow dispatching in the Elsa.Workflows.Runtime module. For example, the 'WorkflowDispatcherChannelDescriptor' class was renamed to 'DispatcherChannel'. This refactoring was performed to make code more readable and maintainable by removing redundant wording in the naming convention.

* Update GitHub Workflow to support feature and issue branches

The workflow changes add support for feature and issue branches. Now, it extracts the branch name and verifies the commit exists in the given branch rather than just 'main'. The versioning scheme is also modified to include the branch name and not just the run number.

* Add 'bug/*' to triggering branches in packages workflow

The 'bug/*' pattern was missing from the triggers that initiate the GitHub actions within our packages workflow. This update includes any branch with a 'bug/' prefix to the list, allowing bug-related branches to start jobs in our CI/CD pipeline.

* Remove 'issue/*' and 'bug/*' branches from packages workflow

The 'issue/*' and 'bug/*' branches have been removed from the GitHub action workflow for packages. This change was made to simplify the workflow and optimize the triggering of package building.

* Update GitHub workflow to handle main branch versioning

This commit modifies the GitHub workflow script to accommodate changes when the branch name is "main." If the branch name is "main", a preview version is used. It also updates script execution to print the branch name for easier debugging and verifies commit existence on the correct branch instead of dispatch channels.

* Enclose branch names in quotes in packages.yml

The update modifies the branch names in the packages.yml GitHub Actions workflow file. The change consists of enclosing the branch names 'main' and 'feature/*' in single quotes, ensuring compatibility and preventing potential string interpretation issues.

* Update GitHub workflows package configuration

The workflows package configuration has been updated to specifically watch for changes on 'feature/dispatch-channels' rather than on all feature branches. This change will prevent unnecessary builds on less relevant feature branches.

* Update trigger branches in packages workflow

The triggering branches in the packages workflow have been updated. Previously, only changes in the 'main' and 'feature/dispatch-channels' would trigger the workflow, now any 'feature/*' branch will. This will cause more frequent and comprehensive testing.

* Add 'patch/*' to workflow trigger branches

This update adds 'patch/*' to the list of branches in .github/workflows/packages.yml that can trigger the workflow. It will allow the workflow to be initiated not just for main and feature branches, but also for patches.

* Add 'preview/*' to workflow triggers

This commit adds a new trigger for the GitHub Actions workflow. It now also responds to push events on 'preview/*' branches, allowing for automated testing and building of these preview branches.

* Update branch name extraction in GitHub Actions

The extraction of the branch name has been slightly modified in the packages.yml GitHub workflow file. This alteration ensures the correct branch name is obtained for further processing within the workflow without any discrepancy.

* Update branch name extraction in packages.yml

Corrected the syntax for extracting the branch name within the packages.yml github workflow file. Added an extra line to print out the ref which might be useful for debugging.

* Update branch name extraction in GitHub workflow

The commit simplifies the way the branch name is being extracted from the GitHub ref in the packages.yml workflow file. The new method employs straightforward string manipulation, making it easier to understand and debug in case of potential issues.

* Add extraction of branch name in workflow

Added a new line in the GitHub workflow file (.github/workflows/packages.yml) to extract the last part after the final slash from the branch name. This enhancement allows cleaner naming conventions, especially in cases where branches are named feature/issue-123, as it will only retain 'issue-123'.

* Update package naming in Github workflow

The Github workflow has been updated to handle package naming more effectively. Previously, the branch name was used directly for package versioning. Now, the last part of the branch name is extracted and used as the package prefix. If the branch name is "main", the package prefix is set to "preview".

* Move and add environment variable assignments

The placement of the assignment for BRANCH_NAME environment variable was moved for better readability. Additionally, the PACKAGE_PREFIX environment variable was also added. These environment variables are crucial for subsequent steps in the GitHub workflow.

* Add workflow dispatch validation and response handling

Removed several specific dispatch response classes and consolidated all types of dispatch responses into a single DispatchWorkflowResponse class. Added a new ValidatingWorkflowDispatcher service to validate dispatch requests before they're sent. Updated several classes to work with these changes, including the BackgroundWorkflowDispatcher, MassTransitWorkflowDispatcher, and the API endpoint class.

* Handle dispatch workflow failures with exceptions

The DispatchWorkflow and BulkDispatchWorkflows activities now throw a FaultException when the dispatch operations fail. Previously, these operations were not checking for success and could fail silently. Now, an unsuccessful dispatch response results in a FaultException with an error message from the dispatch response.
2024-02-16 10:56:30 +01:00
Sipke Schoorstra ff7c5dce1e Refine package building workflow in GitHub Actions
The updates in this commit refine the way branch names and package prefixes are determined in the GitHub workflow for package building. Moreover, the workflow now recognizes and supports additional branch patterns, including 'patch/*' and 'preview/*', extending the existing support for 'main' and 'feature/*' branches.
2024-02-14 18:35:38 +01:00
Sipke Schoorstra 67feaab876 Enclose branch names in quotes in packages.yml
The commit message updates the branch names in the packages.yml GitHub workflows file by enclosing them in single quotes. The change is done on both 'main' and 'feature/*' branches.
2024-02-14 18:13:51 +01:00
Sipke Schoorstra 68b26576a3 Update branch name handling in GitHub workflow
This update modifies the GitHub packages workflow. 'issue/*' and 'bug/*' branches were removed from the workflow trigger, and branch name handling logic updated. Now, if the branch name is 'main', the version is labeled as 'preview'. Otherwise, the branch name is used.
2024-02-14 18:09:39 +01:00
Sipke Schoorstra ceee982198 Update GitHub workflow for better branch handling
This update modifies the GitHub workflow in packages.yml for improved branch name extraction and more accurate commit verification. It provides more feedback by outputting the extracted branch name, and checks for commits in the specific branch rather than in 'origin/dispatch-channels'.
2024-02-14 18:06:51 +01:00
Sipke Schoorstra 2f05eae1d5 Update GitHub action for branch-specific workflows
Expanded GitHub action to now trigger on push events for feature/*, issue/*, and bug/* branches. The workflow has been modified to fetch the name of the current working branch, check if the commit exists on that branch, and append it to version number. This will effectively allow isolated workflows for each specific branch.
2024-02-14 18:03:31 +01:00
Sipke Schoorstra 8b290ffc53 Add 'From' methods and mark 'Get' methods as obsolete
Added 'From' and 'From<T>' methods to the 'OutputProxy' class, which retrieve the value of a specified output from a certain activity. The pre-existing 'Get' methods, serving a similar function, have been marked as obsolete and updated to use the new 'From' methods.
2024-02-14 11:39:47 +01:00
Sipke Schoorstra eeb8aefa3e Add Postgres service to docker-compose file
A new Postgres service has been added to the docker-compose file, with its respective environmental variables and volume. This service uses postgres:13.3-alpine image and is accessible via the port 5432.
2024-02-14 11:39:29 +01:00
Sipke Schoorstra c0e8eaf45c Optimize output retrieval by activityId and activityInstanceId
Modified `ActivityOutputRegister.cs` to utilize `LastOrDefault` instead of `FirstOrDefault` for retrieving the latest output by activityId or activityInstanceId. Now, in `ActivityExtensions.cs`, it differentiates between the output retrieval method based on whether the current activity context is identical to the requested one.
2024-02-12 21:00:00 +01:00
Sipke Schoorstra 4bb1c846a9 Refactor GetOutput method in ActivityExtensions
The GetOutput method was extracted from the execution contexts to ensure more precise and isolated functionality. It was simplified and redefined in three contexts which are: the ActivityExecutionContext, the WorkflowExecutionContext, and the ExpressionExecutionContext. This will enhance maintainability and readability of the code.
2024-02-12 20:49:44 +01:00
Sipke Schoorstra a6783256f4 Update expression serialization and deserialization
Refined the expression serialization context and its deserialization method for more extensive usage. Also, simplified the handling of value retrieval in the DefaultExpressionDescriptorProvider. This allows greater control over serialization processes and makes the code more concise.
2024-02-12 19:26:00 +01:00
Sipke Schoorstra 4e78aab800 Remove version number from Elsa.Environments project file
The version number was removed from the Elsa.Environments.csproj file. This was unnecessary because the version number is now handled elsewhere, reducing redundancy and maintenance.
2024-02-12 19:11:18 +01:00
Sipke Schoorstra d62c495b65 Change default value retrieval to use ToString method
The change was made in the DefaultExpressionDescriptorProvider.cs under Elsa.Workflows.Management. Instead of relying on the GetString method, the updated code now uses the ToString method for default value retrieval. This change improves how we process and retrieve default values in unspecified cases.
2024-02-12 18:57:02 +01:00
Sipke Schoorstra 3bad8a5b1b
Improve Elsa workflow expression serialization (#4930)
* Improve Elsa workflow expression serialization

Added serialization support for expressions in Elsa workflows, enabling serialization and deserialization to maintain consistent types across sessions. Updated relevant test cases for validation.

* Remove PR workflow from GitHub actions

The PR workflow has been removed from GitHub actions.
2024-02-12 18:47:25 +01:00
Sipke Schoorstra fa32e00bce Update JSON in integration test for polymorphism
The JSON data file used in the integration tests for serialization polymorphism has been updated. Specifically, the namespace for CustomDictionary in the type metadata section has been changed to match with its current location.
2024-02-11 19:02:35 +01:00
Béchir BEN AMEUR 3167ae1fc8
issues(4918): fix resolve scoped service for Elsa.MongoDb.Modules (#4924)
* issues(4918): fix resolve scoped service for Elsa.MongoDb.Modules

issues(4918): scope service by instance CreateIndices

* issues(4918): fix review, service scope as local var to be cleany disposed

---------

Co-authored-by: BEN AMEUR <Bechir.BEN-AMEUR.ext@sodexo.com>
2024-02-09 22:49:45 +01:00
Sipke Schoorstra 2448d5eabd
Fix serialization of Boolean activity input (#4922)
* Improve InputJsonConverter handling and trimming suppression

A new switch case block has been added for better handling of different types of JsonValueKind in InputJsonConverter. Also, a suppression message for the IL2026 trimming warning has been included to prevent potential runtime issues caused by code trimming, although justifications for this suppression are still pending.

* Add UIHint to While activity's Condition input

The Condition input in the While activity in Elsa.Workflows.Core has been updated to also include a UIHint. This aims to improve user input by specifically defining it as a SingleLine type.
2024-02-09 19:42:03 +01:00
Mohamed Ali 796438c51b
update AppAny package version and fix MySql and SqlServer migration for Quartz (#4921) 2024-02-09 19:38:43 +01:00
Sipke Schoorstra 60a349c8eb
Fix WorkflowExecutionContext bug (#4919)
* Rename Elsa.IntegrationTests to Elsa.Workflows.IntegrationTests

* Include missed files

* Update WorkflowExecutionContext to assign Activities

This commit updates the constructor of WorkflowExecutionContext. It adds a loop that iterates through each activityExecutionContext and associates its Activity with a corresponding one in the NodeIdLookup by using its NodeId as the key.

* Add versionOptions parameter to RunWorkflowUntilEndAsync method

This update introduces the versionOptions parameter to the RunWorkflowUntilEndAsync method, giving the user control over the version of the workflow they want to run. If no options are provided, the method defaults to running the published version.

* Add new integration tests and workflow samples

Created new integration test projects, Elsa.Alterations.IntegrationTests and Elsa.Workflows.IntegrationTests, for added functionality verification. Also added new workflow sample files "alteration-test.json" and "alteration-test.-v2.json" to "samples/aspnet/ElsaAlterationMigrateBug/Workflows" for testing purposes.

* Remove ElsaAlterationMigrateBug sample

This commit removes the ElsaAlterationMigrateBug sample from the project. The sample is no longer needed and its related files including workflows and project references have been deleted from the solution. This removal helps streamline the solution and remove unnecessary clutter.

* Update comment in MigrationTests.cs

The comments in the MigrationTests.cs file have been revised to provide a more accurate description of what happens in the code. The migration process described does not involve resetting execution, so any reference to it was removed.

* Refactor MigrationTests class summary description

The summary description of the MigrationTests class has been revised. The verb 'Represents' was removed to make the comment more concise and straightforward, focusing solely on its functional aspect.

* Update MigrationTests class constructor comments

The summary comments for the MigrationTests class constructor were corrected. Previously, it indicated that it represented a class containing tests for migration, which was inaccurate. It now properly describes that it initializes a new instance of the MigrationTests class.
2024-02-09 19:37:37 +01:00
platschlena 4fe04469ec
catching the exception preventing the server from starting successfully when an incorrect cron format is entered (#4917)
Co-authored-by: Lena Pletschacher <lp@nuvotex.de>
2024-02-09 19:37:06 +01:00
Sipke Schoorstra d4e1cf0985
Fix consumption of event payload (#4909)
The 'input' parameter in 'PublishAsync', 'DispatchAsync' and related methods across multiple classes has been replaced with 'payload'. The renaming of 'input' to 'payload' provides a more intuitive understanding of the parameter as the actual content or data of the event being published or dispatched. It also includes changes in 'PublishInternalAsync' where the workflow input dictionary is now being populated with the payload.
2024-02-09 08:20:54 +01:00
Sipke Schoorstra cfb6fa532b
Update script source path in _Host.cshtml (#4910)
The script source paths in both "Elsa.Studio.Web" and "Elsa.ServerAndStudio.Web" _Host.cshtml files have been modified to use the defined base path. This change is necessary for correctly loading the "blazor.webassembly.js" script from the appropriate directory.
2024-02-08 21:39:09 +01:00
Sipke Schoorstra ae3664a5d8 Add contributing guide to README.md
This update adds a comprehensive guide to the README file detailing the steps for interested individuals to contribute to the Elsa Workflow project. The guide covers everything from forking and cloning the repository, to understanding the structure of the solution, submitting changes via a pull request, and the importance of opening an issue first for discussing intended changes.
2024-02-08 18:42:55 +01:00
raymonddenhaan 1f402ab84c
Merge pull request #4900 from elsa-workflows/issue(4884)
Fix memory leak when using EF Core
2024-02-08 08:20:25 +01:00
Sipke Schoorstra decb5d898c Optimize BuildContainsExpression method performance
Converted the result of the Select() operation to a list, within the BuildContainsExpression method. This prevents multiple enumerations of the 'entities' variable, improving the performance of the method by reducing the number of iterations.
2024-02-08 00:04:45 +01:00
Sipke Schoorstra d878314dbf Add dependency workflows publishing tests
This commit introduces a new integration test for the "DependencyWorkflowsPublishing" scenario. It also adds two new JSON files, "child.json" and "parent.json" to simulate the child and parent workflows accordingly. Updates are also made to the 'Elsa.IntegrationTests.csproj' and 'ServiceProviderExtensions.cs' as a part of testing setup.
2024-02-07 23:22:54 +01:00
Sipke Schoorstra cfac318d7c Update WorkflowDefinitionManager to handle dependencies
This update modifies how WorkflowDefinitionManager fetches and handles workflow definitions. It now considers both the latest and published workflow definitions rather than only the published ones. It also removes the dependency id from the list of workflows to consider. A redundant workflow validator from the WorkflowDefinitionPublisher is also removed.
2024-02-07 23:22:54 +01:00
BEN AMEUR e64a2eaa17 issues(4893): try register serializer or skip when already registred 8d23d6
issues(4893): try register serializer or skip when already registred  + clean
2024-02-07 13:45:40 +01:00
Sipke Schoorstra 8d23d695df Remove redundant input addition in workflows
The code change deletes the line where the messageInput is added to the Inputs list of the builder in the `Workflows.cs` file, since this operation is redundant. The input is automatically added during its creation and doesn't need an explicit addition, thus improving code efficiency.
2024-02-06 08:45:54 +01:00
Sipke Schoorstra fa44259cd1 Add serialization tests and refactor serialization classes
Implemented new integration tests for serialization of programmatic workflows. Additionally, major refactoring was performed on the serialization classes. This involved moving the classes to new namespaces and enhancing their functionalities to correctly handle null inputs and to support the serialization of activities and expressions. Also, updated Elsa.sln.DotSettings and JsonActivitySerializer to handle new serializers.
2024-02-06 08:45:54 +01:00
BEN AMEUR f71b8c3b1c issues(4885) 2024-02-05 23:39:37 +01:00
Sipke Schoorstra fb2f0f0271
Update InputJsonConverter to deserialize complex value types into their original type (#4878)
* Remove unused using directives in test classes

The using directives for System, System.Collections.Generic, System.IO, and others were not necessary in many of the test classes. These unused directives have been removed to enhance code readability and maintainability.

* Update source port retrieval in ConnectionJsonConverter

The source port retrieval code in ConnectionJsonConverter.cs has been updated. It now uses TryGetProperty instead of GetProperty, enabling it to handle cases where the "port" property may not exist. This enhances error handling and resilience in the activities module.

* Refactor InputJsonConverter for proper variable expressions handling

The InputJsonConverter in the Elsa.Workflows.Serialization has been expanded for efficient handling of variable expressions during the JSON conversion process. The refactor ensures appropriate extraction and assignment of values to variables. This adds robustness to the serialization process, maintaining variable types after serialization.

* Add tests for variable expressions serialization

A new `Tests.cs` file has been added under the `Elsa.IntegrationTests/Serialization/VariableExpressions` directory. This file contains tests for ensuring the serialization of variable expressions works correctly. A corresponding `SampleWorkflow` file has also been established, providing the workflows to be used in the tests.

* Refactor workflow builder extension class

The WorkflowDefinitionBuilderExtensions class has been deleted and replaced with WorkflowBuilderExtensions in Elsa.Workflows.Core. This new class retains similar functionality but includes more detailed comments and dynamic member access capabilities in its method definition.
2024-02-05 21:39:49 +01:00
Sipke Schoorstra d511b04cee Add fluent methods for input handling in workflow builder
Updated the WorkflowBuilder and its interface, IWorkflowBuilder, to include a series of fluent methods for handling inputs. These methods allow easier set up and addition of input definitions to workflows. An extension method to get input names was also added to the ExpressionExecutionContextExtensions.
2024-02-05 21:38:36 +01:00
Sipke Schoorstra ef1d736184
Merge pull request #4881 from elsa-workflows/cleanup(workflow-runtime-api)
Make workflow runtime methods accept nullable options
2024-02-05 07:48:55 +01:00
Sipke Schoorstra 3a4f690a3e Make workflow runtime methods accept nullable options
The methods in the workflow runtime now accept nullable runtime options. Providing workflow options is now optional - if no options are provided, default values are used. Changes have been applied across all relevant methods in IWorkflowRuntime, ProtoActorWorkflowRuntime and DefaultWorkflowRuntime classes, thus ensuring consistent behavior and null safety across the workflow runtime.
2024-02-04 22:15:02 +01:00
Sipke Schoorstra 06e93c13e2
Merge pull request #4844 from Nokecy/patch-2
update sqlserver Extensions support UseCompatibilityLevel cofnig
2024-02-04 15:36:11 +01:00
Sipke Schoorstra 45a2984baf
Merge pull request #4877 from lahma/cpm
Convert to use Central Package Management
2024-02-04 15:27:28 +01:00
Marko Lahma bc3d6d9bbc Convert to use Central Package Management
* Add GitHubActionsTestLogger
2024-02-04 13:49:54 +02:00
Sipke Schoorstra f1b85a1205
Merge pull request #4876 from elsa-workflows/issue(4875)
Add GZip compression for WorkflowInstance Data field on EF Core
2024-02-04 12:19:56 +01:00
Sipke Schoorstra 611c72fa26 Implement Zstd compression and update related components
Removed ICompressionStrategyResolver interface and file, and added ICompressionCodec and ICompressionCodecResolver interface. Updated relevant classes for the new interface. Specifically, added Zstd class under Compression as a new compression method. Also modified WorkflowInstanceStore.cs, None.cs, EFCoreWorkflowInstanceStore.cs, GZip.cs, and ActivityExecutionLogStore.cs for uniform compression terminology.
2024-02-04 12:18:55 +01:00
Sipke Schoorstra 9c7f65117a Fix typo in Obsolete attribute message
The typo in the Obsolete attribute message of the ActivityState field has been corrected. "USe" has been changed to "Use" in the suggestion to use ActivityInstanceId instead to locate activity state from ActivityExecutionLog.
2024-02-04 10:47:03 +01:00
Sipke Schoorstra 5c86a88d56 Remove usage of StoreBasedApplicationProvider
This commit removes the use of StoreBasedApplicationProvider from the identity setup in Elsa.Server.Web Program.cs.
2024-02-04 10:47:03 +01:00
Sipke Schoorstra 143b1b8364 Refactor logging to exclude activity state
Logging throughout the application, specifically in ActivityExecutionContextExtensions.cs, SendEmail.cs, and more, has been refactored to exclude activity state from log entries. There have also been updates to other files, such as introducing JetBrains.Annotations and modifying certain methods. Additionally, the IHttpMessageHandlerProvider.cs file has been removed.
2024-02-04 10:47:03 +01:00
Sipke Schoorstra 0bc46d3f74 Remove migration files for Management module
Deleted all migration files related to the Management module across MySql, SqlServer, Sqlite and PostgreSql data providers. These files included data compression algorithm and data format column additions in the WorkflowInstances table.
2024-02-04 01:24:03 +01:00