Fixed typos across fission repo (#1832)

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
This commit is contained in:
Gaurav Gahlot
2020-10-16 17:25:11 +05:30
committed by GitHub
co-authored by Vishal
parent 6e3c42f238
commit fca0a60e5b
49 changed files with 157 additions and 172 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ namespace Builder
}
catch(Exception childEx)
{
//do nothing , just log orignal exception
//do nothing , just log original exception
Console.WriteLine($"{Environment.NewLine} Exception During Build :{ex.Message} |{Environment.NewLine} {ex.StackTrace} {Environment.NewLine} ");
}
@@ -40,18 +40,18 @@ namespace Builder.Engine
await BuildDllInfo();
Console.WriteLine("DLL Info Gathered!!");
// try to compile the function and if compilation succedd ,then create func spec file
// try to compile the function and if compilation succeed ,then create func spec file
//this enables us to find compilation issues during package creation itself thus saving time
// however this feature impose that the function file name should be func.cs
//if we dont want it , we can comment the TryCompile() logic
Console.WriteLine("Trying to compile it during build itslef !!");
//if we don't want it , we can comment the TryCompile() logic
Console.WriteLine("Trying to compile it during build itself !!");
bool compiled =await TryCompile();
Console.WriteLine($"Compilation result Gathered as : {compiled}!!");
if (compiled)
{
//nowwhatever has been done so far and all files which are generated are in /app folder where dll resides
//thus copy relavant thing in SRC_PKG as it is ,but lest skip it here , we shall do it in build.sh
//thus copy relevant thing in SRC_PKG as it is ,but lest skip it here , we shall do it in build.sh
CopyToSourceDir();
Console.WriteLine($"Copy to Source Done!!");
//build the function specs
@@ -98,7 +98,7 @@ namespace Builder.Engine
public async Task<bool> TryCompile()
{
bool issuccess = false;
bool isSuccess = false;
string CODE_PATH = Path.Combine(SRC_PKG, BuilderHelper.Instance.builderSettings.functionBodyFileName);
if (!File.Exists(CODE_PATH))
@@ -107,20 +107,20 @@ namespace Builder.Engine
$" to use TryCompile() in Builder, make sure , your main function file name is " +
$"{BuilderHelper.Instance.builderSettings.functionBodyFileName} and " +
$"it is located at root of zip!!" );
return issuccess;
return isSuccess;
}
var code = File.ReadAllText(CODE_PATH);
issuccess = await Compile(code);
isSuccess = await Compile(code);
return issuccess;
return isSuccess;
}
public async Task<bool> Compile(string code)
{
bool issuccess = false;
bool isSuccess = false;
#region assymbaly init and parent dll refrences
#region assembly init and parent dll references
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(code);
string assemblyName = Path.GetRandomFileName();
@@ -139,13 +139,13 @@ namespace Builder.Engine
{
var assembly = Assembly.Load(referencedAssembly);
references.Add(MetadataReference.CreateFromFile(assembly.Location));
BuilderHelper.Instance.logger.Log($"Refering assembaly based dls : {assembly.Location}");
BuilderHelper.Instance.logger.Log($"Refering assembly based dls : {assembly.Location}");
}
#endregion
#region handler registration for runtime resolution
//now add handeler for missing dlls for parent app domain as same assembalies should be needed
//now add handler for missing dlls for parent app domain as same assemblies should be needed
//for parent , thus refering from https://support.microsoft.com/en-in/help/837908/how-to-load-an-assembly-at-runtime-that-is-located-in-a-folder-that-is
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
@@ -153,8 +153,8 @@ namespace Builder.Engine
#endregion
BuilderHelper.Instance.logger.Log($"dynamic handlar registered!!");
#region nuget dll refrence add
//now add those dll refrence
#region nuget dll reference add
//now add those dll reference
foreach (var dll in dllInfos)
{
BuilderHelper.Instance.logger.Log($"refering nuget based dll : {dll.path}");
@@ -193,12 +193,12 @@ namespace Builder.Engine
else
{
BuilderHelper.Instance.logger.Log("Compile Success!!",true);
issuccess = true;
isSuccess = true;
}
}
#endregion
return issuccess;
return isSuccess;
}
@@ -223,7 +223,7 @@ namespace Builder.Engine
functionSpecification.libraries.Add(library);
}
//serilize that object to save it in json file
//serialize that object to save it in json file
string funcMetaJson= JsonConvert.SerializeObject(functionSpecification);
string funcMetaFile = Path.Combine(this.SRC_PKG, BuilderHelper.Instance.builderSettings.functionSpecFileName);
@@ -247,7 +247,7 @@ namespace Builder.Engine
dllInfos.AddRange(nugetEngine.dllInfos);
}
//now do a distinct of all dlls paths as multiple packaed might have added same dll
//now do a distinct of all dlls paths as multiple packaged might have added same dll
dllInfos = dllInfos.DistinctBy(x => x.path).ToList();
#if DEBUG
+3 -3
View File
@@ -21,12 +21,12 @@ FROM microsoft/dotnet:aspnetcore-runtime
WORKDIR /app
COPY --from=builderimage /app/out .
#this builder is actually compilation from : https://github.com/fission/fission/tree/master/builder/cmd and renamed cmd.exe to builder
# this builder is actually compilation from : https://github.com/fission/fission/tree/master/builder/cmd and renamed cmd.exe to builder
# make sure to compile it in linux only else you will get exec execute error as binary was compiled in windows and running on linux
COPY --from=fission-builder /builder /builder
#ADD builder /builder
# ADD builder /builder
ADD build.sh /usr/local/bin/build
RUN chmod +x /usr/local/bin/build
@@ -34,4 +34,4 @@ RUN chmod +x /usr/local/bin/build
ADD build.sh /bin/build
RUN chmod +x /bin/build
EXPOSE 8001
EXPOSE 8001
@@ -34,22 +34,22 @@ namespace Fission.DotNetCore.Api
new FissionHttpRequest(request));
}
//this are curruntly dummy , not being implemented, just to pass compilation
//this is a dummy, not being implemented, just to pass compilation
//actual execution is written in environment to use the app settings as there we need it
public T GetSettings<T>(string relativePath)
{
//intentionaly doing it as these are just dummy methods not being called
//intentionally doing it as these are just dummy methods not being called
//but if tomorrow if we decide to give implementation for execution in build then we
//need to implement it
throw new NotImplementedException();
}
//this are curruntly dummy , not being implemented, just to pass compilation
//this is a dummy, not being implemented, just to pass compilation
//actual execution is written in environment to use the app settings as there we need it
private string GetSettingsJson(string relativePath)
{
//intentionaly doing it as these are just dummy methods not being called
//but if tomorrow if we decide to give implementation for execution in build then we
//intentionally doing it as these are just dummy methods not being called
//but tomorrow if we decide to give implementation for execution in build then we
//need to implement it
throw new NotImplementedException();
}
@@ -134,4 +134,4 @@ namespace Fission.DotNetCore.Api
public string Url { get { return _request.Url.ToString(); } }
public string Method { get { return _request.Method; } }
}
}
}
+12 -12
View File
@@ -4,7 +4,7 @@ This is a simple dotnet core 2.0 C# environment builder for Fission.
It's a docker image containing the dotnet 2.0.0 (core) run-time builder. This image read the source package and uses
*roslyn* to compile the source package code and creates deployment package out of it.
This enables using nuget packages as part of function and thus user can use extended functionality in fission functions via nuget.
This enables using nuget packages as part of function and thus user can use extended functionality in fission functions via nuget.
During build , builder also does a pre-compile to prevent any compilation issues during function environment pod specialization.
Thus we get the function compilation issues during builder phase in package info's build logs itself.
@@ -25,7 +25,7 @@ The source package structure in zip file :
```
Source Package zip :
--soruce.zip
--source.zip
|--func.cs
|--nuget.txt
|--exclude.txt
@@ -63,8 +63,8 @@ this should match the following regex as mentions in builderSetting.json
```
"ExcludeDllRegEx": "\\:?\\s*(?<package>[^:\\n]*)(?:\\:)?(?<dll>.*)?",
```
From above , builder will create a deployment package with all dlls in a folder and one functionspecification file :
Deployement Package zip :
From above , builder will create a deployment package with all dlls in a folder and one function specification file :
Deployment Package zip :
```
--Deploye.zip
@@ -77,7 +77,7 @@ this should match the following regex as mentions in builderSetting.json
|--csvhelper.dll
|--logs()
|-->logFileName
|--func.meta.json // this is the functionspecific file
|--func.meta.json // this is the function specific file
|--....MiscFiles(optional)
|--....MiscFiles(optional)
```
@@ -93,19 +93,19 @@ using Fission.DotNetCore.Api;
public class FissionFunction
{
public string Execute(FissionContext context){
string respo="initial value";
string res="initial value";
try
{
context.Logger.WriteInfo("Staring..... ");
respo=$" sample object by getting Enum of CsvHelper nuget dll: { CsvHelper.Caches.NamedIndex.ToString()}";
res=$" sample object by getting Enum of CsvHelper nuget dll: { CsvHelper.Caches.NamedIndex.ToString()}";
}
catch(Exception ex)
{
context.Logger.WriteError(ex.Message);
respo = ex.Message;
res = ex.Message;
}
context.Logger.WriteInfo("Done!");
return respo;
return res;
}
}
```
@@ -116,16 +116,16 @@ CsvHelper
```
**Content of exclude.txt**
As we dont want to exclude any specific dll thus we shall leave it as empty.
As we don't want to exclude any specific dll thus we shall leave it as empty.
Now check name of existing environments & functions as we want to create a unique environment for this dotnetcore if not already present
Now check name of existing environments & functions as we want to create a unique environment for this .Net Core if not already present
```
fission env list
fission fn list
```
Create Environment with builder (choose a unique which doesn't exist , here we have chosen : dotnetcorewithnuget )
also suppose the builder image name is fissiondotnet20-builder and hosted on dockerhub as fission/dotnet20-builder
also suppose the builder image name is fissiondotnet20-builder and hosted on Docker Hub as fission/dotnet20-builder
```
fission environment create --name dotnetcorewithnuget --image fission/dotnet20-env --builder fission/dotnet20-builder
```