Skip to content

Commit

Permalink
Merge branch 'develop' into improvement_regex
Browse files Browse the repository at this point in the history
  • Loading branch information
raman-m committed Jul 17, 2023
2 parents 9ba1128 + 433dfca commit 329d2c3
Show file tree
Hide file tree
Showing 600 changed files with 9,611 additions and 8,796 deletions.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
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.3
- image: mijitt0m/ocelot-build:0.0.9
steps:
- checkout
- run: make build
- run: dotnet tool restore && dotnet cake
release:
docker:
- image: mijitt0m/ocelot-build:0.0.3
- image: mijitt0m/ocelot-build:0.0.9
steps:
- checkout
- run: make release
- run: dotnet tool restore && dotnet cake --target=Release
workflows:
version: 2
master:
main:
jobs:
- queue/block_workflow:
time: "20"
only-on-branch: master
only-on-branch: main
- release:
requires:
- queue/block_workflow
filters:
branches:
only: master
only: main
develop:
jobs:
- build:
Expand All @@ -39,5 +39,5 @@ workflows:
filters:
branches:
ignore:
- master
- main
- develop
18 changes: 18 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "3.0.0",
"commands": [
"dotnet-cake"
]
},
"coveralls.net": {
"version": "4.0.1",
"commands": [
"csmacnz.Coveralls"
]
}
}
}
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*/*/bin
*/*/obj
artifacts/
TestResults/
TestResults/
tools/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ ClientBin/
*.dbmdl
*.dbproj.schemaview
*.pfx
!idsrv3test.pfx
!mycert.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
Expand Down
24 changes: 0 additions & 24 deletions Makefile

This file was deleted.

