Skip to content

Commit 3b0e399

Browse files
authored
Merge branch 'develop' into develop
2 parents 8c0f6e0 + 433dfca commit 3b0e399

File tree

600 files changed

+9619
-8799
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

600 files changed

+9619
-8799
lines changed

.circleci/config.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
version: 2.1
22
orbs:
3-
queue: eddiewebb/queue@1.5.0
3+
queue: eddiewebb/queue@2.2.1
44
jobs:
55
build:
66
docker:
7-
- image: mijitt0m/ocelot-build:0.0.3
7+
- image: mijitt0m/ocelot-build:0.0.9
88
steps:
99
- checkout
10-
- run: make build
10+
- run: dotnet tool restore && dotnet cake
1111
release:
1212
docker:
13-
- image: mijitt0m/ocelot-build:0.0.3
13+
- image: mijitt0m/ocelot-build:0.0.9
1414
steps:
1515
- checkout
16-
- run: make release
16+
- run: dotnet tool restore && dotnet cake --target=Release
1717
workflows:
1818
version: 2
19-
master:
19+
main:
2020
jobs:
2121
- queue/block_workflow:
2222
time: "20"
23-
only-on-branch: master
23+
only-on-branch: main
2424
- release:
2525
requires:
2626
- queue/block_workflow
2727
filters:
2828
branches:
29-
only: master
29+
only: main
3030
develop:
3131
jobs:
3232
- build:
@@ -39,5 +39,5 @@ workflows:
3939
filters:
4040
branches:
4141
ignore:
42-
- master
42+
- main
4343
- develop

.config/dotnet-tools.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"cake.tool": {
6+
"version": "3.0.0",
7+
"commands": [
8+
"dotnet-cake"
9+
]
10+
},
11+
"coveralls.net": {
12+
"version": "4.0.1",
13+
"commands": [
14+
"csmacnz.Coveralls"
15+
]
16+
}
17+
}
18+
}

.dockerignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*/*/bin
22
*/*/obj
33
artifacts/
4-
TestResults/
4+
TestResults/
5+
tools/

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ ClientBin/
183183
*.dbmdl
184184
*.dbproj.schemaview
185185
*.pfx
186-
!idsrv3test.pfx
186+
!mycert.pfx
187187
*.publishsettings
188188
node_modules/
189189
orleans.codegen.cs

Makefile

-24
This file was deleted.

