Skip to content

Commit

Permalink
Merge branch 'develop' into Rate_linit_counting_interval_fix__issue_#…
Browse files Browse the repository at this point in the history
…1590
  • Loading branch information
raman-m committed May 11, 2023
2 parents 1552941 + bc25f4e commit a26e1ac
Show file tree
Hide file tree
Showing 516 changed files with 5,623 additions and 4,332 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
@@ -1,16 +1,16 @@
version: 2.1
orbs:
queue: eddiewebb/queue@1.5.0
queue: eddiewebb/queue@2.2.1
jobs:
build:
docker:
- image: mijitt0m/ocelot-build:0.0.6
- image: mijitt0m/ocelot-build:0.0.9
steps:
- checkout
- run: dotnet tool restore && dotnet cake
release:
docker:
- image: mijitt0m/ocelot-build:0.0.6
- image: mijitt0m/ocelot-build:0.0.9
steps:
- checkout
- run: dotnet tool restore && dotnet cake --target=Release
Expand Down
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Expand Up @@ -3,13 +3,13 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.0.0",
"version": "3.0.0",
"commands": [
"dotnet-cake"
]
},
"coveralls.net": {
"version": "3.0.0",
"version": "4.0.1",
"commands": [
"csmacnz.Coveralls"
]
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -183,7 +183,7 @@ ClientBin/
*.dbmdl
*.dbproj.schemaview
*.pfx
!idsrv3test.pfx
!mycert.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
Expand Down
8 changes: 3 additions & 5 deletions README.md
@@ -1,10 +1,8 @@
![Ocelot Logo](/images/ocelot_logo.png)
![Ocelot Logo](/images/ocelot_logo.png)

[![CircleCI](https://circleci.com/gh/ThreeMammals/Ocelot/tree/main.svg?style=svg)](https://circleci.com/gh/ThreeMammals/Ocelot/tree/main)

[![Coverage Status](https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg?branch=main)](https://coveralls.io/github/ThreeMammals/Ocelot?branch=main)

[Slack](https://threemammals.slack.com)
[![Coverage Status](https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg)](https://coveralls.io/github/ThreeMammals/Ocelot)

# Ocelot

Expand Down Expand Up @@ -43,7 +41,7 @@ A quick list of Ocelot's capabilities for more information see the [documentatio

## How to install

Ocelot is designed to work with ASP.NET and it targets `net6.0`.
Ocelot is designed to work with ASP.NET and it targets `net7.0`.

Install Ocelot and it's dependencies using NuGet.

Expand Down
56 changes: 40 additions & 16 deletions build.cake
@@ -1,10 +1,9 @@
#tool "dotnet:?package=GitVersion.Tool&version=5.8.1"
#tool "dotnet:?package=coveralls.net&version=3.0.0"
#addin nuget:?package=Cake.Json&version=4.0.0
#tool "dotnet:?package=coveralls.net&version=4.0.1"
#addin nuget:?package=Newtonsoft.Json
#addin nuget:?package=System.Text.Encodings.Web&version=4.7.1
#tool "nuget:?package=ReportGenerator"
#addin Cake.Coveralls&version=0.10.1
#tool "nuget:?package=ReportGenerator&version=5.1.19"
#addin Cake.Coveralls&version=1.1.0

// compile
var compileConfig = Argument("configuration", "Release");
Expand Down Expand Up @@ -178,7 +177,7 @@ Task("RunUnitTests")
.IsDependentOn("Compile")
.Does(() =>
{
var testSettings = new DotNetCoreTestSettings
var testSettings = new DotNetTestSettings
{
Configuration = compileConfig,
ResultsDirectory = artifactsForUnitTestsDir,
Expand All @@ -188,17 +187,15 @@ Task("RunUnitTests")
};
EnsureDirectoryExists(artifactsForUnitTestsDir);
DotNetCoreTest(unitTestAssemblies, testSettings);
DotNetTest(unitTestAssemblies, testSettings);
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.cobertura.xml"));
Information(coverageSummaryFile);
Information(artifactsForUnitTestsDir);
// todo bring back report generator to get a friendly report
// ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
// https://github.com/danielpalme/ReportGenerator
GenerateReport(coverageSummaryFile);
if (IsRunningOnCircleCI() && IsMain())
if (IsRunningOnCircleCI() && IsMainOrDevelop())
{
var repoToken = EnvironmentVariable(coverallsRepoToken);
if (string.IsNullOrEmpty(repoToken))
Expand Down Expand Up @@ -233,7 +230,7 @@ Task("RunAcceptanceTests")
.IsDependentOn("Compile")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
var settings = new DotNetTestSettings
{
Configuration = compileConfig,
ArgumentCustomization = args => args
Expand All @@ -242,14 +239,14 @@ Task("RunAcceptanceTests")
};
EnsureDirectoryExists(artifactsForAcceptanceTestsDir);
DotNetCoreTest(acceptanceTestAssemblies, settings);
DotNetTest(acceptanceTestAssemblies, settings);
});

Task("RunIntegrationTests")
.IsDependentOn("Compile")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
var settings = new DotNetTestSettings
{
Configuration = compileConfig,
ArgumentCustomization = args => args
Expand All @@ -258,7 +255,7 @@ Task("RunIntegrationTests")
};
EnsureDirectoryExists(artifactsForIntegrationTestsDir);
DotNetCoreTest(integrationTestAssemblies, settings);
DotNetTest(integrationTestAssemblies, settings);
});

Task("CreateArtifacts")
Expand Down Expand Up @@ -366,6 +363,21 @@ Task("PublishToNuget")

RunTarget(target);

private void GenerateReport(Cake.Core.IO.FilePath coverageSummaryFile)
{
var dir = System.IO.Directory.GetCurrentDirectory();
Information(dir);

var reportSettings = new ProcessArgumentBuilder();
reportSettings.Append($"-targetdir:" + $"{dir}/{artifactsForUnitTestsDir}");
reportSettings.Append($"-reports:" + coverageSummaryFile);

var toolpath = Context.Tools.Resolve("net7.0/ReportGenerator.dll");
Information($"Tool Path : {toolpath.ToString()}");

DotNetExecute(toolpath, reportSettings);
}

/// Gets unique nuget version for this commit
private GitVersion GetNuGetVersionForCommit()
{
Expand Down Expand Up @@ -543,7 +555,19 @@ private bool IsRunningOnCircleCI()
return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CIRCLECI"));
}

private bool IsMain()
private bool IsMainOrDevelop()
{
return Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower() == "main";
var env = Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower();

if(env == "main")
{
return true;
}

if(env == "develop")
{
return true;
}

return false;
}
7 changes: 3 additions & 4 deletions docker/Dockerfile.base
@@ -1,10 +1,9 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine

RUN apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib
RUN apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib git openssh-client

RUN curl -L --output ./dotnet-install.sh https://dot.net/v1/dotnet-install.sh

RUN chmod u+x ./dotnet-install.sh

RUN ./dotnet-install.sh -c 5.0 -i /usr/share/dotnet
RUN ./dotnet-install.sh -c 6.0 -i /usr/share/dotnet
3 changes: 1 addition & 2 deletions docker/Dockerfile.build
@@ -1,8 +1,7 @@
# syntax=docker/dockerfile:1
# call from ocelot repo root with
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
FROM mijitt0m/ocelot-build:0.0.6
FROM mijitt0m/ocelot-build:0.0.9

ARG OCELOT_COVERALLS_TOKEN

Expand Down
3 changes: 1 addition & 2 deletions docker/Dockerfile.release
@@ -1,8 +1,7 @@
# syntax=docker/dockerfile:1
# call from ocelot repo root with
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
FROM mijitt0m/ocelot-build:0.0.6
FROM mijitt0m/ocelot-build:0.0.9

ARG OCELOT_COVERALLS_TOKEN
ARG OCELOT_NUTGET_API_KEY
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
@@ -1,5 +1,5 @@
# this script build the ocelot docker file
version=0.0.6
version=0.0.9
docker build --platform linux/amd64 -t mijitt0m/ocelot-build -f Dockerfile.base .
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
docker tag mijitt0m/ocelot-build mijitt0m/ocelot-build:$version
Expand Down
2 changes: 1 addition & 1 deletion docs/building/building.rst
Expand Up @@ -7,4 +7,4 @@ Building

* There is a Makefile to make it easier to call the various targers in `build.cake`. The scripts are called with .sh but can be easily changed to ps1 if you are using Windows.

* Alternatively you can build the project in VS2022 with the latest .NET 6.0 SDK.
* Alternatively you can build the project in VS2022 with the latest .NET 7.0 SDK.
11 changes: 11 additions & 0 deletions docs/building/tests.rst
Expand Up @@ -4,4 +4,15 @@ Tests
The tests should all just run and work as part of the build process. You can of course also run them in visual studio.


Create SSL Cert for Testing
^^^^^^^^^^^^^^^^^^^^^^^^^^^

You can do this via openssl:

Install openssl package (if you are using Windows, download binaries here).

Generate private key: `openssl genrsa 2048 > private.pem`

Generate the self signed certificate: `openssl req -x509 -days 1000 -new -key private.pem -out public.pem`

If needed, create PFX: `openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx`
2 changes: 1 addition & 1 deletion docs/introduction/gettingstarted.rst
Expand Up @@ -3,7 +3,7 @@ Getting Started

Ocelot is designed to work with ASP.NET and is currently on net6.0.

.NET 6.0
.NET 7.0
^^^^^^^^

**Install NuGet package**
Expand Down
6 changes: 3 additions & 3 deletions samples/AdministrationApi/AdministrationApi.csproj
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Ocelot" Version="17.0.1" />
<PackageReference Include="Ocelot.Administration" Version="17.0.1" />
<PackageReference Include="Ocelot" Version="18.0.0" />
<PackageReference Include="Ocelot.Administration" Version="18.0.0" />

</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions samples/AdministrationApi/Issue645.postman_collection.json
Expand Up @@ -132,7 +132,7 @@
"id": "0f60e7b3-e4f1-4458-bbc4-fc4809e86b2d",
"type": "text/javascript",
"exec": [
""
string.Empty
]
}
},
Expand All @@ -142,7 +142,7 @@
"id": "1279a2cf-b771-4a86-9dfa-302b240fac62",
"type": "text/javascript",
"exec": [
""
string.Empty
]
}
}
Expand Down
69 changes: 36 additions & 33 deletions samples/AdministrationApi/Program.cs
@@ -1,45 +1,48 @@
using Microsoft.AspNetCore.Hosting;
using System.IO;

using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

using Ocelot.Administration;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using System.IO;

namespace AdministrationApi
{
public class Program
{
public static void Main(string[] args)
{
new WebHostBuilder()
.UseKestrel()
.UseUrls("http://localhost:5000")
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
config
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
.AddJsonFile("ocelot.json")
.AddEnvironmentVariables();
})
.ConfigureServices(s => {
s.AddOcelot()
.AddAdministration("/administration", "secret");
})
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole();
})
.UseIISIntegration()
.Configure(app =>
{
app.UseOcelot().Wait();
})
.Build()
.Run();
public static void Main(string[] args)
{
new WebHostBuilder()
.UseKestrel()
.UseUrls("http://localhost:5000")
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
config
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
.AddJsonFile("ocelot.json")
.AddEnvironmentVariables();
})
.ConfigureServices(s =>
{
s.AddOcelot()
.AddAdministration("/administration", "secret");
})
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole();
})
.UseIISIntegration()
.Configure(app =>
{
app.UseOcelot().Wait();
})
.Build()
.Run();
}
}
}
}
4 changes: 2 additions & 2 deletions samples/OcelotBasic/OcelotBasic.csproj
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ocelot" Version="17.0.1" />
<PackageReference Include="ocelot" Version="18.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit a26e1ac

Please sign in to comment.