diff --git a/.github/workflows/environment.yaml b/.github/workflows/environment.yaml
index fbc4ef5a..3e49e806 100644
--- a/.github/workflows/environment.yaml
+++ b/.github/workflows/environment.yaml
@@ -267,3 +267,24 @@ jobs:
with:
command: run
profile: tensorflow-serving
+ dotnet8:
+ runs-on: ubuntu-latest
+ needs: check
+ if: contains(needs.check.outputs.packages, 'dotnet8')
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v4
+ - name: Setup Fission Environment
+ uses: ./.github/actions/setup-cluster
+ - name: Fission and Test images
+ run: |
+ SKAFFOLD_PROFILE=dotnet8 make skaffold-run
+ make dotnet8-test-images
+ make router-port-forward
+ - name: dotnet8-tests
+ run: ./test_utils/run_test.sh ./dotnet8/tests/test_dotnet8_env.sh
+ - name: Collect Fission Dump
+ uses: ./.github/actions/collect-fission-dump
+ if: ${{ failure() }}
+ with:
+ workflow-name: dotnet8
diff --git a/.github/workflows/filters/filters.yaml b/.github/workflows/filters/filters.yaml
index f0698f8b..a73ed8f3 100644
--- a/.github/workflows/filters/filters.yaml
+++ b/.github/workflows/filters/filters.yaml
@@ -8,6 +8,8 @@ dotnet:
- 'dotnet/**'
dotnet20:
- 'dotnet20/**'
+dotnet8:
+ - 'dotnet8/**'
go:
- 'go/**'
jvm:
diff --git a/.github/workflows/filters/version_filter.yaml b/.github/workflows/filters/version_filter.yaml
index 5a94c4d7..fe0a9678 100644
--- a/.github/workflows/filters/version_filter.yaml
+++ b/.github/workflows/filters/version_filter.yaml
@@ -8,6 +8,8 @@ dotnet:
- 'dotnet/envconfig.json'
dotnet20:
- 'dotnet20/envconfig.json'
+dotnet8:
+ - 'dotnet8/envconfig.json'
go:
- 'go/envconfig.json'
jvm:
diff --git a/Makefile b/Makefile
index bcfa381a..4571f810 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ FISSION_ENVS := nodejs-envs \
binary-envs \
tensorflow-serving-envs \
dotnet20-envs \
+ dotnet8-envs \
ruby-envs
all: $(FISSION_ENVS)
@@ -91,5 +92,9 @@ python-fastapi-test-images:
@kind load docker-image python-fastapi-env
@kind load docker-image python-fastapi-builder
+dotnet8-test-images:
+ @kind load docker-image dotnet8-env
+ @kind load docker-image dotnet8-builder
+
router-port-forward:
@kubectl port-forward svc/router 8888:80 -nfission &
diff --git a/dotnet8/.gitignore b/dotnet8/.gitignore
new file mode 100644
index 00000000..40c6316f
--- /dev/null
+++ b/dotnet8/.gitignore
@@ -0,0 +1,60 @@
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio cache/options directory
+.vs/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# Files built by Visual Studio
+*.user
+*.userosscache
+*.sln.docstates
+
+# Build results
+*.dll
+*.exe
+*.pdb
+*.cache
+*.log
+
+# NuGet Packages
+*.nupkg
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Example ZIP files (for testing)
+examples/**/*.zip
+
+# macOS
+.DS_Store
\ No newline at end of file
diff --git a/dotnet8/Dockerfile b/dotnet8/Dockerfile
new file mode 100644
index 00000000..5f52f1c5
--- /dev/null
+++ b/dotnet8/Dockerfile
@@ -0,0 +1,32 @@
+# Use the .NET 8 SDK image for runtime (needed for compilation support)
+FROM mcr.microsoft.com/dotnet/sdk:8.0
+
+# Install required tools
+RUN apt-get update && apt-get install -y unzip curl && rm -rf /var/lib/apt/lists/*
+
+# Set working directory
+WORKDIR /app
+
+# Copy the Fission .NET runtime application
+COPY Fission.DotNet/ /app/Fission.DotNet/
+COPY Fission.DotNet.Common/ /app/Fission.DotNet.Common/
+
+# Build the runtime application
+RUN dotnet restore Fission.DotNet/Fission.DotNet.csproj
+RUN dotnet publish Fission.DotNet/Fission.DotNet.csproj -c Release -o /app/publish
+
+# Build and copy Fission.DotNet.Common.dll to /app for runtime compilation
+RUN dotnet build Fission.DotNet.Common/Fission.DotNet.Common.csproj -c Release -o /app/
+
+# Create function directory
+RUN mkdir -p /function
+
+# Set environment variables
+ENV ASPNETCORE_URLS=http://*:8888
+ENV ASPNETCORE_ENVIRONMENT=Production
+
+# Expose port
+EXPOSE 8888
+
+# Start the runtime
+CMD ["dotnet", "/app/publish/Fission.DotNet.dll"]
diff --git a/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj b/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj
new file mode 100644
index 00000000..0ffdcef5
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj
@@ -0,0 +1,26 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+ Fission.DotNet.Common
+ 1.1.0
+ Lorenzo Caldon
+ Fission dotnet environment common package
+ GPL-3.0-or-later
+ https://github.com/lcsoft77/fission-env-dotnet8
+ ./nupkg
+
+
+
+ README.md
+
+
+
+
+
+
diff --git a/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.sln b/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.sln
new file mode 100644
index 00000000..7ea97c8d
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.sln
@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.2.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fission.DotNet.Common", "Fission.DotNet.Common.csproj", "{66CA3524-4798-6315-18DF-47CD0B936395}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {66CA3524-4798-6315-18DF-47CD0B936395}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {66CA3524-4798-6315-18DF-47CD0B936395}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {66CA3524-4798-6315-18DF-47CD0B936395}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {66CA3524-4798-6315-18DF-47CD0B936395}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AF6A70F1-84DB-4983-A581-08BC54DF98A5}
+ EndGlobalSection
+EndGlobal
diff --git a/dotnet8/Fission.DotNet.Common/FissionContext.cs b/dotnet8/Fission.DotNet.Common/FissionContext.cs
new file mode 100644
index 00000000..be09f9fd
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/FissionContext.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+
+namespace Fission.DotNet.Common;
+
+public class FissionContext
+{
+ protected Stream _content;
+ protected Dictionary _arguments;
+ protected Dictionary _headers;
+ protected Dictionary _parameters;
+
+ public FissionContext(Stream body, Dictionary arguments, Dictionary headers, Dictionary parameters)
+ {
+ if (body == null) throw new ArgumentNullException(nameof(body));
+ if (arguments == null) throw new ArgumentNullException(nameof(arguments));
+ if (headers == null) throw new ArgumentNullException(nameof(headers));
+ if (parameters == null) throw new ArgumentNullException(nameof(parameters));
+
+ _content = body;
+ _arguments = arguments;
+ _headers = headers;
+ _parameters = parameters;
+ }
+
+ protected string GetHeaderValue(string key, string defaultValue = null)
+ {
+ return _headers.ContainsKey(key) ? _headers[key] : defaultValue;
+ }
+
+ public Dictionary Arguments => _arguments;
+ public Dictionary Parameters => _parameters;
+
+ public string TraceID => GetHeaderValue("traceparent", Guid.NewGuid().ToString());
+ public string FunctionName => GetHeaderValue("X-Fission-Function-Name");
+ public string Namespace => GetHeaderValue("X-Fission-Function-Namespace");
+ public string ResourceVersion => GetHeaderValue("X-Fission-Function-Resourceversion");
+ public string UID => GetHeaderValue("X-Fission-Function-Uid");
+ public string Trigger => GetHeaderValue("Source-Name");
+ public string ContentType => GetHeaderValue("Content-Type");
+ public Int32 ContentLength => GetHeaderValue("Content-Length") != null ? Int32.Parse(GetHeaderValue("Content-Length")) : 0;
+ public Stream Content => _content;
+
+ public async Task ContentAsString()
+ {
+ if (_content == null)
+ {
+ return null;
+ }
+
+ _content.Position = 0;
+ using (StreamReader reader = new StreamReader(_content, Encoding.UTF8, leaveOpen: true))
+ {
+ return await reader.ReadToEndAsync();
+ }
+ }
+
+ public async Task ContentAs(JsonSerializerOptions? options = null)
+ {
+ if (_content == null)
+ {
+ return default;
+ }
+
+ _content.Position = 0;
+ using (StreamReader reader = new StreamReader(_content, Encoding.UTF8, leaveOpen: true))
+ {
+ string content = await reader.ReadToEndAsync();
+ return JsonSerializer.Deserialize(content, options);
+ }
+ }
+}
diff --git a/dotnet8/Fission.DotNet.Common/FissionHttpContext.cs b/dotnet8/Fission.DotNet.Common/FissionHttpContext.cs
new file mode 100644
index 00000000..b9ef85ec
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/FissionHttpContext.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Text.Json;
+
+namespace Fission.DotNet.Common;
+
+public class FissionHttpContext : FissionContext
+{
+ private string _method;
+
+ public FissionHttpContext(Stream body, string method, Dictionary arguments, Dictionary headers, Dictionary parameters) : base(body, arguments, headers, parameters)
+ {
+ _method = method;
+ }
+
+ public Dictionary Headers => _headers;
+ public string Url
+ {
+ get
+ {
+ var urlHeader = GetHeaderValue("X-Fission-Full-Url");
+
+ if (urlHeader != null)
+ {
+ if (urlHeader.Contains("?"))
+ {
+ urlHeader = urlHeader.Substring(0, urlHeader.IndexOf("?"));
+ }
+
+ return urlHeader;
+ }
+ else
+ {
+ return "/";
+ }
+ }
+ }
+ public string Method => _method;
+ public string Host => GetHeaderValue("X-Forwarded-Host");
+ public int Port => _headers.ContainsKey("X-Forwarded-Port") ? Int32.Parse(GetHeaderValue("X-Forwarded-Port")) : 0;
+ public string UserAgent => GetHeaderValue("User-Agent");
+}
diff --git a/dotnet8/Fission.DotNet.Common/FissionMqContext.cs b/dotnet8/Fission.DotNet.Common/FissionMqContext.cs
new file mode 100644
index 00000000..5e5a7660
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/FissionMqContext.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace Fission.DotNet.Common;
+
+public class FissionMqContext : FissionContext
+{
+ public FissionMqContext(Stream body, Dictionary arguments, Dictionary headers, Dictionary parameters) : base(body, arguments, headers, parameters)
+ {
+
+ }
+
+ public string Topic => GetHeaderValue("Topic");
+ public string ErrorTopic => GetHeaderValue("Errortopic");
+ public string ResponseTopic => GetHeaderValue("Resptopic");
+}
diff --git a/dotnet8/Fission.DotNet.Common/ICorsPolicy.cs b/dotnet8/Fission.DotNet.Common/ICorsPolicy.cs
new file mode 100644
index 00000000..7f10a326
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/ICorsPolicy.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Fission.DotNet.Common
+{
+ public interface ICorsPolicy
+ {
+ void AllowAnyOrigin();
+ void AllowAnyHeader();
+ void AllowAnyMethod();
+ void AllowCredentials();
+
+ void WithOrigin(string[] origin);
+ void WithHeader(string[] header);
+ void WithMethod(string[] method);
+ }
+}
diff --git a/dotnet8/Fission.DotNet.Common/ILogger.cs b/dotnet8/Fission.DotNet.Common/ILogger.cs
new file mode 100644
index 00000000..0b58d4f8
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/ILogger.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace Fission.DotNet.Common
+{
+ public interface ILogger
+ {
+ void LogInformation(string message);
+ void LogDebug(string message);
+ void LogWarning(string message);
+ void LogError(string message);
+ void LogCritical(string message);
+ void LogError(string message, Exception exception);
+ }
+}
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/README.md b/dotnet8/Fission.DotNet.Common/README.md
new file mode 100644
index 00000000..973384fd
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/README.md
@@ -0,0 +1,46 @@
+# Fission.DotNet.Common
+
+This project is a common library for the .NET environment of [Fission](https://fission.io/), a serverless plugin for Kubernetes. The library provides common functionalities and utilities to facilitate the development of serverless functions with Fission on .NET.
+
+## Main Features
+
+- **Common Utilities**: Provides a set of common utilities to simplify the development of serverless functions.
+- **.NET 8 Compatibility**: Designed to work with **.NET 8 on Linux**, offering an updated and improved experience.
+- **Multi-Assembly Management**: Supports projects composed of multiple linked assemblies, simplifying the deployment and integration process.
+
+## Inspiration
+
+This project is inspired by the official Fission environment for .NET Core 2.0 but focuses on improvements and updates requested by the community, allowing developers to work with newer versions of the .NET framework and complex projects that include multiple assemblies.
+
+## Usage
+
+1. **Add the library to your project**:
+ Add the NuGet package `Fission.DotNet.Common` to your .NET project.
+
+ ```bash
+ dotnet add package Fission.DotNet.Common
+
+2. **Create the project**:
+- Create a **class library project** in .NET.
+- Add the NuGet package `Fission.DotNet.Common` to your project.
+- Create a class with the following function:
+
+ ```csharp
+ using Fission.DotNet.Common;
+
+ public class MyFunction
+ {
+ public object Execute(FissionContext input)
+ {
+ return "Hello World";
+ }
+ }
+ ```
+3. **Compression**: Compress the assemblies and related files into a ZIP file.
+
+4. **Deploy to Fission**: Use this library to deploy your project to Fission, leveraging the ability to manage multiple linked assemblies. After compressing your project into a ZIP file, you can create the function in Fission with the following command:
+
+ ```bash
+ fission fn create --name --env dotnet8 --code --entrypoint ::
+ ```
+ Replace `` with the name of your function and `` with the path to your ZIP file.
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.deps.json b/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.deps.json
new file mode 100644
index 00000000..43b6c3ad
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.deps.json
@@ -0,0 +1,23 @@
+{
+ "runtimeTarget": {
+ "name": ".NETCoreApp,Version=v8.0",
+ "signature": ""
+ },
+ "compilationOptions": {},
+ "targets": {
+ ".NETCoreApp,Version=v8.0": {
+ "Fission.DotNet.Common/1.1.0": {
+ "runtime": {
+ "Fission.DotNet.Common.dll": {}
+ }
+ }
+ }
+ },
+ "libraries": {
+ "Fission.DotNet.Common/1.1.0": {
+ "type": "project",
+ "serviceable": false,
+ "sha512": ""
+ }
+ }
+}
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.dll b/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.dll
new file mode 100644
index 00000000..3f79155d
Binary files /dev/null and b/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.dll differ
diff --git a/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.pdb b/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.pdb
new file mode 100644
index 00000000..ced88a76
Binary files /dev/null and b/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.pdb differ
diff --git a/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.dgspec.json b/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.dgspec.json
new file mode 100644
index 00000000..6fe1a6e6
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.dgspec.json
@@ -0,0 +1,66 @@
+{
+ "format": 1,
+ "restore": {
+ "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj": {}
+ },
+ "projects": {
+ "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj": {
+ "version": "1.1.0",
+ "restore": {
+ "projectUniqueName": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj",
+ "projectName": "Fission.DotNet.Common",
+ "projectPath": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj",
+ "packagesPath": "/Users/davidcasa/.nuget/packages/",
+ "outputPath": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/",
+ "projectStyle": "PackageReference",
+ "configFilePaths": [
+ "/Users/davidcasa/.nuget/NuGet/NuGet.Config"
+ ],
+ "originalTargetFrameworks": [
+ "net8.0"
+ ],
+ "sources": {
+ "https://api.nuget.org/v3/index.json": {}
+ },
+ "frameworks": {
+ "net8.0": {
+ "targetAlias": "net8.0",
+ "projectReferences": {}
+ }
+ },
+ "warningProperties": {
+ "warnAsError": [
+ "NU1605"
+ ]
+ },
+ "restoreAuditProperties": {
+ "enableAudit": "true",
+ "auditLevel": "low",
+ "auditMode": "direct"
+ }
+ },
+ "frameworks": {
+ "net8.0": {
+ "targetAlias": "net8.0",
+ "imports": [
+ "net461",
+ "net462",
+ "net47",
+ "net471",
+ "net472",
+ "net48",
+ "net481"
+ ],
+ "assetTargetFallback": true,
+ "warn": true,
+ "frameworkReferences": {
+ "Microsoft.NETCore.App": {
+ "privateAssets": "all"
+ }
+ },
+ "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.413/PortableRuntimeIdentifierGraph.json"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.props b/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.props
new file mode 100644
index 00000000..b6fc6c39
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.props
@@ -0,0 +1,15 @@
+
+
+
+ True
+ NuGet
+ $(MSBuildThisFileDirectory)project.assets.json
+ /Users/davidcasa/.nuget/packages/
+ /Users/davidcasa/.nuget/packages/
+ PackageReference
+ 6.11.1
+
+
+
+
+
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.targets b/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.targets
new file mode 100644
index 00000000..3dc06ef3
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.targets
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs
new file mode 100644
index 00000000..dca70aa4
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs
@@ -0,0 +1,4 @@
+//
+using System;
+using System.Reflection;
+[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfo.cs b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfo.cs
new file mode 100644
index 00000000..4a736849
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfo.cs
@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Reflection;
+
+[assembly: System.Reflection.AssemblyCompanyAttribute("Lorenzo Caldon")]
+[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
+[assembly: System.Reflection.AssemblyDescriptionAttribute("Fission dotnet environment common package")]
+[assembly: System.Reflection.AssemblyFileVersionAttribute("1.1.0.0")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.1.0+da8ab386daab96def321895f43b0f975caf774ca")]
+[assembly: System.Reflection.AssemblyProductAttribute("Fission.DotNet.Common")]
+[assembly: System.Reflection.AssemblyTitleAttribute("Fission.DotNet.Common")]
+[assembly: System.Reflection.AssemblyVersionAttribute("1.1.0.0")]
+[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/lcsoft77/fission-env-dotnet8")]
+
+// Generated by the MSBuild WriteCodeFragment class.
+
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfoInputs.cache b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfoInputs.cache
new file mode 100644
index 00000000..30df6806
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfoInputs.cache
@@ -0,0 +1 @@
+63b7bdec7d16ea8774fceb5335d6bcd9b1cb54c905159b91a92d392e27eb7b7b
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GeneratedMSBuildEditorConfig.editorconfig b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GeneratedMSBuildEditorConfig.editorconfig
new file mode 100644
index 00000000..ceffaad8
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GeneratedMSBuildEditorConfig.editorconfig
@@ -0,0 +1,13 @@
+is_global = true
+build_property.TargetFramework = net8.0
+build_property.TargetPlatformMinVersion =
+build_property.UsingMicrosoftNETSdkWeb =
+build_property.ProjectTypeGuids =
+build_property.InvariantGlobalization =
+build_property.PlatformNeutralAssembly =
+build_property.EnforceExtendedAnalyzerRules =
+build_property._SupportedPlatformList = Linux,macOS,Windows
+build_property.RootNamespace = Fission.DotNet.Common
+build_property.ProjectDir = /Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/
+build_property.EnableComHosting =
+build_property.EnableGeneratedComInterfaceComImportInterop =
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GlobalUsings.g.cs b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GlobalUsings.g.cs
new file mode 100644
index 00000000..8578f3d0
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GlobalUsings.g.cs
@@ -0,0 +1,8 @@
+//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.IO;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.assets.cache b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.assets.cache
new file mode 100644
index 00000000..8913e0ca
Binary files /dev/null and b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.assets.cache differ
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.CoreCompileInputs.cache b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.CoreCompileInputs.cache
new file mode 100644
index 00000000..97d6d932
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.CoreCompileInputs.cache
@@ -0,0 +1 @@
+3e116a7e531ffaf5633e32e0bf4deb38175e8205076e04a01b1d750018d2f736
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.FileListAbsolute.txt b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.FileListAbsolute.txt
new file mode 100644
index 00000000..1bbec192
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.FileListAbsolute.txt
@@ -0,0 +1,26 @@
+/src/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.deps.json
+/src/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.dll
+/src/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.pdb
+/src/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GeneratedMSBuildEditorConfig.editorconfig
+/src/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfoInputs.cache
+/src/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfo.cs
+/src/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.CoreCompileInputs.cache
+/src/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.dll
+/src/Fission.DotNet.Common/obj/Release/net8.0/refint/Fission.DotNet.Common.dll
+/src/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.pdb
+/src/Fission.DotNet.Common/obj/Release/net8.0/ref/Fission.DotNet.Common.dll
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GeneratedMSBuildEditorConfig.editorconfig
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfoInputs.cache
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfo.cs
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.CoreCompileInputs.cache
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.sourcelink.json
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.dll
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/refint/Fission.DotNet.Common.dll
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.pdb
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common.deps.json
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common.dll
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/ref/Fission.DotNet.Common.dll
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common.pdb
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.deps.json
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.dll
+/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.pdb
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.dll b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.dll
new file mode 100644
index 00000000..3f79155d
Binary files /dev/null and b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.dll differ
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.pdb b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.pdb
new file mode 100644
index 00000000..ced88a76
Binary files /dev/null and b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.pdb differ
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.sourcelink.json b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.sourcelink.json
new file mode 100644
index 00000000..d78a3009
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.sourcelink.json
@@ -0,0 +1 @@
+{"documents":{"/Users/davidcasa/environments/*":"https://raw.githubusercontent.com/davidchase/environments/da8ab386daab96def321895f43b0f975caf774ca/*"}}
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/ref/Fission.DotNet.Common.dll b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/ref/Fission.DotNet.Common.dll
new file mode 100644
index 00000000..1673fab3
Binary files /dev/null and b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/ref/Fission.DotNet.Common.dll differ
diff --git a/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/refint/Fission.DotNet.Common.dll b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/refint/Fission.DotNet.Common.dll
new file mode 100644
index 00000000..1673fab3
Binary files /dev/null and b/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/refint/Fission.DotNet.Common.dll differ
diff --git a/dotnet8/Fission.DotNet.Common/obj/project.assets.json b/dotnet8/Fission.DotNet.Common/obj/project.assets.json
new file mode 100644
index 00000000..bc01dccc
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/project.assets.json
@@ -0,0 +1,71 @@
+{
+ "version": 3,
+ "targets": {
+ "net8.0": {}
+ },
+ "libraries": {},
+ "projectFileDependencyGroups": {
+ "net8.0": []
+ },
+ "packageFolders": {
+ "/Users/davidcasa/.nuget/packages/": {}
+ },
+ "project": {
+ "version": "1.1.0",
+ "restore": {
+ "projectUniqueName": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj",
+ "projectName": "Fission.DotNet.Common",
+ "projectPath": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj",
+ "packagesPath": "/Users/davidcasa/.nuget/packages/",
+ "outputPath": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/obj/",
+ "projectStyle": "PackageReference",
+ "configFilePaths": [
+ "/Users/davidcasa/.nuget/NuGet/NuGet.Config"
+ ],
+ "originalTargetFrameworks": [
+ "net8.0"
+ ],
+ "sources": {
+ "https://api.nuget.org/v3/index.json": {}
+ },
+ "frameworks": {
+ "net8.0": {
+ "targetAlias": "net8.0",
+ "projectReferences": {}
+ }
+ },
+ "warningProperties": {
+ "warnAsError": [
+ "NU1605"
+ ]
+ },
+ "restoreAuditProperties": {
+ "enableAudit": "true",
+ "auditLevel": "low",
+ "auditMode": "direct"
+ }
+ },
+ "frameworks": {
+ "net8.0": {
+ "targetAlias": "net8.0",
+ "imports": [
+ "net461",
+ "net462",
+ "net47",
+ "net471",
+ "net472",
+ "net48",
+ "net481"
+ ],
+ "assetTargetFallback": true,
+ "warn": true,
+ "frameworkReferences": {
+ "Microsoft.NETCore.App": {
+ "privateAssets": "all"
+ }
+ },
+ "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.413/PortableRuntimeIdentifierGraph.json"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet.Common/obj/project.nuget.cache b/dotnet8/Fission.DotNet.Common/obj/project.nuget.cache
new file mode 100644
index 00000000..77e4a130
--- /dev/null
+++ b/dotnet8/Fission.DotNet.Common/obj/project.nuget.cache
@@ -0,0 +1,8 @@
+{
+ "version": 2,
+ "dgSpecHash": "j1Y/WP+AzWA=",
+ "success": true,
+ "projectFilePath": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj",
+ "expectedPackageFiles": [],
+ "logs": []
+}
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet/Adapter/FissionLoggerAdapter.cs b/dotnet8/Fission.DotNet/Adapter/FissionLoggerAdapter.cs
new file mode 100644
index 00000000..cca1072a
--- /dev/null
+++ b/dotnet8/Fission.DotNet/Adapter/FissionLoggerAdapter.cs
@@ -0,0 +1,44 @@
+using System;
+using Fission.DotNet.Common;
+
+namespace Fission.DotNet.Adapter;
+
+public class FissionLoggerAdapter : Common.ILogger
+{
+ private Microsoft.Extensions.Logging.ILogger _logger;
+
+ public FissionLoggerAdapter(Microsoft.Extensions.Logging.ILogger logger)
+ {
+ this._logger = logger;
+ }
+
+ public void LogCritical(string message)
+ {
+ _logger.LogCritical(message);
+ }
+
+ public void LogDebug(string message)
+ {
+ _logger.LogDebug(message);
+ }
+
+ public void LogError(string message, Exception exception)
+ {
+ _logger.LogError(exception, message);
+ }
+
+ public void LogError(string message)
+ {
+ _logger.LogError(message);
+ }
+
+ public void LogInformation(string message)
+ {
+ _logger.LogInformation(message);
+ }
+
+ public void LogWarning(string message)
+ {
+ _logger.LogWarning(message);
+ }
+}
diff --git a/dotnet8/Fission.DotNet/Controllers/BuildController.cs b/dotnet8/Fission.DotNet/Controllers/BuildController.cs
new file mode 100644
index 00000000..25ae35ae
--- /dev/null
+++ b/dotnet8/Fission.DotNet/Controllers/BuildController.cs
@@ -0,0 +1,2 @@
+// This controller is not needed in the runtime environment
+// Build functionality is handled by the separate builder container
\ No newline at end of file
diff --git a/dotnet8/Fission.DotNet/Controllers/FunctionController.cs b/dotnet8/Fission.DotNet/Controllers/FunctionController.cs
new file mode 100644
index 00000000..b505fd47
--- /dev/null
+++ b/dotnet8/Fission.DotNet/Controllers/FunctionController.cs
@@ -0,0 +1,226 @@
+using System.Text;
+using Fission.DotNet.Common;
+using Microsoft.AspNetCore.Mvc;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.Loader;
+using Fission.DotNet.Interfaces;
+using System.Threading.Tasks.Dataflow;
+using Fission.DotNet.Services;
+
+namespace Fission.DotNet.Controllers
+{
+ [ApiController]
+ public class FunctionController : Controller
+ {
+ private readonly ILogger _logger;
+ private readonly IFunctionService _functionService;
+
+ public FunctionController(ILogger logger, IFunctionService functionService)
+ {
+ this._logger = logger;
+ this._functionService = functionService;
+ }
+ ///
+ /// Handle HTTP GET requests by forwarding to the Fission function.
+ ///
+ /// The function return value.
+ [HttpGet]
+ [Route("/")]
+ [Route("/{*path}")]
+ public async Task Get()
+ {
+ return await this.Run(Request);
+ }
+
+ ///
+ /// Handle HTTP POST requests by forwarding to the Fission function.
+ ///
+ /// The function return value.
+ [HttpPost]
+ [Route("/")]
+ [Route("/{*path}", Order = int.MaxValue)]
+ public async Task Post()
+ {
+ return await this.Run(Request);
+ }
+
+ ///
+ /// Handle HTTP PUT requests by forwarding to the Fission function.
+ ///
+ /// The function return value.
+ [HttpPut]
+ [Route("/")]
+ [Route("/{*path}", Order = int.MaxValue)]
+ public async Task Put()
+ {
+ return await this.Run(Request);
+ }
+
+ ///
+ /// Handle HTTP HEAD requests by forwarding to the Fission function.
+ ///
+ /// The function return value.
+ [HttpHead]
+ [Route("/")]
+ [Route("/{*path}", Order = int.MaxValue)]
+ public async Task Head()
+ {
+ return await this.Run(Request);
+ }
+
+ ///
+ /// Handle HTTP OPTIONS requests by forwarding to the Fission function.
+ ///
+ /// The function return value.
+ [HttpOptions]
+ [Route("/")]
+ [Route("/{*path}", Order = int.MaxValue)]
+ public async Task Options()
+ {
+ return await this.Run(Request);
+ }
+
+ ///
+ /// Handle HTTP DELETE requests by forwarding to the Fission function.
+ ///
+ /// The function return value.
+ [HttpDelete]
+ [Route("/")]
+ [Route("/{*path}", Order = int.MaxValue)]
+ public async Task Delete()
+ {
+ return await this.Run(Request);
+ }
+
+ ///
+ /// Invokes the Fission function on behalf of the caller.
+ ///
+ ///
+ /// 200 OK with the Fission function return value; or 400 Bad Request with the exception message if an exception
+ /// occurred in the Fission function; or 500 Internal Server Error if the environment container has not yet been
+ /// specialized.
+ ///
+ private async Task Run(HttpRequest request)
+ {
+ _logger.LogInformation("FunctionController.Run");
+
+ _functionService.Load();
+ try
+ {
+ if (request.Method == "OPTIONS")
+ {
+ var corsPolicy = _functionService.GetCorsPolicy();
+ var headers = (corsPolicy as CorsPolicy).GetCorsHeaders();
+ foreach (var header in headers)
+ {
+ Response.Headers.Add(header.Key, header.Value);
+ }
+ return Ok();
+ }
+
+ // Copy the body to a MemoryStream so it can be read again
+ request.EnableBuffering();
+ using (var memoryStream = new MemoryStream())
+ {
+ await request.Body.CopyToAsync(memoryStream);
+ memoryStream.Seek(0, SeekOrigin.Begin);
+
+ request.Body = memoryStream;
+
+
+ Fission.DotNet.Common.FissionContext context = null;
+ try
+ {
+ var httpArgs = request.Query.ToDictionary(x => x.Key, x => (object)x.Value);
+ var headers = request.Headers.ToDictionary(x => x.Key, x => (string)x.Value);
+ var parameters = new Dictionary();
+
+ // Add the actual request path so the function can route correctly
+ headers["X-Fission-Full-Url"] = request.Path.Value ?? "/";
+
+ // Extract headers that start with "X-Fission-Params-"
+ foreach (var header in request.Headers)
+ {
+ if (header.Key.StartsWith("X-Fission-Params-"))
+ {
+ var key = header.Key.Substring("X-Fission-Params-".Length);
+ var value = header.Value.ToString();
+ parameters[key] = value;
+ }
+ }
+
+ if (request.Headers.ContainsKey("Topic"))
+ {
+ _logger.LogInformation("FunctionController.Run: FissionMqContext");
+ context = new Fission.DotNet.Common.FissionMqContext(request.Body, httpArgs, headers, parameters);
+ }
+ else
+ {
+ _logger.LogInformation("FunctionController.Run: FissionHttpContext");
+ context = new Fission.DotNet.Common.FissionHttpContext(request.Body, request.Method, httpArgs, headers, parameters);
+ }
+
+ if (context is FissionHttpContext)
+ {
+ _logger.LogInformation($"Body stream: {context.Content.Position}-{context.Content.Length}");
+ _logger.LogInformation($"Request Method: {(context as FissionHttpContext).Method}");
+ _logger.LogInformation($"Request Arguments: {string.Join(", ", (context as FissionHttpContext).Arguments.Select(x => $"{x.Key}={x.Value}"))}");
+ }
+ _logger.LogInformation($"Request Method: {request.Method}");
+ _logger.LogInformation($"Request Headers: {string.Join(", ", request.Headers.Select(x => $"{x.Key}={x.Value}"))}");
+ _logger.LogInformation($"Request Query: {string.Join(", ", request.Query.Select(x => $"{x.Key}={x.Value}"))}");
+
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "FunctionController.Run");
+ return BadRequest(ex.Message);
+ }
+
+ try
+ {
+ var result = await _functionService.Execute(context);
+ if (context is FissionHttpContext)
+ {
+ var corsPolicy = _functionService.GetCorsPolicy();
+ var headers = (corsPolicy as CorsPolicy).GetRequestCorsHeaders();
+ foreach (var header in headers)
+ {
+ Response.Headers.Add(header.Key, header.Value);
+ }
+
+ // Set Content-Type based on result content
+ if (result is string stringResult && stringResult.TrimStart().StartsWith(" logger;
+ private readonly ISpecializeService specializeService;
+
+ public SpecializeController(ILogger logger, ISpecializeService specializeService)
+ {
+ this.logger = logger;
+ this.specializeService = specializeService;
+ }
+
+ // GET: SpecializeController
+ [HttpPost, Route("/specialize")]
+ public Task