Ocelot.sln

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29613.14
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32112.339
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5CFB79B7-C9DC-45A4-9A75-625D92471702}"
77
EndProject
@@ -50,7 +50,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Kubernetes"
5050
EndProject
5151
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}"
5252
EndProject
53-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotBasic", "samples\OcelotBasic\OcelotBasic.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
53+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotBasic.ApiGateway", "samples\OcelotBasic\Ocelot.Samples.OcelotBasic.ApiGateway.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
5454
EndProject
5555
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdministrationApi", "samples\AdministrationApi\AdministrationApi.csproj", "{B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}"
5656
EndProject
@@ -64,9 +64,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "sample
6464
EndProject
6565
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k8s", "k8s", "{4B706988-4817-43A8-ABE1-32A67998C2C8}"
6666
EndProject
67-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiGateway", "samples\OcelotKube\ApiGateway\ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
67+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.ApiGateway", "samples\OcelotKube\ApiGateway\Ocelot.Samples.OcelotKube.ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
6868
EndProject
69-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "samples\OcelotKube\DownstreamService\DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
69+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.DownstreamService", "samples\OcelotKube\DownstreamService\Ocelot.Samples.OcelotKube.DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
7070
EndProject
7171
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service-fabric", "service-fabric", "{B412628F-C325-47E1-A8D9-873DE04C8AF5}"
7272
EndProject

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
[<img src="https://threemammals.com/images/ocelot_logo.png">](https://threemammals.com/ocelot)
1+
![Ocelot Logo](/images/ocelot_logo.png)
22

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

5-
[![Coverage Status](https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg?branch=master)](https://coveralls.io/github/ThreeMammals/Ocelot?branch=master)
6-
7-
[Slack](https://threemammals.slack.com)
5+
[![Coverage Status](https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg)](https://coveralls.io/github/ThreeMammals/Ocelot)
86

97
# Ocelot
108

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

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

16-
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.
14+
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.
1715

1816
Ocelot is a bunch of middlewares in a specific order.
1917

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

4442
## How to install
4543

46-
Ocelot is designed to work with ASP.NET Core only and it targets `netcoreapp3.1`.
44+
Ocelot is designed to work with ASP.NET and it targets `net7.0`.
4745

4846
Install Ocelot and it's dependencies using NuGet.
4947

build.cake

+51-25
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#tool "nuget:?package=GitVersion.CommandLine&version=5.0.1"
2-
#addin nuget:?package=Cake.Json
1+
#tool "dotnet:?package=GitVersion.Tool&version=5.8.1"
2+
#tool "dotnet:?package=coveralls.net&version=4.0.1"
33
#addin nuget:?package=Newtonsoft.Json
4-
#addin nuget:?package=System.Net.Http&version=4.3.4
54
#addin nuget:?package=System.Text.Encodings.Web&version=4.7.1
6-
#tool "nuget:?package=ReportGenerator"
7-
#tool "nuget:?package=coveralls.net&version=0.7.0"
8-
#addin Cake.Coveralls&version=0.10.1
5+
#tool "nuget:?package=ReportGenerator&version=5.1.19"
6+
#addin Cake.Coveralls&version=1.1.0
97

108
// compile
119
var compileConfig = Argument("configuration", "Release");
@@ -82,20 +80,23 @@ Task("Compile")
8280
.IsDependentOn("Version")
8381
.Does(() =>
8482
{
85-
var settings = new DotNetCoreBuildSettings
83+
var settings = new DotNetBuildSettings
8684
{
8785
Configuration = compileConfig,
8886
};
8987

90-
DotNetCoreBuild(slnFile, settings);
88+
DotNetBuild(slnFile, settings);
9189
});
9290

9391
Task("Clean")
9492
.Does(() =>
9593
{
9694
if (DirectoryExists(artifactsDir))
9795
{
98-
DeleteDirectory(artifactsDir, recursive:true);
96+
DeleteDirectory(artifactsDir, new DeleteDirectorySettings {
97+
Recursive = true,
98+
Force = true
99+
});
99100
}
100101
CreateDirectory(artifactsDir);
101102
});
@@ -176,7 +177,7 @@ Task("RunUnitTests")
176177
.IsDependentOn("Compile")
177178
.Does(() =>
178179
{
179-
var testSettings = new DotNetCoreTestSettings
180+
var testSettings = new DotNetTestSettings
180181
{
181182
Configuration = compileConfig,
182183
ResultsDirectory = artifactsForUnitTestsDir,
@@ -186,17 +187,15 @@ Task("RunUnitTests")
186187
};
187188

188189
EnsureDirectoryExists(artifactsForUnitTestsDir);
189-
DotNetCoreTest(unitTestAssemblies, testSettings);
190+
DotNetTest(unitTestAssemblies, testSettings);
190191

191192
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.cobertura.xml"));
192193
Information(coverageSummaryFile);
193194
Information(artifactsForUnitTestsDir);
194195

195-
// todo bring back report generator to get a friendly report
196-
// ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
197-
// https://github.com/danielpalme/ReportGenerator
196+
GenerateReport(coverageSummaryFile);
198197

199-
if (IsRunningOnCircleCI() && IsMaster())
198+
if (IsRunningOnCircleCI() && IsMainOrDevelop())
200199
{
201200
var repoToken = EnvironmentVariable(coverallsRepoToken);
202201
if (string.IsNullOrEmpty(repoToken))
@@ -231,7 +230,7 @@ Task("RunAcceptanceTests")
231230
.IsDependentOn("Compile")
232231
.Does(() =>
233232
{
234-
var settings = new DotNetCoreTestSettings
233+
var settings = new DotNetTestSettings
235234
{
236235
Configuration = compileConfig,
237236
ArgumentCustomization = args => args
@@ -240,14 +239,14 @@ Task("RunAcceptanceTests")
240239
};
241240

242241
EnsureDirectoryExists(artifactsForAcceptanceTestsDir);
243-
DotNetCoreTest(acceptanceTestAssemblies, settings);
242+
DotNetTest(acceptanceTestAssemblies, settings);
244243
});
245244

246245
Task("RunIntegrationTests")
247246
.IsDependentOn("Compile")
248247
.Does(() =>
249248
{
250-
var settings = new DotNetCoreTestSettings
249+
var settings = new DotNetTestSettings
251250
{
252251
Configuration = compileConfig,
253252
ArgumentCustomization = args => args
@@ -256,7 +255,7 @@ Task("RunIntegrationTests")
256255
};
257256

258257
EnsureDirectoryExists(artifactsForIntegrationTestsDir);
259-
DotNetCoreTest(integrationTestAssemblies, settings);
258+
DotNetTest(integrationTestAssemblies, settings);
260259
});
261260

262261
Task("CreateArtifacts")
@@ -364,6 +363,21 @@ Task("PublishToNuget")
364363

365364
RunTarget(target);
366365

366+
private void GenerateReport(Cake.Core.IO.FilePath coverageSummaryFile)
367+
{
368+
var dir = System.IO.Directory.GetCurrentDirectory();
369+
Information(dir);
370+
371+
var reportSettings = new ProcessArgumentBuilder();
372+
reportSettings.Append($"-targetdir:" + $"{dir}/{artifactsForUnitTestsDir}");
373+
reportSettings.Append($"-reports:" + coverageSummaryFile);
374+
375+
var toolpath = Context.Tools.Resolve("net7.0/ReportGenerator.dll");
376+
Information($"Tool Path : {toolpath.ToString()}");
377+
378+
DotNetExecute(toolpath, reportSettings);
379+
}
380+
367381
/// Gets unique nuget version for this commit
368382
private GitVersion GetNuGetVersionForCommit()
369383
{
@@ -416,9 +430,9 @@ private void PublishPackages(ConvertableDirectoryPath packagesDir, ConvertableFi
416430

417431
Information("Calling NuGetPush");
418432

419-
NuGetPush(
433+
DotNetNuGetPush(
420434
codePackage,
421-
new NuGetPushSettings {
435+
new DotNetNuGetPushSettings {
422436
ApiKey = feedApiKey,
423437
Source = codeFeedUrl
424438
});
@@ -427,7 +441,7 @@ private void PublishPackages(ConvertableDirectoryPath packagesDir, ConvertableFi
427441

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

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

@@ -483,7 +497,7 @@ private void UploadFileToGitHubRelease(FilePath file)
483497

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

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

544-
private bool IsMaster()
558+
private bool IsMainOrDevelop()
545559
{
546-
return Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower() == "master";
560+
var env = Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower();
561+
562+
if(env == "main")
563+
{
564+
return true;
565+
}
566+
567+
if(env == "develop")
568+
{
569+
return true;
570+
}
571+
572+
return false;
547573
}

0 commit comments

Comments
 (0)