10 changes: 5 additions & 5 deletions Ocelot.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5CFB79B7-C9DC-45A4-9A75-625D92471702}"
EndProject
Expand Down Expand Up @@ -50,7 +50,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Kubernetes"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotBasic", "samples\OcelotBasic\OcelotBasic.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotBasic.ApiGateway", "samples\OcelotBasic\Ocelot.Samples.OcelotBasic.ApiGateway.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdministrationApi", "samples\AdministrationApi\AdministrationApi.csproj", "{B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}"
EndProject
Expand All @@ -64,9 +64,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "sample
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k8s", "k8s", "{4B706988-4817-43A8-ABE1-32A67998C2C8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiGateway", "samples\OcelotKube\ApiGateway\ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.ApiGateway", "samples\OcelotKube\ApiGateway\Ocelot.Samples.OcelotKube.ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "samples\OcelotKube\DownstreamService\DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.DownstreamService", "samples\OcelotKube\DownstreamService\Ocelot.Samples.OcelotKube.DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service-fabric", "service-fabric", "{B412628F-C325-47E1-A8D9-873DE04C8AF5}"
EndProject
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[<img src="https://threemammals.com/images/ocelot_logo.png">](https://threemammals.com/ocelot)
![Ocelot Logo](/images/ocelot_logo.png)

[![CircleCI](https://circleci.com/gh/ThreeMammals/Ocelot/tree/master.svg?style=svg)](https://circleci.com/gh/ThreeMammals/Ocelot/tree/master)
[![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=master)](https://coveralls.io/github/ThreeMammals/Ocelot?branch=master)

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

# Ocelot

Expand All @@ -13,7 +11,7 @@ that need a unified point of entry into their system. However it will work with

In particular I want easy integration with IdentityServer reference and bearer tokens.

We have been unable to find this in my current workplacewithout having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already existsto do this.
We have been unable to find this in my current workplace without having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already exists to do this.

Ocelot is a bunch of middlewares in a specific order.

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 Core only and it targets `netcoreapp3.1`.
Ocelot is designed to work with ASP.NET and it targets `net7.0`.

Install Ocelot and it's dependencies using NuGet.

Expand Down
76 changes: 51 additions & 25 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#tool "nuget:?package=GitVersion.CommandLine&version=5.0.1"
#addin nuget:?package=Cake.Json
#tool "dotnet:?package=GitVersion.Tool&version=5.8.1"
#tool "dotnet:?package=coveralls.net&version=4.0.1"
#addin nuget:?package=Newtonsoft.Json
#addin nuget:?package=System.Net.Http&version=4.3.4
#addin nuget:?package=System.Text.Encodings.Web&version=4.7.1
#tool "nuget:?package=ReportGenerator"
#tool "nuget:?package=coveralls.net&version=0.7.0"
#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 @@ -82,20 +80,23 @@ Task("Compile")
.IsDependentOn("Version")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
var settings = new DotNetBuildSettings
{
Configuration = compileConfig,
};
DotNetCoreBuild(slnFile, settings);
DotNetBuild(slnFile, settings);
});

Task("Clean")
.Does(() =>
{
if (DirectoryExists(artifactsDir))
{
DeleteDirectory(artifactsDir, recursive:true);
DeleteDirectory(artifactsDir, new DeleteDirectorySettings {
Recursive = true,
Force = true
});
}
CreateDirectory(artifactsDir);
});
Expand Down Expand Up @@ -176,7 +177,7 @@ Task("RunUnitTests")
.IsDependentOn("Compile")
.Does(() =>
{
var testSettings = new DotNetCoreTestSettings
var testSettings = new DotNetTestSettings
{
Configuration = compileConfig,
ResultsDirectory = artifactsForUnitTestsDir,
Expand All @@ -186,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() && IsMaster())
if (IsRunningOnCircleCI() && IsMainOrDevelop())
{
var repoToken = EnvironmentVariable(coverallsRepoToken);
if (string.IsNullOrEmpty(repoToken))
Expand Down Expand Up @@ -231,7 +230,7 @@ Task("RunAcceptanceTests")
.IsDependentOn("Compile")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
var settings = new DotNetTestSettings
{
Configuration = compileConfig,
ArgumentCustomization = args => args
Expand All @@ -240,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 @@ -256,7 +255,7 @@ Task("RunIntegrationTests")
};
EnsureDirectoryExists(artifactsForIntegrationTestsDir);
DotNetCoreTest(integrationTestAssemblies, settings);
DotNetTest(integrationTestAssemblies, settings);
});

Task("CreateArtifacts")
Expand Down Expand Up @@ -364,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 @@ -416,9 +430,9 @@ private void PublishPackages(ConvertableDirectoryPath packagesDir, ConvertableFi

Information("Calling NuGetPush");

NuGetPush(
DotNetNuGetPush(
codePackage,
new NuGetPushSettings {
new DotNetNuGetPushSettings {
ApiKey = feedApiKey,
Source = codeFeedUrl
});
Expand All @@ -427,7 +441,7 @@ private void PublishPackages(ConvertableDirectoryPath packagesDir, ConvertableFi

private void CreateGitHubRelease()
{
var json = $"{{ \"tag_name\": \"{versioning.NuGetVersion}\", \"target_commitish\": \"master\", \"name\": \"{versioning.NuGetVersion}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": true, \"prerelease\": true }}";
var json = $"{{ \"tag_name\": \"{versioning.NuGetVersion}\", \"target_commitish\": \"main\", \"name\": \"{versioning.NuGetVersion}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": true, \"prerelease\": true }}";

var content = new System.Net.Http.StringContent(json, System.Text.Encoding.UTF8, "application/json");

Expand Down Expand Up @@ -483,7 +497,7 @@ private void UploadFileToGitHubRelease(FilePath file)

private void CompleteGitHubRelease()
{
var json = $"{{ \"tag_name\": \"{versioning.NuGetVersion}\", \"target_commitish\": \"master\", \"name\": \"{versioning.NuGetVersion}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": false, \"prerelease\": false }}";
var json = $"{{ \"tag_name\": \"{versioning.NuGetVersion}\", \"target_commitish\": \"main\", \"name\": \"{versioning.NuGetVersion}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": false, \"prerelease\": false }}";
var request = new System.Net.Http.HttpRequestMessage(new System.Net.Http.HttpMethod("Patch"), $"https://api.github.com/repos/ThreeMammals/Ocelot/releases/{releaseId}");
request.Content = new System.Net.Http.StringContent(json, System.Text.Encoding.UTF8, "application/json");

Expand Down Expand Up @@ -541,7 +555,19 @@ private bool IsRunningOnCircleCI()
return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CIRCLECI"));
}

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

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

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

return false;
}

0 comments on commit 329d2c3

Please sign in to comment.