Repository navigation
feat(dotnet): add F# script execution support - #460
GauriKhedekar wants to merge 4 commits into
Conversation
|
@GauriKhedekar Could you take example on C# for the task names please? You're supposed to have Script, Commands, ScriptTrigger and CommandsTrigger, thanks. |
Thanks! I currently added the dedicated FSharp task, but I understand that the F# support should follow the same task structure as the existing C# implementation with Script, Commands, ScriptTrigger, and CommandsTrigger. I'll update the F# implementation accordingly. |
Just to confirm the expected structure before I make the changes: should F# be added as a separate fsharp package/module with the four task names Script, Commands, ScriptTrigger, and CommandsTrigger, while keeping the existing C# classes unchanged? Also, should the plugin metadata remain combined as .NET (C# and F#), or should F# have separate plugin metadata? |
|
Yes, your understanding is right. Please add F# as a separate For metadata, give F# its own Since
Example for the alias (same on package io.kestra.plugin.scripts.csharp;
@Plugin(
examples = { /* ... */ },
aliases = "io.kestra.plugin.scripts.dotnet.Script"
)
public class Script extends AbstractExecScript implements RunnableTask<ScriptOutput> {
// ...
}A flow using Thanks! |
jymaire
left a comment
There was a problem hiding this comment.
Thanks a lot for this contribution @GauriKhedekar, and for the thorough QA notes and tests (the four FSharpTest cases pass in CI).
The package restructuring that @fdelbrayelle described above (io.kestra.plugin.scripts.fsharp with Script, Commands, ScriptTrigger, CommandsTrigger, the C# move to io.kestra.plugin.scripts.csharp with aliases, and a shared base class) is the main change needed, so I won't repeat it here. Apart from that, the dotnet fsi invocation, .fsx temp file handling, default image and outputs match the existing C# Script task well.
Two smaller points to carry into the rework:
- [MEDIUM] The plugin doc page currently mixes F# into the C#
Scriptsection. - [LOW] The F# task lacks the output-files example that the C#
Scripthas.
What changes are being made and why?
This PR adds native F# script support to the existing
plugin-script-dotnetmodule and restructures the public package layout so that C# and F# are exposed as separate packages.The existing Gradle module remains
plugin-script-dotnet, and the module/catalog title is now.NET (C# and F#).The new public language packages are:
C# package
The existing C# implementation has been moved from
io.kestra.plugin.scripts.dotnettoio.kestra.plugin.scripts.csharp, with:io.kestra.plugin.scripts.csharp.Scriptio.kestra.plugin.scripts.csharp.Commandsio.kestra.plugin.scripts.csharp.ScriptTriggerio.kestra.plugin.scripts.csharp.CommandsTriggerA dedicated C#
package-info.javawas added with the package titleC#.F# package
A new dedicated
io.kestra.plugin.scripts.fsharppackage was added with:io.kestra.plugin.scripts.fsharp.Scriptio.kestra.plugin.scripts.fsharp.Commandsio.kestra.plugin.scripts.fsharp.ScriptTriggerio.kestra.plugin.scripts.fsharp.CommandsTriggerA dedicated F#
package-info.javawas added with the package titleF#.The temporary
io.kestra.plugin.scripts.dotnet.FSharptask has been removed and replaced by these four F# task types.F#
Scriptexecutes.fsxfiles usingdotnet fsiand supports inline scripts, NuGet#rreferences, input/output files,beforeCommands, custom container images, task runners, and workflow variables.Shared implementation
Shared .NET functionality was extracted into:
These common classes provide shared behavior for C# and F#, including:
The language-specific implementations reuse these shared base classes instead of duplicating the common logic.
Backward compatibility
The new C# classes expose aliases for the previous C# task names so existing workflows continue to work:
A
BackwardCompatibilityTestwas added to deserialize a flow using the oldio.kestra.plugin.scripts.dotnet.Scripttype and verify that it resolves to the new C# implementation.The old
.dotnet.*names are retained only for compatibility; the canonical public classes and documentation use thecsharpandfsharppackages.Metadata and catalog
The existing
plugin-script-dotnetmodule metadata was updated from C#-only wording to.NET (C# and F#).Separate metadata entries were added for:
with package titles
C#andF#.Each package has its own
package-info.java, allowing separate catalog/documentation entries while remaining inside the existing.NETmodule.Documentation
The previous combined
.NETdocumentation was split into:The C# page remains focused on the existing C# implementation and uses the new
csharppackage names.The F# page documents:
ScriptCommandsScriptTriggerCommandsTrigger.fsxexecution withdotnet fsi#r "nuget:PackageName,Version"referencesThe general
.NETdocumentation page now explains the C# and F# package structure and links to the language-specific pages.The outdated
io.kestra.plugin.scripts.dotnet.mdpage was removed.The unrelated bullet-style change in the old C# documentation was reverted so the documentation diff stays focused.
Icons
The existing module-level icons remain unchanged:
The C# package has:
The existing C# artwork is retained for the C# package.
The F# package has:
The F# icon was replaced with an actual F# logo so the new F# package is visually distinct from the C# package.
Thus the existing
.NETmodule resources remain intact while the new language packages have package-specific icons.Tests and test restructuring
The existing C# tests were moved to the new
csharppackage and updated to use the new canonical task types.New F# tests mirror the C# coverage, including:
The existing trigger/edge-state tests were updated to use the shared .NET trigger implementation.
A dedicated backward-compatibility test was added for the old C# task name.
Sanity checks
The
all_dotnet.yamlsanity-check flow was updated to use the new canonical C# package:The Linux target OS is explicitly configured for the Docker-based sanity checks.
AGENTS.md
AGENTS.mdwas updated so the plugin inventory lists the new canonical public packages:The old
.dotnet.*names are no longer listed there as the canonical classes. They remain only in the compatibility aliases and compatibility test.How the changes have been QAed?
QA was performed locally using Kestra
v2.0.4and the finalplugin-script-dotnetJAR built from this branch.Full plugin test suite
Result:
Documentation lint
Result:
Diff validation
No whitespace errors were reported.
Local Kestra UI verification
The final plugin JAR was built and loaded into a local Kestra
v2.0.4instance.The plugin catalog was verified to show:
with 8 tasks:
The final JAR was used for the functional UI checks below.
F# Hello World
Result: successful execution with
Hello from F# and Kestra!in the task logs.F# NuGet dependency
Result: successful execution using the restored NuGet dependency and expected JSON output.
F# output files
Result: successful execution; the log contained
Created hello.txt successfully.and the persisted task output contained thehello.txtkey.C# backward compatibility
Result: successful execution with
Hello from old C# type!, confirming the old type resolves to the new C# implementation.Screenshots — package/task catalog verification
Before Implementing F# :-
After Implementing F#:-
These 8 screenshots demonstrate the four C# and four F# task types in the final catalog.
1. C#
ScriptShows the C# inline
.csxscript task under the newcsharppackage.2. C#
CommandsShows the C# command execution task under the new
csharppackage.3. C#
ScriptTriggerShows the C# script trigger under the new
csharppackage.4. C#
CommandsTriggerShows the C# commands trigger under the new
csharppackage.5. F#
ScriptShows the new F# inline
.fsxscript task and itsdotnet fsidocumentation.6. F#
CommandsShows the F# command execution task under the new
fsharppackage.7. F#
ScriptTriggerShows the F# script trigger under the new
fsharppackage.8. F#
CommandsTriggerShows the F# commands trigger under the new
fsharppackage.Screenshots — functional QA
1. F# Hello World
The final JAR was tested in the local Kestra UI with:
The task completed successfully and produced
Hello from F# and Kestra!in the logs.2. F# NuGet dependency
The final JAR was tested with an F#
#rNuGet directive:The dependency was restored successfully and the script produced the expected JSON output.
3. F# output files
The final JAR was tested with:
The task completed successfully, the log contained
Created hello.txt successfully., and the task output contained the persistedhello.txtkey.4. C# backward compatibility
Backward compatibility was verified using the old public type:
The old type executed successfully and produced
Hello from old C# type!, confirming the alias resolves the old.dotnet.Scriptname to the newcsharp.Scriptimplementation.Final package layout
The resulting package structure is:
The existing module remains:
with the module/catalog title:
Existing C# flows using the old
io.kestra.plugin.scripts.dotnet.*names remain supported through aliases.Setup Instructions
No external API keys, accounts, or third-party services are required for the F# task itself.
For local QA:
v2.0.4instance..NET (C# and F#)catalog entry and all 8 language tasks.io.kestra.plugin.scripts.dotnet.Scriptcompatibility flow.Contributor Checklist ✅
io.kestra.plugin.scripts.fsharp.Script,Commands,ScriptTrigger, andCommandsTrigger.io.kestra.plugin.scripts.csharp..dotnet.*type names remain supported through aliases.package-info.javafiles.io.kestra.plugin.scripts.dotnet.mddocumentation page was removed.plugin-script-dotnettest suite passes: 69/69.git diff --cached --check.v2.0.4..NET (C# and F#)catalog entry and all 8 language tasks were verified in the Kestra UI.AGENTS.mdwas updated to list the new canonical C# and F# packages.Closes kestra-io/kestra#12742