This is an automated email from the ASF dual-hosted git repository.
shawnallen85 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-dotnet.git
The following commit(s) were added to refs/heads/master by this push:
new 05f5d30 .NET 6.0 Support (#68)
05f5d30 is described below
commit 05f5d30d59c9fd0e7c4906d852a741c3ca84fc39
Author: Shawn Black <[email protected]>
AuthorDate: Tue Feb 14 11:14:28 2023 -0600
.NET 6.0 Support (#68)
* feature: initial 6.0 work
* feature: vagrant for testing; fixed Dockerfile
* fix: README.md
* fix: Vagrantfile; Vagrant readme
---
.gitignore | 1 +
README.md | 10 +-
core/{dotnet2.2 => net6.0}/CHANGELOG.md | 25 +--
core/{dotnet2.2 => net6.0}/Dockerfile | 6 +-
core/{dotnet2.2 => net6.0}/QUICKSTART.md | 30 ++--
core/{dotnet2.2 => net6.0}/build.gradle | 2 +-
.../Apache.OpenWhisk.Runtime.Common.csproj | 12 +-
.../HttpResponseExtension.cs | 0
.../proxy/Apache.OpenWhisk.Runtime.Common/Init.cs | 12 ++
.../proxy/Apache.OpenWhisk.Runtime.Common/Run.cs | 6 +-
.../Apache.OpenWhisk.Runtime.Common/Startup.cs | 3 -
.../Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj | 4 +-
.../Program.cs | 0
core/{dotnet2.2 => net6.0}/proxy/build.gradle | 0
.../proxy/gradle/wrapper/gradle-wrapper.jar | Bin
.../proxy/gradle/wrapper/gradle-wrapper.properties | 0
core/{dotnet2.2 => net6.0}/proxy/gradlew | 0
core/{dotnet2.2 => net6.0}/proxy/gradlew.bat | 200 ++++++++++-----------
.../proxy/openwhisk-runtime-dotnet.sln | 0
gradlew | 2 +-
settings.gradle | 8 +-
tests/build.gradle | 2 +-
.../Apache.OpenWhisk.Tests.Dotnet.csproj | 2 +-
.../Apache.OpenWhisk.Tests.Dotnet.csproj | 6 +-
tests/{dotnet2.2 => net6.0}/build.gradle | 7 +-
.../openwhisk-tests-dotnet.sln | 10 +-
...la => DotNet3_1ActionContainerTests_2_2.scalaZ} | 0
...ests.scala => Net6_0ActionContainerTests.scala} | 12 +-
.../vagrant/README.md | 41 ++++-
tools/vagrant/Vagrantfile | 60 +++++++
30 files changed, 270 insertions(+), 191 deletions(-)
diff --git a/.gitignore b/.gitignore
index 99b317a..c6229d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ obj/
bin/
*.zip
+.vagrant/
diff --git a/README.md b/README.md
index 335e95a..deff735 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
#
-->
-# Apache OpenWhisk runtimes for .NET Core
+# Apache OpenWhisk runtimes for .NET
[](http://www.apache.org/licenses/LICENSE-2.0)
[](https://travis-ci.com/github/apache/openwhisk-runtime-dotnet)
@@ -33,7 +33,7 @@ cd Apache.OpenWhisk.Example.Dotnet
Install the [Newtonsoft.Json](https://www.newtonsoft.com/json) NuGet package
as follows:
```bash
-dotnet add package Newtonsoft.Json -v 12.0.1
+dotnet add package Newtonsoft.Json -v 13.0.1
```
Now create a file called `Hello.cs` with the following content:
@@ -75,7 +75,7 @@ zip -r -0 helloDotNet.zip *
Create the action
```bash
-wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main
--kind dotnet:2.2
+wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main
--kind dotnet:6.0
```
For the return result, not only support `dictionary` but also support `array`
@@ -123,13 +123,13 @@ namespace Apache.OpenWhisk.Tests.Dotnet
## Changelogs
-- [.NET Core 2.2 CHANGELOG.md](core/dotnet2.2/CHANGELOG.md)
- [.NET Core 3.1 CHANGELOG.md](core/dotnet3.1/CHANGELOG.md)
+- [.NET 6.0 CHANGELOG.md](core/net6.0/CHANGELOG.md)
## Quick Start Guides
-- [.NET Core 2.2](core/dotnet2.2/QUICKSTART.md)
- [.NET Core 3.1](core/dotnet3.1/QUICKSTART.md)
+- [.NET Core 6.0](core/net6.0/QUICKSTART.md)
# License
diff --git a/core/dotnet2.2/CHANGELOG.md b/core/net6.0/CHANGELOG.md
similarity index 58%
rename from core/dotnet2.2/CHANGELOG.md
rename to core/net6.0/CHANGELOG.md
index 0afa5bf..19bcf32 100644
--- a/core/dotnet2.2/CHANGELOG.md
+++ b/core/net6.0/CHANGELOG.md
@@ -17,30 +17,7 @@
#
-->
-# .NET Core 2.2 OpenWhisk Runtime Container
+# .NET 6.0 OpenWhisk Runtime Container
## 1.16
-- Fix Akka version ($55)
-- Init json quickstart updates (#50)
-- Export init args to environment. (#44)
-
-## 1.15
-Changes:
-- Increased MaxRequestBodySize, so larger zip files can be uploaded (#33)
-- Get the latest security fixes (apk upgrade) with every build.
-
-## 1.14
-Changes:
-- Support for async methods. Example:
-
-```csharp
- public async Task<JObject> MainAsync(JObject args)
- {
- await Task.Delay(10); // Just do a delay to have an async/await
process occur.
- return (args);
- }
-```
-
-## 1.13
-Changes:
- Initial release
diff --git a/core/dotnet2.2/Dockerfile b/core/net6.0/Dockerfile
similarity index 90%
rename from core/dotnet2.2/Dockerfile
rename to core/net6.0/Dockerfile
index 053ad75..854915f 100644
--- a/core/dotnet2.2/Dockerfile
+++ b/core/net6.0/Dockerfile
@@ -15,7 +15,7 @@
# limitations under the License.
#
-FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
WORKDIR /app
COPY proxy/Apache.OpenWhisk.Runtime.Common/*.csproj
./Apache.OpenWhisk.Runtime.Common/
@@ -26,9 +26,9 @@ RUN dotnet restore
COPY proxy/Apache.OpenWhisk.Runtime.Common/. ./Apache.OpenWhisk.Runtime.Common/
COPY proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/.
./Apache.OpenWhisk.Runtime.Dotnet.Minimal/
WORKDIR /app/Apache.OpenWhisk.Runtime.Dotnet.Minimal
-RUN dotnet publish -c Release -r alpine.3.9-x64 -o out
+RUN dotnet publish -c Release -r linux-musl-x64 -o out
-FROM mcr.microsoft.com/dotnet/core/runtime:2.2-alpine AS runtime
+FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine AS runtime
# Get the latest security fixes in case the base image does not contain them
already.
RUN apk update \
diff --git a/core/dotnet2.2/QUICKSTART.md b/core/net6.0/QUICKSTART.md
similarity index 84%
rename from core/dotnet2.2/QUICKSTART.md
rename to core/net6.0/QUICKSTART.md
index 9494bd1..f596a3f 100644
--- a/core/dotnet2.2/QUICKSTART.md
+++ b/core/net6.0/QUICKSTART.md
@@ -17,9 +17,9 @@
#
-->
-# Quick .NET Core 2.2 Action
+# Quick .NET 6.0 Action
-A .NET Core action is a .NET Core class library with a method called `Main` or
`MainAsync` that has the exact signature as follows:
+A .NET action is a .NET class library with a method called `Main` or
`MainAsync` that has the exact signature as follows:
Synchronous:
@@ -33,12 +33,12 @@ Asynchronous:
public async System.Threading.Tasks.Task<Newtonsoft.Json.Linq.JObject>
MainAsync(Newtonsoft.Json.Linq.JObject);
```
-In order to compile, test and archive .NET Core projects, you must have the
[.NET Core SDK](https://www.microsoft.com/net/download) installed locally and
the environment variable `DOTNET_HOME` set to the location where the `dotnet`
executable can be found.
+In order to compile, test and archive .NET projects, you must have the [.NET
SDK](https://dotnet.microsoft.com/en-us/download) installed locally and ensure
that the `dotnet` executable is included in the `PATH` environment variable.
For example, create a C# project called `Apache.OpenWhisk.Example.Dotnet`:
```bash
-dotnet new classlib -n Apache.OpenWhisk.Example.Dotnet -lang C# -f
netstandard2.0
+dotnet new classlib -n Apache.OpenWhisk.Example.Dotnet -lang C# -f
netstandard2.1
cd Apache.OpenWhisk.Example.Dotnet
```
@@ -127,18 +127,18 @@ To use on a deployment of OpenWhisk that contains the
runtime as a kind:
Synchronous:
```bash
-wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main
--kind dotnet:2.2
+wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main
--kind dotnet:6.0
```
Asynchronous:
```bash
-wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::MainAsync
--kind dotnet:2.2
+wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::MainAsync
--kind dotnet:6.0
```
## Invoke the .NET Core Action
-Action invocation is the same for .NET Core actions as it is for Swift and
JavaScript actions:
+Action invocation is the same for .NET actions as it is for Swift and
JavaScript actions:
```bash
wsk action invoke --result helloDotNet --param name World
@@ -153,19 +153,19 @@ wsk action invoke --result helloDotNet --param name World
## Local Development
```bash
-./gradlew core:dotnet2.2:distDocker
+./gradlew core:dotnet3.1:distDocker
```
-This will produce the image `whisk/action-dotnet-v2.2`
+This will produce the image `whisk/action-dotnet-v6.0`
Build and Push image
```bash
docker login
-./gradlew core:action-dotnet-v2.2:distDocker -PdockerImagePrefix=$prefix-user
-PdockerRegistry=docker.io
+./gradlew core:action-dotnet-v6.0:distDocker -PdockerImagePrefix=$prefix-user
-PdockerRegistry=docker.io
```
-Deploy OpenWhisk using ansible environment that contains the kind `dotnet:2.2`
+Deploy OpenWhisk using ansible environment that contains the kind `dotnet:6.0`
Assuming you have OpenWhisk already deploy locally and `OPENWHISK_HOME`
pointing to root directory of OpenWhisk core repository.
Set `ROOTDIR` to the root directory of this repository.
@@ -208,7 +208,7 @@ Using gradle to run all tests
Using gradle to run some tests
```bash
-./gradlew :tests:test --tests DotNet2_2ActionContainerTests
+./gradlew :tests:test --tests Net6_0ActionContainerTests
```
Using IntelliJ:
@@ -221,14 +221,14 @@ Using IntelliJ:
To use as docker action push to your own dockerhub account
```bash
-docker tag whisk/action-dotnet-v2.2 $user_prefix/action-dotnet-v2.2
-docker push $user_prefix/action-dotnet-v2.2
+docker tag whisk/action-dotnet-v6.0 $user_prefix/action-dotnet-v6.0
+docker push $user_prefix/action-dotnet-v6.0
```
Then create the action using your the image from dockerhub
```bash
-wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main
--docker $user_prefix/action-dotnet-v2.2
+wsk action update helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main
--docker $user_prefix/action-dotnet-v6.0
```
The `$user_prefix` is usually your dockerhub user id.
diff --git a/core/dotnet2.2/build.gradle b/core/net6.0/build.gradle
similarity index 95%
rename from core/dotnet2.2/build.gradle
rename to core/net6.0/build.gradle
index cc42196..c608af9 100644
--- a/core/dotnet2.2/build.gradle
+++ b/core/net6.0/build.gradle
@@ -15,6 +15,6 @@
* limitations under the License.
*/
-ext.dockerImageName = 'action-dotnet-v2.2'
+ext.dockerImageName = 'action-dotnet-v6.0'
apply from: '../../gradle/docker.gradle'
diff --git
a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj
similarity index 77%
rename from
core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj
rename to
core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj
index 78fe3f5..023908e 100644
---
a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj
+++
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Apache.OpenWhisk.Runtime.Common.csproj
@@ -17,16 +17,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netcoreapp2.2</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.AspNetCore">
- <Version>2.2.0</Version>
- </PackageReference>
- <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel">
- <Version>2.2.0</Version>
- </PackageReference>
+ <FrameworkReference Include="Microsoft.AspNetCore.App" />
+ </ItemGroup>
+
+ <ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
diff --git
a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs
similarity index 100%
rename from
core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs
rename to
core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/HttpResponseExtension.cs
diff --git a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs
similarity index 89%
rename from core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs
rename to core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs
index 8cd47eb..0a1a054 100644
--- a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs
+++ b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Init.cs
@@ -21,6 +21,7 @@ using System.IO.Compression;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
+using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json.Linq;
@@ -121,6 +122,17 @@ namespace Apache.OpenWhisk.Runtime.Common
try
{
+ // Export init arguments as environment variables
+ if (message["env"] != null && message["env"].HasValues)
+ {
+ Dictionary<string, string> dictEnv =
message["env"].ToObject<Dictionary<string, string>>();
+ foreach (KeyValuePair<string, string> entry in
dictEnv) {
+ // See
https://docs.microsoft.com/en-us/dotnet/api/system.environment.setenvironmentvariable
+ // If entry.Value is null or the empty string, the
variable is not set
+ Environment.SetEnvironmentVariable(entry.Key,
entry.Value);
+ }
+ }
+
Assembly assembly = Assembly.LoadFrom(assemblyPath);
Type = assembly.GetType(mainParts[1]);
if (Type == null)
diff --git a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs
similarity index 97%
rename from core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs
rename to core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs
index d9c9df2..0ee99ce 100644
--- a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs
+++ b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Run.cs
@@ -76,9 +76,9 @@ namespace Apache.OpenWhisk.Runtime.Common
$"Unable to set environment variable for the
\"{token.Path}\" token.");
}
}
- }
- if (valObject == null) {
- valArray = inputObject["value"] as JArray;
+ if (valObject == null) {
+ valArray = inputObject["value"] as JArray;
+ }
}
object owObject = _constructor.Invoke(new object[] { });
diff --git a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs
similarity index 95%
rename from core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs
rename to core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs
index 6c0d236..9851e54 100644
--- a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs
+++ b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Common/Startup.cs
@@ -16,11 +16,8 @@
*/
using System;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
namespace Apache.OpenWhisk.Runtime.Common
{
diff --git
a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj
similarity index 94%
rename from
core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj
rename to
core/net6.0/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj
index 2d3a42a..1bcbb35 100644
---
a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj
+++
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Apache.OpenWhisk.Runtime.Dotnet.Minimal.csproj
@@ -18,11 +18,11 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>netcoreapp2.2</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference
Include="..\Apache.OpenWhisk.Runtime.Common\Apache.OpenWhisk.Runtime.Common.csproj"
/>
</ItemGroup>
-
+
</Project>
diff --git
a/core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Program.cs
b/core/net6.0/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Program.cs
similarity index 100%
rename from
core/dotnet2.2/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Program.cs
rename to core/net6.0/proxy/Apache.OpenWhisk.Runtime.Dotnet.Minimal/Program.cs
diff --git a/core/dotnet2.2/proxy/build.gradle b/core/net6.0/proxy/build.gradle
similarity index 100%
rename from core/dotnet2.2/proxy/build.gradle
rename to core/net6.0/proxy/build.gradle
diff --git a/core/dotnet2.2/proxy/gradle/wrapper/gradle-wrapper.jar
b/core/net6.0/proxy/gradle/wrapper/gradle-wrapper.jar
similarity index 100%
rename from core/dotnet2.2/proxy/gradle/wrapper/gradle-wrapper.jar
rename to core/net6.0/proxy/gradle/wrapper/gradle-wrapper.jar
diff --git a/core/dotnet2.2/proxy/gradle/wrapper/gradle-wrapper.properties
b/core/net6.0/proxy/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
copy from core/dotnet2.2/proxy/gradle/wrapper/gradle-wrapper.properties
copy to core/net6.0/proxy/gradle/wrapper/gradle-wrapper.properties
diff --git a/core/dotnet2.2/proxy/gradlew b/core/net6.0/proxy/gradlew
similarity index 100%
rename from core/dotnet2.2/proxy/gradlew
rename to core/net6.0/proxy/gradlew
diff --git a/core/dotnet2.2/proxy/gradlew.bat b/core/net6.0/proxy/gradlew.bat
similarity index 96%
rename from core/dotnet2.2/proxy/gradlew.bat
rename to core/net6.0/proxy/gradlew.bat
index 15e1ee3..9991c50 100644
--- a/core/dotnet2.2/proxy/gradlew.bat
+++ b/core/net6.0/proxy/gradlew.bat
@@ -1,100 +1,100 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem http://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS
to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your
PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS%
"-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%"
org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code
instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem http://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS
to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your
PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS%
"-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%"
org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code
instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/core/dotnet2.2/proxy/openwhisk-runtime-dotnet.sln
b/core/net6.0/proxy/openwhisk-runtime-dotnet.sln
similarity index 100%
rename from core/dotnet2.2/proxy/openwhisk-runtime-dotnet.sln
rename to core/net6.0/proxy/openwhisk-runtime-dotnet.sln
diff --git a/gradlew b/gradlew
index aec07ae..b8cb155 100755
--- a/gradlew
+++ b/gradlew
@@ -44,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to
pass JVM options to this script.
-DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+DEFAULT_JVM_OPTS="-Xmx64m -Xms64m"
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
diff --git a/settings.gradle b/settings.gradle
index 3f2fa36..1abbfcb 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -16,15 +16,15 @@
*/
include ':tests'
-include ':tests:dotnet2.2'
include ':tests:dotnet3.1'
-
-include ':core:dotnet2.2'
-include ':core:dotnet2.2:proxy'
+include ':tests:net6.0'
include ':core:dotnet3.1'
include ':core:dotnet3.1:proxy'
+include ':core:net6.0'
+include ':core:net6.0:proxy'
+
rootProject.name = 'runtime-dotnet'
gradle.ext.openwhisk = [
diff --git a/tests/build.gradle b/tests/build.gradle
index 04d60e5..d846cac 100644
--- a/tests/build.gradle
+++ b/tests/build.gradle
@@ -52,6 +52,6 @@ tasks.withType(ScalaCompile) {
}
compileTestScala {
- dependsOn ':tests:dotnet2.2:prepare'
dependsOn ':tests:dotnet3.1:prepare'
+ dependsOn ':tests:net6.0:prepare'
}
diff --git
a/tests/dotnet3.1/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
b/tests/dotnet3.1/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
index ddc5679..757d77a 100644
---
a/tests/dotnet3.1/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
+++
b/tests/dotnet3.1/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
@@ -21,7 +21,7 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
diff --git
a/tests/dotnet2.2/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
b/tests/net6.0/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
similarity index 89%
rename from
tests/dotnet2.2/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
rename to
tests/net6.0/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
index 05df906..757d77a 100644
---
a/tests/dotnet2.2/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
+++
b/tests/net6.0/Apache.OpenWhisk.Tests.Dotnet/Apache.OpenWhisk.Tests.Dotnet.csproj
@@ -17,16 +17,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\dotnetshared\*.cs">
</Compile>
</ItemGroup>
-
+
</Project>
diff --git a/tests/dotnet2.2/build.gradle b/tests/net6.0/build.gradle
similarity index 93%
rename from tests/dotnet2.2/build.gradle
rename to tests/net6.0/build.gradle
index 377f659..09daed8 100644
--- a/tests/dotnet2.2/build.gradle
+++ b/tests/net6.0/build.gradle
@@ -30,11 +30,10 @@ dotnet {
task prepare_distro(dependsOn: distribution) {
doLast {
copy {
- from tarTree(resources.gzip(file('build/dist/netstandard2.0.tar.gz')))
+ from tarTree(resources.gzip(file('build/dist/netstandard2.1.tar.gz')))
into file('build/dist/out')
}
-
- delete file('build/dist/netstandard2.0.tar.gz')
+ delete file('build/dist/netstandard2.1.tar.gz')
}
}
@@ -42,7 +41,7 @@ task prepare_zip(type: Zip, dependsOn: prepare_distro) {
from file('build/dist/out')
include '*'
include '**/**'
- archiveName 'dotnettests2.2.zip'
+ archiveName 'nettests6.0.zip'
destinationDir(file('../src/test/resources'))
}
diff --git a/tests/dotnet2.2/openwhisk-tests-dotnet.sln
b/tests/net6.0/openwhisk-tests-dotnet.sln
similarity index 80%
rename from tests/dotnet2.2/openwhisk-tests-dotnet.sln
rename to tests/net6.0/openwhisk-tests-dotnet.sln
index a11b7e0..0f4ec0d 100644
--- a/tests/dotnet2.2/openwhisk-tests-dotnet.sln
+++ b/tests/net6.0/openwhisk-tests-dotnet.sln
@@ -17,7 +17,7 @@
# limitations under the License.
#
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") =
"Apache.OpenWhisk.Tests.Dotnet",
"Apache.OpenWhisk.Tests.Dotnet\Apache.OpenWhisk.Tests.Dotnet.csproj",
"{84C21ADE-CF95-4027-B478-DB5BA078178A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") =
"Apache.OpenWhisk.Tests.Dotnet",
"Apache.OpenWhisk.Tests.Dotnet\Apache.OpenWhisk.Tests.Dotnet.csproj",
"{4DA37A8E-7505-4C51-8C75-B18BDA45392C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,9 +25,9 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {84C21ADE-CF95-4027-B478-DB5BA078178A}.Debug|Any CPU.ActiveCfg
= Debug|Any CPU
- {84C21ADE-CF95-4027-B478-DB5BA078178A}.Debug|Any CPU.Build.0 =
Debug|Any CPU
- {84C21ADE-CF95-4027-B478-DB5BA078178A}.Release|Any
CPU.ActiveCfg = Release|Any CPU
- {84C21ADE-CF95-4027-B478-DB5BA078178A}.Release|Any CPU.Build.0
= Release|Any CPU
+ {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Debug|Any CPU.ActiveCfg
= Debug|Any CPU
+ {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Debug|Any CPU.Build.0 =
Debug|Any CPU
+ {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Release|Any
CPU.ActiveCfg = Release|Any CPU
+ {4DA37A8E-7505-4C51-8C75-B18BDA45392C}.Release|Any CPU.Build.0
= Release|Any CPU
EndGlobalSection
EndGlobal
diff --git
a/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests_2_2.scala
b/tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests_2_2.scalaZ
similarity index 100%
rename from
tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests_2_2.scala
rename to
tests/src/test/scala/actionContainers/DotNet3_1ActionContainerTests_2_2.scalaZ
diff --git
a/tests/src/test/scala/actionContainers/DotNet2_2ActionContainerTests.scala
b/tests/src/test/scala/actionContainers/Net6_0ActionContainerTests.scala
similarity index 96%
rename from
tests/src/test/scala/actionContainers/DotNet2_2ActionContainerTests.scala
rename to tests/src/test/scala/actionContainers/Net6_0ActionContainerTests.scala
index 7a15249..fbff7b5 100644
--- a/tests/src/test/scala/actionContainers/DotNet2_2ActionContainerTests.scala
+++ b/tests/src/test/scala/actionContainers/Net6_0ActionContainerTests.scala
@@ -25,12 +25,12 @@ import actionContainers.ActionContainer.withContainer
import java.nio.file.Paths
@RunWith(classOf[JUnitRunner])
-class DotNet2_2ActionContainerTests extends BasicActionRunnerTests with
WskActorSystem {
- val functionb64 =
ResourceHelpers.readAsBase64(Paths.get(getClass.getResource("/dotnettests2.2.zip").getPath))
+class Net6_0ActionContainerTests extends BasicActionRunnerTests with
WskActorSystem {
+ val functionb64 =
ResourceHelpers.readAsBase64(Paths.get(getClass.getResource("/nettests6.0.zip").getPath))
// Helpers specific to java actions
override def withActionContainer(env: Map[String, String] = Map.empty)(
- code: ActionContainer => Unit): (String, String) =
withContainer("action-dotnet-v2.2", env)(code)
+ code: ActionContainer => Unit): (String, String) =
withContainer("action-dotnet-v6.0", env)(code)
behavior of "dotnet action"
@@ -47,6 +47,10 @@ class DotNet2_2ActionContainerTests extends
BasicActionRunnerTests with WskActor
TestConfig(functionb64, main =
"Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Environment::Main")
}
+ override val testEnvParameters = {
+ TestConfig(functionb64, main =
"Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.Init::Main")
+ }
+
override val testEcho = {
TestConfig(functionb64, main =
"Apache.OpenWhisk.Tests.Dotnet::Apache.OpenWhisk.Tests.Dotnet.AltEcho::Main")
}
@@ -121,7 +125,7 @@ class DotNet2_2ActionContainerTests extends
BasicActionRunnerTests with WskActor
runRes shouldBe defined
runRes should {
- be(Some(JsObject("error" -> JsString(".NETCoreApp,Version=v2.2"))))
+ be(Some(JsObject("error" -> JsString(".NETCoreApp,Version=v6.0"))))
}
}
diff --git a/core/dotnet2.2/proxy/gradle/wrapper/gradle-wrapper.properties
b/tools/vagrant/README.md
similarity index 60%
rename from core/dotnet2.2/proxy/gradle/wrapper/gradle-wrapper.properties
rename to tools/vagrant/README.md
index d475d27..45ce1e1 100644
--- a/core/dotnet2.2/proxy/gradle/wrapper/gradle-wrapper.properties
+++ b/tools/vagrant/README.md
@@ -1,3 +1,4 @@
+<!--
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -14,8 +15,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
+-->
+
+# Why?
+
+Added for a consistent development environment. Or for those who have switched
to a different container runtime.
+
+## Requirements
+
+ + [Vagrant](https://www.vagrantup.com/)
+
+## Usage
+
+Start up the environment
+
+```bash
+vagrant up
+```
+
+Enter the environment
+
+```bash
+vagrant ssh
+```
+
+Example usage within the environment
+
+```bash
+cd $OPENWHISK_HOME
+./gradlew install
+cd ..
+cd openwhisk-runtime-dotnet
+./gradlew core:dotnet3.1:distDocker
+./gradlew core:net6.0:distDocker
+./gradlew :tests:test
+```
diff --git a/tools/vagrant/Vagrantfile b/tools/vagrant/Vagrantfile
new file mode 100644
index 0000000..e2127f9
--- /dev/null
+++ b/tools/vagrant/Vagrantfile
@@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+$provision_script = <<-SCRIPT
+DEBIAN_FRONTEND=noninteractive
+apt update
+apt install apt-transport-https -y --no-install-recommends
+apt install curl zip unzip -y --no-install-recommends
+curl -o /tmp/packages-microsoft-prod.deb
https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb
+dpkg -i /tmp/packages-microsoft-prod.deb
+rm /tmp/packages-microsoft-prod.deb
+apt update
+apt-get install -y dotnet-sdk-6.0
+
+su - vagrant -c 'curl -s "https://get.sdkman.io" | bash'
+
+su - vagrant -c 'source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk install java
11.0.17-amzn'
+
+su - vagrant -c 'cd /src/openwhisk && /src/openwhisk/gradlew install'
+
+if [ ! -f "/etc/profile.d/openwhisk.sh" ] ; then
+ cat << EOF > /etc/profile.d/openwhisk.sh
+#!/bin/bash
+OPENWHISK_HOME="/src/openwhisk"
+EOF
+ chmod a+x /etc/profile.d/openwhisk.sh
+fi
+SCRIPT
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "debian/bullseye64"
+
+ config.vm.provider "virtualbox" do |vb|
+ vb.memory = 4096
+ vb.cpus = 2
+ vb.customize ["modifyvm", :id, "--ioapic", "on"]
+ end
+
+ config.vm.provision "shell", inline: $provision_script
+
+ config.vm.provision :docker
+
+ config.vm.synced_folder "../../..", "/src"
+end