From 9ee9b640442be7b193a6ee937ca71bc02b96f19b Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Wed, 4 Dec 2024 16:32:00 +0300 Subject: [PATCH 01/22] Update Docker --- docker/8.21.0/Dockerfile.build | 17 ------------ docker/8.21.0/Dockerfile.release | 21 --------------- docker/8.21.0/build.sh | 11 -------- docker/Dockerfile.base | 19 +++++-------- docker/Dockerfile.windows | 24 +++++++++++++++++ docker/README.md | 27 +++++++++++++++---- docker/build-windows.sh | 10 +++++++ docker/build.sh | 17 ++++++------ .../Dockerfile.8.21.0.base} | 0 docker/outdated/Dockerfile.8.23.2.base | 25 +++++++++++++++++ 10 files changed, 96 insertions(+), 75 deletions(-) delete mode 100644 docker/8.21.0/Dockerfile.build delete mode 100644 docker/8.21.0/Dockerfile.release delete mode 100644 docker/8.21.0/build.sh create mode 100644 docker/Dockerfile.windows create mode 100644 docker/build-windows.sh rename docker/{8.21.0/Dockerfile.base => outdated/Dockerfile.8.21.0.base} (100%) create mode 100644 docker/outdated/Dockerfile.8.23.2.base diff --git a/docker/8.21.0/Dockerfile.build b/docker/8.21.0/Dockerfile.build deleted file mode 100644 index 51dff57ff..000000000 --- a/docker/8.21.0/Dockerfile.build +++ /dev/null @@ -1,17 +0,0 @@ -# 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 ocelot2/circleci-build:8.21.0 - -ARG OCELOT_COVERALLS_TOKEN - -ENV OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN - -WORKDIR /build - -COPY ./. . - -RUN dotnet tool restore - -RUN dotnet cake diff --git a/docker/8.21.0/Dockerfile.release b/docker/8.21.0/Dockerfile.release deleted file mode 100644 index 90e2d6ee1..000000000 --- a/docker/8.21.0/Dockerfile.release +++ /dev/null @@ -1,21 +0,0 @@ -# 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 ocelot2/circleci-build:8.21.0 - -ARG OCELOT_COVERALLS_TOKEN -ARG OCELOT_NUTGET_API_KEY -ARG OCELOT_GITHUB_API_KEY - -ENV OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -ENV OCELOT_NUTGET_API_KEY=$OCELOT_NUTGET_API_KEY -ENV OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY - -WORKDIR /build - -COPY ./. . - -RUN dotnet tool restore - -RUN dotnet cake diff --git a/docker/8.21.0/build.sh b/docker/8.21.0/build.sh deleted file mode 100644 index 15d1325ad..000000000 --- a/docker/8.21.0/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -# This script builds the Ocelot Docker file - -# {DotNetSdkVer}.{OcelotVer} -> {.NET8}.{21.0} -> 8.21.0 -version=8.21.0 -docker build --platform linux/amd64 -t ocelot2/circleci-build -f Dockerfile.base . - -echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin - -docker tag ocelot2/circleci-build ocelot2/circleci-build:$version -docker push ocelot2/circleci-build:latest -docker push ocelot2/circleci-build:$version diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index d2387c9fc..c9f68af85 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -1,23 +1,16 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine +FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine RUN apk add bash icu-libs krb5-libs libgcc libintl libssl3 libstdc++ zlib git openssh-client +# Install .NET 8 SDK RUN curl -L --output ./dotnet-install.sh https://dot.net/v1/dotnet-install.sh - RUN chmod u+x ./dotnet-install.sh - -# Install .NET 8 SDK (already included in the base image, but listed for consistency) RUN ./dotnet-install.sh -c 8.0 -i /usr/share/dotnet -# Install .NET 7 SDK -RUN ./dotnet-install.sh -c 7.0 -i /usr/share/dotnet - -# Install .NET 6 SDK -RUN ./dotnet-install.sh -c 6.0 -i /usr/share/dotnet - -# Generate and export the development certificate -RUN dotnet dev-certs https -ep /certs/cert.pem -p '' && \ - chmod 644 /certs/cert.pem +# Generate and export the development SSL certificate +RUN mkdir -p /certs +RUN dotnet dev-certs https -ep /certs/cert.pem -p '' +RUN chmod 644 /certs/cert.pem ENV ASPNETCORE_URLS="https://+;http://+" ENV ASPNETCORE_HTTPS_PORT=443 diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows new file mode 100644 index 000000000..554c022ea --- /dev/null +++ b/docker/Dockerfile.windows @@ -0,0 +1,24 @@ +FROM mcr.microsoft.com/dotnet/sdk:9.0-nanoserver-ltsc2022 + +# Install PowerShell globally AND RUN powershell -Command "gci" +#RUN dotnet tool install -g powershell && pwsh -Command "gci" +RUN pwsh -Command "gci" + +# # Install .NET 8 SDK +USER ContainerAdministrator +RUN pwsh -Command "Invoke-WebRequest -OutFile dotnet-install.ps1 https://dot.net/v1/dotnet-install.ps1; gci" +ENV DOTNET_GENERATE_ASPNET_CERTIFICATE=true +RUN pwsh -Command "./dotnet-install.ps1 -Channel 8.0 -InstallDir 'C:\Program Files\dotnet\'; gci -Path C:\\ -Recurse -Include *8.0* -Directory" + +#RUN git status +RUN dotnet --info + +# Generate and export the development SSL certificate +#RUN mkdir -p certs +#RUN dotnet dev-certs https -ep certs/cert.pem -p '' +#RUN pwsh -Command "dotnet dev-certs https --clean; dotnet dev-certs https; exit 0;" +#RUN pwsh -Command "dotnet dev-certs https --trust; exit 0;" +RUN pwsh -Command "dotnet dev-certs https --check --trust; exit 0;" + +#ENV ASPNETCORE_URLS="https://+;http://+" ASPNETCORE_HTTPS_PORT=443 +#ENV ASPNETCORE_Kestrel__Certificates__Default__Password="" ASPNETCORE_Kestrel__Certificates__Default__Path=certs/cert.pem diff --git a/docker/README.md b/docker/README.md index cc1e409bd..1f2855597 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,14 +1,31 @@ # docker build -This folder contains the `Dockerfile.*` and `build.sh` script to create the Ocelot build image & container. +This folder contains the `Dockerfile.*` and `build-*.sh` scripts to create the Ocelot build image & container. ## Account -- [Ocelot Gateway Profile | Docker Hub](https://hub.docker.com/u/ocelot2) +- Docker Hub | [Ocelot Gateway](https://hub.docker.com/u/ocelot2) ## Repositories - [circleci-build](https://hub.docker.com/r/ocelot2/circleci-build) -## ocelot2/circleci-build Tags -- [latest](https://hub.docker.com/layers/ocelot2/circleci-build/latest/images/sha256-981d6f9e6e5ba54f6e044bca6fcf8b5197a8f3e6ce2b3cdfa9e6704ecd2ca969?context=explore) is version 8.23.2, uploaded on Apr 3, 2024. -- [8.23.2](https://hub.docker.com/layers/ocelot2/circleci-build/8.23.2/images/sha256-981d6f9e6e5ba54f6e044bca6fcf8b5197a8f3e6ce2b3cdfa9e6704ecd2ca969?context=explore), uploaded on Apr 3, 2024. It supports development SSL certificates by the command `dotnet dev-certs https`. +## Outdated Tags - [8.21.0](https://hub.docker.com/layers/ocelot2/circleci-build/8.21.0/images/sha256-edb46d37ab52d39a5b27dc63895e5944d4d491d1788744ed144ecb4303b94532?context=explore), uploaded on Nov 20, 2023. It contains .NET 8, 7 and 6 SDKs. It supports builds for `net6.0`, `net7.0` and `net8.0` frameworks. +- [8.23.2](https://hub.docker.com/layers/ocelot2/circleci-build/8.23.2/images/sha256-981d6f9e6e5ba54f6e044bca6fcf8b5197a8f3e6ce2b3cdfa9e6704ecd2ca969?context=explore), uploaded on Apr 3, 2024. It supports development SSL certificates by the command `dotnet dev-certs https`. +- [latest](https://hub.docker.com/layers/ocelot2/circleci-build/latest/images/sha256-981d6f9e6e5ba54f6e044bca6fcf8b5197a8f3e6ce2b3cdfa9e6704ecd2ca969?context=explore) is version 8.23.2, uploaded on Apr 3, 2024. + +## .NET 8-9 Tags + +### Single SDK Tags +- [sdk-8-alpine-lin.net8](https://hub.docker.com/layers/ocelot2/circleci-build/sdk-8-alpine-lin.net8/images/sha256-17c21438771641ba2a3320a6c13fe756a851d707a925188d9616485bfc757b22?context=explore), uploaded on Dec 3, 2024. This Linux OS image contains .NET 8 SDK only. It supports builds for `net8.0` framework. +- [sdk-9-alpine-lin.net9](https://hub.docker.com/layers/ocelot2/circleci-build/sdk-9-alpine-lin.net9/images/sha256-c20d82a52c1a7eebf86bcd32751960ae189e6c50575959ee0499b1d88541c9ea?context=explore), uploaded on Dec 3, 2024. This Linux OS image contains .NET 9 SDK only. It supports builds for `net9.0` framework. +- [sdk8-nanoserver2022-win.net8](https://hub.docker.com/layers/ocelot2/circleci-build/sdk8-nanoserver2022-win.net8/images/sha256-20f21f4361d18301bc885e1f01ebefcd6b024802130db1296173cdfaac5d75e6?context=explore), uploaded on Dec 3, 2024. This Windows OS image contains .NET 8 SDK only. It supports builds for `net8.0` framework. +- [sdk9-nano2022-win.net9](https://hub.docker.com/layers/ocelot2/circleci-build/sdk9-nano2022-win.net9/images/sha256-37b718885f8cfb3480299f48044836f01aec2370e331667dd1811a4c94a4ce45?context=explore), uploaded on Dec 3, 2024. This Windows OS image contains .NET 9 SDK only. It supports builds for `net9.0` framework. + +### Double SDKs Tags +- [sdk9-alpine-lin.net8-9](https://hub.docker.com/layers/ocelot2/circleci-build/sdk9-alpine-lin.net8-9/images/sha256-707924d144248178caff80578649f7d0e9b7c70ed51b6fb5171170c9a30a4eae?context=explore) aka [9.24.0](https://hub.docker.com/layers/ocelot2/circleci-build/9.24.0/images/sha256-707924d144248178caff80578649f7d0e9b7c70ed51b6fb5171170c9a30a4eae?context=explore), uploaded on Dec 3, 2023. This Linux OS image contains .NET 8 and 9 SDKs. It supports builds for `net8.0` and `net9.0` frameworks. +- [sdk9-nano2022-win.net8-9](https://hub.docker.com/layers/ocelot2/circleci-build/sdk9-nano2022-win.net8-9/images/sha256-6e44a8fc52ab091ea43090b6ab182f7a05d7ac31402ce742a7e035323e584cf7?context=explore) aka [9.24.win](https://hub.docker.com/layers/ocelot2/circleci-build/9.24.win/images/sha256-6e44a8fc52ab091ea43090b6ab182f7a05d7ac31402ce742a7e035323e584cf7?context=explore), uploaded on Dec 4, 2023. This Windows OS image contains .NET 8 and 9 SDKs. It supports builds for `net8.0` and `net9.0` frameworks. + +### Links +- Docker Hub | [Microsoft dotnet Images](https://hub.docker.com/r/microsoft/dotnet) +- GitHub | dotnet-docker | [.NET SDK](https://github.com/dotnet/dotnet-docker/blob/main/README.sdk.md) +- StackOverflow | [PowerShell and process exit codes](https://stackoverflow.com/questions/57468522/powershell-and-process-exit-codes) diff --git a/docker/build-windows.sh b/docker/build-windows.sh new file mode 100644 index 000000000..5b98a32b3 --- /dev/null +++ b/docker/build-windows.sh @@ -0,0 +1,10 @@ +version=9.24.win +tag=sdk9-nano2022-win.net8-9 + +docker build --no-cache --platform windows/amd64 -t ocelot2/circleci-build -f Dockerfile.windows . + +docker tag ocelot2/circleci-build ocelot2/circleci-build:$tag +docker push ocelot2/circleci-build:$tag + +docker tag ocelot2/circleci-build ocelot2/circleci-build:$version +docker push ocelot2/circleci-build:$version diff --git a/docker/build.sh b/docker/build.sh index 54f16bb96..5aa8f7ae9 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,11 +1,12 @@ # This script builds the Ocelot Docker file +# echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin -# {DotNetSdkVer}.{OcelotVer} -> {.NET8}.{23.2} -> 8.23.2 -version=8.23.2 -docker build --platform linux/amd64 -t ocelot2/circleci-build -f Dockerfile.base . - -echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin +# {DotNetSdkVer}.{OcelotVer} -> {.NET9}.{24.0} -> 9.24.0 +#version=9.24.0 +tag=sdk9-alpine-lin.net8-9 -docker tag ocelot2/circleci-build ocelot2/circleci-build:$version -docker push ocelot2/circleci-build:latest -docker push ocelot2/circleci-build:$version +docker build --platform linux/amd64 -t ocelot2/circleci-build -f Dockerfile.base . +docker tag ocelot2/circleci-build ocelot2/circleci-build:$tag +docker push ocelot2/circleci-build:$tag +# docker tag ocelot2/circleci-build ocelot2/circleci-build:$version +# docker push ocelot2/circleci-build:$version diff --git a/docker/8.21.0/Dockerfile.base b/docker/outdated/Dockerfile.8.21.0.base similarity index 100% rename from docker/8.21.0/Dockerfile.base rename to docker/outdated/Dockerfile.8.21.0.base diff --git a/docker/outdated/Dockerfile.8.23.2.base b/docker/outdated/Dockerfile.8.23.2.base new file mode 100644 index 000000000..d2387c9fc --- /dev/null +++ b/docker/outdated/Dockerfile.8.23.2.base @@ -0,0 +1,25 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine + +RUN apk add bash icu-libs krb5-libs libgcc libintl libssl3 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 + +# Install .NET 8 SDK (already included in the base image, but listed for consistency) +RUN ./dotnet-install.sh -c 8.0 -i /usr/share/dotnet + +# Install .NET 7 SDK +RUN ./dotnet-install.sh -c 7.0 -i /usr/share/dotnet + +# Install .NET 6 SDK +RUN ./dotnet-install.sh -c 6.0 -i /usr/share/dotnet + +# Generate and export the development certificate +RUN dotnet dev-certs https -ep /certs/cert.pem -p '' && \ + chmod 644 /certs/cert.pem + +ENV ASPNETCORE_URLS="https://+;http://+" +ENV ASPNETCORE_HTTPS_PORT=443 +ENV ASPNETCORE_Kestrel__Certificates__Default__Password="" +ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/certs/cert.pem From ca2e336bd9bf9f493a9dfba61ca163fd6d1f7186 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Wed, 4 Dec 2024 19:54:18 +0300 Subject: [PATCH 02/22] Upgrade all packages and Microsoft artifacts: 1. to the most recent versions available 2. ideally to version 9.0.* --- .../Ocelot.Samples.AdministrationApi.csproj | 2 +- .../Ocelot.Samples.Basic.ApiGateway.csproj | 2 +- .../Ocelot.Samples.Eureka.ApiGateway.csproj | 5 +-- ...ot.Samples.Eureka.DownstreamService.csproj | 6 +-- samples/GraphQL/Ocelot.Samples.GraphQL.csproj | 8 ++-- ...celot.Samples.Kubernetes.ApiGateway.csproj | 2 +- ...amples.Kubernetes.DownstreamService.csproj | 4 +- .../Ocelot.Samples.OpenTracing.csproj | 15 ++----- ...Samples.ServiceDiscovery.ApiGateway.csproj | 2 +- ....ServiceDiscovery.DownstreamService.csproj | 6 +-- ...ot.Samples.ServiceFabric.ApiGateway.csproj | 9 ++-- ...les.ServiceFabric.DownstreamService.csproj | 8 ++-- samples/Web/Ocelot.Samples.Web.csproj | 2 +- .../Ocelot.Administration.csproj | 20 +++------ .../Ocelot.Cache.CacheManager.csproj | 25 +---------- .../Ocelot.Provider.Consul.csproj | 6 +-- .../Ocelot.Provider.Eureka.csproj | 4 +- .../Ocelot.Provider.Kubernetes.csproj | 6 +-- .../Ocelot.Provider.Polly.csproj | 4 +- .../Ocelot.Tracing.Butterfly.csproj | 4 +- .../Ocelot.Tracing.OpenTracing.csproj | 2 +- src/Ocelot/Ocelot.csproj | 19 +++------ .../Ocelot.AcceptanceTests.csproj | 41 +++++++------------ .../Ocelot.Benchmarks.csproj | 15 ++----- .../Ocelot.IntegrationTests.csproj | 27 +++--------- .../Ocelot.ManualTest.csproj | 20 +-------- test/Ocelot.Testing/Ocelot.Testing.csproj | 2 +- test/Ocelot.UnitTests/Ocelot.UnitTests.csproj | 37 +++++++---------- 28 files changed, 89 insertions(+), 214 deletions(-) diff --git a/samples/Administration/Ocelot.Samples.AdministrationApi.csproj b/samples/Administration/Ocelot.Samples.AdministrationApi.csproj index 943273aed..4632d2545 100644 --- a/samples/Administration/Ocelot.Samples.AdministrationApi.csproj +++ b/samples/Administration/Ocelot.Samples.AdministrationApi.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0 disable disable diff --git a/samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj b/samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj index c4209a428..845855aac 100644 --- a/samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj +++ b/samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0 disable disable InProcess diff --git a/samples/Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj b/samples/Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj index 190682c29..7ac8ac796 100644 --- a/samples/Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj +++ b/samples/Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj @@ -1,12 +1,9 @@  - net8.0 + net9.0 disable disable - - - PreserveNewest diff --git a/samples/Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj b/samples/Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj index 652d0131d..2ff83d76e 100644 --- a/samples/Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj +++ b/samples/Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj @@ -1,14 +1,14 @@  - net8.0 + net9.0 disable disable - + - + diff --git a/samples/GraphQL/Ocelot.Samples.GraphQL.csproj b/samples/GraphQL/Ocelot.Samples.GraphQL.csproj index 5f504b99b..029bce61b 100644 --- a/samples/GraphQL/Ocelot.Samples.GraphQL.csproj +++ b/samples/GraphQL/Ocelot.Samples.GraphQL.csproj @@ -1,19 +1,17 @@  - net8.0 + net9.0 disable disable - - - PreserveNewest - + + diff --git a/samples/Kubernetes/ApiGateway/Ocelot.Samples.Kubernetes.ApiGateway.csproj b/samples/Kubernetes/ApiGateway/Ocelot.Samples.Kubernetes.ApiGateway.csproj index 8da9d01d8..8cc1b8144 100644 --- a/samples/Kubernetes/ApiGateway/Ocelot.Samples.Kubernetes.ApiGateway.csproj +++ b/samples/Kubernetes/ApiGateway/Ocelot.Samples.Kubernetes.ApiGateway.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0 disable disable InProcess diff --git a/samples/Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj b/samples/Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj index d54d6de9f..2773d6759 100644 --- a/samples/Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj +++ b/samples/Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj @@ -1,13 +1,13 @@ - net8.0 + net9.0 disable disable InProcess Linux - + diff --git a/samples/OpenTracing/Ocelot.Samples.OpenTracing.csproj b/samples/OpenTracing/Ocelot.Samples.OpenTracing.csproj index b2a2c38bd..626779122 100644 --- a/samples/OpenTracing/Ocelot.Samples.OpenTracing.csproj +++ b/samples/OpenTracing/Ocelot.Samples.OpenTracing.csproj @@ -1,7 +1,7 @@  Exe - net8.0 + net9.0 disable disable @@ -13,17 +13,8 @@ - - - - - - - - - - - + + diff --git a/samples/ServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj b/samples/ServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj index 3fe5c39cb..e82285e91 100644 --- a/samples/ServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj +++ b/samples/ServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 disable disable diff --git a/samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj b/samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj index 60c62fd58..b310e7670 100644 --- a/samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj +++ b/samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj @@ -1,15 +1,13 @@  - net8.0 + net9.0 disable enable - - + - diff --git a/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj b/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj index 72479cfc1..c73be7254 100644 --- a/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj +++ b/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj @@ -1,12 +1,9 @@  Stateless Web Service for Stateful OcelotApplicationApiGateway App - net8.0 + net9.0 disable disable - OcelotApplicationApiGateway - OcelotApplicationApiGateway - x64 @@ -14,8 +11,8 @@ - - + + diff --git a/samples/ServiceFabric/DownstreamService/Ocelot.Samples.ServiceFabric.DownstreamService.csproj b/samples/ServiceFabric/DownstreamService/Ocelot.Samples.ServiceFabric.DownstreamService.csproj index 43aa8c895..2a223d8fe 100644 --- a/samples/ServiceFabric/DownstreamService/Ocelot.Samples.ServiceFabric.DownstreamService.csproj +++ b/samples/ServiceFabric/DownstreamService/Ocelot.Samples.ServiceFabric.DownstreamService.csproj @@ -1,7 +1,7 @@  Stateless Service Application - net8.0 + net9.0 disable disable OcelotApplicationService @@ -13,9 +13,9 @@ - - - + + + diff --git a/samples/Web/Ocelot.Samples.Web.csproj b/samples/Web/Ocelot.Samples.Web.csproj index 0433d962d..18257e423 100644 --- a/samples/Web/Ocelot.Samples.Web.csproj +++ b/samples/Web/Ocelot.Samples.Web.csproj @@ -2,7 +2,7 @@ 0.0.0-dev - net8.0 + net9.0 enable enable diff --git a/src/Ocelot.Administration/Ocelot.Administration.csproj b/src/Ocelot.Administration/Ocelot.Administration.csproj index ebc924a0f..c5b01de1b 100644 --- a/src/Ocelot.Administration/Ocelot.Administration.csproj +++ b/src/Ocelot.Administration/Ocelot.Administration.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -36,23 +36,15 @@ - - + - - - - - - - - - - - + + + + diff --git a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj index 7ac170844..74715e2da 100644 --- a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj +++ b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -37,32 +37,11 @@ - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj index b97fe54a9..6af7c6222 100644 --- a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj +++ b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -30,12 +30,10 @@ - + all - - diff --git a/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj b/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj index 361082668..ded010794 100644 --- a/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj +++ b/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -36,8 +36,6 @@ all - - diff --git a/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj b/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj index ba6d0b0b4..711ff0e80 100644 --- a/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj +++ b/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -30,11 +30,9 @@ all + - - - diff --git a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj index 46df97c7f..2084a8e0b 100644 --- a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj +++ b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -35,8 +35,6 @@ all - - diff --git a/src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj b/src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj index aee28bb3a..33b8ecaa8 100644 --- a/src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj +++ b/src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -36,8 +36,6 @@ all - - diff --git a/src/Ocelot.Tracing.OpenTracing/Ocelot.Tracing.OpenTracing.csproj b/src/Ocelot.Tracing.OpenTracing/Ocelot.Tracing.OpenTracing.csproj index 8c46e1480..fcbf7f7e0 100644 --- a/src/Ocelot.Tracing.OpenTracing/Ocelot.Tracing.OpenTracing.csproj +++ b/src/Ocelot.Tracing.OpenTracing/Ocelot.Tracing.OpenTracing.csproj @@ -1,6 +1,6 @@ - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable 0.0.0-dev diff --git a/src/Ocelot/Ocelot.csproj b/src/Ocelot/Ocelot.csproj index a22a44ffe..eafb4a446 100644 --- a/src/Ocelot/Ocelot.csproj +++ b/src/Ocelot/Ocelot.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 disable disable true @@ -37,25 +37,18 @@ all - - - - - - - - - - - - + + + + + diff --git a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj index 70a29bfed..63693e9f1 100644 --- a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj +++ b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net8.0 + net8.0;net9.0 disable disable false @@ -45,10 +45,11 @@ - + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -63,31 +64,15 @@ - + - + + all - - - - - - - - - - - - - - - - - @@ -96,9 +81,13 @@ - - - + + + + + + + diff --git a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj index a9eee073f..378ed72e5 100644 --- a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj +++ b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net8.0 + net8.0;net9.0 disable disable false @@ -22,20 +22,11 @@ + + all - - - - - - - - - - - diff --git a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj index d4b9e96f8..2e50a6168 100644 --- a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj +++ b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net8.0 + net8.0;net9.0 disable disable false @@ -36,10 +36,11 @@ - + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -53,21 +54,6 @@ - - - - - - - - - - - - - - - @@ -78,7 +64,4 @@ - - - diff --git a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj index bd45991e1..9dc7c30c5 100644 --- a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj +++ b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net8.0 + net8.0;net9.0 disable disable true @@ -33,23 +33,10 @@ + all - - - - - - - - - - - - - - @@ -59,7 +46,4 @@ - - - diff --git a/test/Ocelot.Testing/Ocelot.Testing.csproj b/test/Ocelot.Testing/Ocelot.Testing.csproj index 378b9e8b1..76b18d381 100644 --- a/test/Ocelot.Testing/Ocelot.Testing.csproj +++ b/test/Ocelot.Testing/Ocelot.Testing.csproj @@ -2,7 +2,7 @@ 0.0.0-dev - net6.0;net8.0 + net8.0;net9.0 enable enable diff --git a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj index 137f5b474..1a8fca9db 100644 --- a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj +++ b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net8.0 + net8.0;net9.0 disable disable false @@ -49,11 +49,12 @@ + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -66,33 +67,20 @@ + + + - + - - - - - - - - - - - - - - - - @@ -102,7 +90,12 @@ - - + + + + + + + From ddbdf48d5c57c7ffad17bd5137a393a410e6b787 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Wed, 4 Dec 2024 19:59:35 +0300 Subject: [PATCH 03/22] Fix compilation errors --- samples/GraphQL/Program.cs | 16 +++++++++------- .../DownstreamRouteFinderMiddleware.cs | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/samples/GraphQL/Program.cs b/samples/GraphQL/Program.cs index d30f9ea6d..cbfaa2078 100644 --- a/samples/GraphQL/Program.cs +++ b/samples/GraphQL/Program.cs @@ -11,8 +11,10 @@ using System.Linq; using System.Net; using System.Net.Http; +using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; +using GraphQL.NewtonsoftJson; namespace Ocelot.Samples.GraphQL; @@ -43,12 +45,12 @@ public class GraphQlDelegatingHandler : DelegatingHandler { //private readonly ISchema _schema; private readonly IDocumentExecuter _executer; - private readonly IDocumentWriter _writer; + private readonly IGraphQLTextSerializer _serializer; - public GraphQlDelegatingHandler(IDocumentExecuter executer, IDocumentWriter writer) + public GraphQlDelegatingHandler(IDocumentExecuter executer, IGraphQLTextSerializer serializer) { _executer = executer; - _writer = writer; + _serializer = serializer; } protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) @@ -68,12 +70,12 @@ protected override async Task SendAsync(HttpRequestMessage _.Query = query; }); - var responseBody = await _writer.WriteToStringAsync(result); - - //maybe check for errors and headers etc in real world? + // IGraphQLSerializer & IGraphQLTextSerializer: https://github.com/graphql-dotnet/graphql-dotnet/blob/master/docs2/site/docs/getting-started/transport.md#igraphqlserializer--igraphqltextserializer + var responseBody = _serializer.Serialize(result); + var media = new MediaTypeHeaderValue("application/graphql-response+json"); var response = new HttpResponseMessage(HttpStatusCode.OK) { - Content = new StringContent(responseBody) + Content = new StringContent(responseBody, media), }; //ocelot will treat this like any other http request... diff --git a/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs b/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs index 452c29e93..25278c0b3 100644 --- a/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs +++ b/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs @@ -31,7 +31,7 @@ public async Task Invoke(HttpContext httpContext) ? hostHeader.Split(':')[0] : hostHeader; var upstreamHeaders = httpContext.Request.Headers - .ToDictionary(h => h.Key, h => string.Join(';', h.Value)); + .ToDictionary(h => h.Key, h => string.Join(';', (IList)h.Value)); Logger.LogDebug(() => $"Upstream URL path is '{upstreamUrlPath}'."); From 4e94648082e6f9e64d0e4351b75754f095d94e62 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Wed, 4 Dec 2024 20:52:25 +0300 Subject: [PATCH 04/22] Fix warnings except NU1902: CS0618: 'DiscoveryApplicationBuilderExtensions.UseDiscoveryClient(IApplicationBuilder)' is obsolete: 'This method call is no longer needed, you should remove it.' MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\rmaks\.nuget\packages\microsoft.servicefabric.data\7.1.2493\lib\netstandard2.0\Microsoft.ServiceFabric.Data.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. SYSLIB0057: 'X509Certificate2.X509Certificate2(string, string?, X509KeyStorageFlags)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' Ignore NU1902: Package 'IdentityServer4' 4.1.2 has a known moderate severity vulnerability --- Ocelot.Release.sln | 115 ++++++++++++++++++ samples/Eureka/DownstreamService/Startup.cs | 2 - samples/Ocelot.Samples.sln | 12 +- ...ot.Samples.ServiceFabric.ApiGateway.csproj | 1 + .../OcelotBuilderExtensions.cs | 3 + 5 files changed, 125 insertions(+), 8 deletions(-) diff --git a/Ocelot.Release.sln b/Ocelot.Release.sln index 4460d9ddf..7a0a5ac20 100644 --- a/Ocelot.Release.sln +++ b/Ocelot.Release.sln @@ -1,3 +1,4 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34728.123 @@ -83,121 +84,235 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|x64.ActiveCfg = Debug|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|x64.Build.0 = Debug|Any CPU {54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.ActiveCfg = Release|Any CPU {54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.Build.0 = Release|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Release|x64.ActiveCfg = Release|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Release|x64.Build.0 = Release|Any CPU {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|x64.ActiveCfg = Debug|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|x64.Build.0 = Debug|Any CPU {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|Any CPU.ActiveCfg = Release|Any CPU {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|Any CPU.Build.0 = Release|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|x64.ActiveCfg = Release|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|x64.Build.0 = Release|Any CPU {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Debug|x64.ActiveCfg = Debug|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Debug|x64.Build.0 = Debug|Any CPU {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Release|Any CPU.ActiveCfg = Release|Any CPU {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Release|Any CPU.Build.0 = Release|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Release|x64.ActiveCfg = Release|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Release|x64.Build.0 = Release|Any CPU {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Debug|Any CPU.Build.0 = Debug|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Debug|x64.ActiveCfg = Debug|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Debug|x64.Build.0 = Debug|Any CPU {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Release|Any CPU.ActiveCfg = Release|Any CPU {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Release|Any CPU.Build.0 = Release|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Release|x64.ActiveCfg = Release|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Release|x64.Build.0 = Release|Any CPU {D4575572-99CA-4530-8737-C296EDA326F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D4575572-99CA-4530-8737-C296EDA326F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Debug|x64.ActiveCfg = Debug|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Debug|x64.Build.0 = Debug|Any CPU {D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.Build.0 = Release|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Release|x64.ActiveCfg = Release|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Release|x64.Build.0 = Release|Any CPU {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|x64.ActiveCfg = Debug|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|x64.Build.0 = Debug|Any CPU {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.Build.0 = Release|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|x64.ActiveCfg = Release|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|x64.Build.0 = Release|Any CPU {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|x64.ActiveCfg = Debug|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|x64.Build.0 = Debug|Any CPU {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.Build.0 = Release|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|x64.ActiveCfg = Release|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|x64.Build.0 = Release|Any CPU {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|x64.ActiveCfg = Debug|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|x64.Build.0 = Debug|Any CPU {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|Any CPU.ActiveCfg = Release|Any CPU {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|Any CPU.Build.0 = Release|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|x64.ActiveCfg = Release|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|x64.Build.0 = Release|Any CPU {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Debug|x64.ActiveCfg = Debug|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Debug|x64.Build.0 = Debug|Any CPU {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Release|Any CPU.ActiveCfg = Release|Any CPU {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Release|Any CPU.Build.0 = Release|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Release|x64.ActiveCfg = Release|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Release|x64.Build.0 = Release|Any CPU {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Debug|x64.ActiveCfg = Debug|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Debug|x64.Build.0 = Debug|Any CPU {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Release|Any CPU.Build.0 = Release|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Release|x64.ActiveCfg = Release|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Release|x64.Build.0 = Release|Any CPU {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|x64.ActiveCfg = Debug|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|x64.Build.0 = Debug|Any CPU {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.ActiveCfg = Release|Any CPU {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.Build.0 = Release|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|x64.ActiveCfg = Release|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|x64.Build.0 = Release|Any CPU {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|x64.ActiveCfg = Debug|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|x64.Build.0 = Debug|Any CPU {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.ActiveCfg = Release|Any CPU {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.Build.0 = Release|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|x64.ActiveCfg = Release|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|x64.Build.0 = Release|Any CPU {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|x64.ActiveCfg = Debug|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|x64.Build.0 = Debug|Any CPU {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|Any CPU.ActiveCfg = Release|Any CPU {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|Any CPU.Build.0 = Release|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|x64.ActiveCfg = Release|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|x64.Build.0 = Release|Any CPU {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|x64.ActiveCfg = Debug|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|x64.Build.0 = Debug|Any CPU {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.ActiveCfg = Release|Any CPU {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.Build.0 = Release|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|x64.ActiveCfg = Release|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|x64.Build.0 = Release|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.Build.0 = Debug|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|x64.ActiveCfg = Debug|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|x64.Build.0 = Debug|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.ActiveCfg = Release|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.Build.0 = Release|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|x64.ActiveCfg = Release|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|x64.Build.0 = Release|Any CPU {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|x64.ActiveCfg = Debug|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|x64.Build.0 = Debug|Any CPU {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Release|Any CPU.ActiveCfg = Release|Any CPU {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Release|Any CPU.Build.0 = Release|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Release|x64.ActiveCfg = Release|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Release|x64.Build.0 = Release|Any CPU {F00C73F4-019D-490D-8194-CA1754D717FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F00C73F4-019D-490D-8194-CA1754D717FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Debug|x64.ActiveCfg = Debug|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Debug|x64.Build.0 = Debug|Any CPU {F00C73F4-019D-490D-8194-CA1754D717FA}.Release|Any CPU.ActiveCfg = Release|Any CPU {F00C73F4-019D-490D-8194-CA1754D717FA}.Release|Any CPU.Build.0 = Release|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Release|x64.ActiveCfg = Release|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Release|x64.Build.0 = Release|Any CPU {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Debug|x64.ActiveCfg = Debug|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Debug|x64.Build.0 = Debug|Any CPU {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Release|Any CPU.ActiveCfg = Release|Any CPU {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Release|Any CPU.Build.0 = Release|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Release|x64.ActiveCfg = Release|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Release|x64.Build.0 = Release|Any CPU {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Debug|x64.ActiveCfg = Debug|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Debug|x64.Build.0 = Debug|Any CPU {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Release|Any CPU.Build.0 = Release|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Release|x64.ActiveCfg = Release|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Release|x64.Build.0 = Release|Any CPU {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Debug|x64.ActiveCfg = Debug|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Debug|x64.Build.0 = Debug|Any CPU {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Release|Any CPU.Build.0 = Release|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Release|x64.ActiveCfg = Release|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Release|x64.Build.0 = Release|Any CPU {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Debug|x64.ActiveCfg = Debug|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Debug|x64.Build.0 = Debug|Any CPU {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Release|Any CPU.ActiveCfg = Release|Any CPU {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Release|Any CPU.Build.0 = Release|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Release|x64.ActiveCfg = Release|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Release|x64.Build.0 = Release|Any CPU {161DD558-993D-491B-AD20-966127D71E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {161DD558-993D-491B-AD20-966127D71E49}.Debug|Any CPU.Build.0 = Debug|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Debug|x64.ActiveCfg = Debug|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Debug|x64.Build.0 = Debug|Any CPU {161DD558-993D-491B-AD20-966127D71E49}.Release|Any CPU.ActiveCfg = Release|Any CPU {161DD558-993D-491B-AD20-966127D71E49}.Release|Any CPU.Build.0 = Release|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Release|x64.ActiveCfg = Release|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Release|x64.Build.0 = Release|Any CPU {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Debug|x64.ActiveCfg = Debug|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Debug|x64.Build.0 = Debug|Any CPU {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Release|Any CPU.Build.0 = Release|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Release|x64.ActiveCfg = Release|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Release|x64.Build.0 = Release|Any CPU {F25EA682-A763-431B-9D88-012A388D3618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F25EA682-A763-431B-9D88-012A388D3618}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Debug|x64.ActiveCfg = Debug|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Debug|x64.Build.0 = Debug|Any CPU {F25EA682-A763-431B-9D88-012A388D3618}.Release|Any CPU.ActiveCfg = Release|Any CPU {F25EA682-A763-431B-9D88-012A388D3618}.Release|Any CPU.Build.0 = Release|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Release|x64.ActiveCfg = Release|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Release|x64.Build.0 = Release|Any CPU {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Debug|x64.ActiveCfg = Debug|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Debug|x64.Build.0 = Debug|Any CPU {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|Any CPU.ActiveCfg = Release|Any CPU {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|Any CPU.Build.0 = Release|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|x64.ActiveCfg = Release|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|x64.Build.0 = Release|Any CPU {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|x64.ActiveCfg = Debug|x64 + {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|x64.Build.0 = Debug|x64 {D991C694-01F0-4F04-8135-5C133DC8E029}.Release|Any CPU.ActiveCfg = Release|Any CPU {D991C694-01F0-4F04-8135-5C133DC8E029}.Release|Any CPU.Build.0 = Release|Any CPU + {D991C694-01F0-4F04-8135-5C133DC8E029}.Release|x64.ActiveCfg = Release|x64 + {D991C694-01F0-4F04-8135-5C133DC8E029}.Release|x64.Build.0 = Release|x64 {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Debug|x64.ActiveCfg = Debug|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Debug|x64.Build.0 = Debug|Any CPU {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|Any CPU.ActiveCfg = Release|Any CPU {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|Any CPU.Build.0 = Release|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|x64.ActiveCfg = Release|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|x64.Build.0 = Release|Any CPU {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Debug|x64.ActiveCfg = Debug|Any CPU + {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Debug|x64.Build.0 = Debug|Any CPU {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Release|Any CPU.Build.0 = Release|Any CPU + {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Release|x64.ActiveCfg = Release|Any CPU + {1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/Eureka/DownstreamService/Startup.cs b/samples/Eureka/DownstreamService/Startup.cs index b05eeb98e..fd72ce9a2 100644 --- a/samples/Eureka/DownstreamService/Startup.cs +++ b/samples/Eureka/DownstreamService/Startup.cs @@ -30,7 +30,5 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseDeveloperExceptionPage(); } - - app.UseDiscoveryClient(); } } diff --git a/samples/Ocelot.Samples.sln b/samples/Ocelot.Samples.sln index 93aeba9c6..4599cc5e7 100644 --- a/samples/Ocelot.Samples.sln +++ b/samples/Ocelot.Samples.sln @@ -37,6 +37,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Release|Any CPU.Build.0 = Release|Any CPU {238467FE-19EE-4102-9AF7-51EB2C6F0354}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {238467FE-19EE-4102-9AF7-51EB2C6F0354}.Debug|Any CPU.Build.0 = Debug|Any CPU {238467FE-19EE-4102-9AF7-51EB2C6F0354}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -77,18 +81,14 @@ Global {60E14B1A-C295-453B-910E-58E09F5A28AA}.Debug|Any CPU.Build.0 = Debug|Any CPU {60E14B1A-C295-453B-910E-58E09F5A28AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {60E14B1A-C295-453B-910E-58E09F5A28AA}.Release|Any CPU.Build.0 = Release|Any CPU - {115F7934-3326-492A-B131-64F0EAEBAD71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {115F7934-3326-492A-B131-64F0EAEBAD71}.Debug|Any CPU.Build.0 = Debug|Any CPU + {115F7934-3326-492A-B131-64F0EAEBAD71}.Debug|Any CPU.ActiveCfg = Debug|x64 + {115F7934-3326-492A-B131-64F0EAEBAD71}.Debug|Any CPU.Build.0 = Debug|x64 {115F7934-3326-492A-B131-64F0EAEBAD71}.Release|Any CPU.ActiveCfg = Release|Any CPU {115F7934-3326-492A-B131-64F0EAEBAD71}.Release|Any CPU.Build.0 = Release|Any CPU {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Debug|Any CPU.Build.0 = Debug|Any CPU {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Release|Any CPU.ActiveCfg = Release|Any CPU {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Release|Any CPU.Build.0 = Release|Any CPU - {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B37314F1-C1B5-4D38-8000-E6E96C0CBD30}.Release|Any CPU.Build.0 = Release|Any CPU {EA553F5C-4B94-4E4A-8C3E-0124C5EA5F6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EA553F5C-4B94-4E4A-8C3E-0124C5EA5F6E}.Debug|Any CPU.Build.0 = Debug|Any CPU {EA553F5C-4B94-4E4A-8C3E-0124C5EA5F6E}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj b/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj index c73be7254..5adf624f5 100644 --- a/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj +++ b/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj @@ -4,6 +4,7 @@ net9.0 disable disable + Any CPU;x64 diff --git a/src/Ocelot.Administration/OcelotBuilderExtensions.cs b/src/Ocelot.Administration/OcelotBuilderExtensions.cs index 9c862aa3d..197ccfe1e 100644 --- a/src/Ocelot.Administration/OcelotBuilderExtensions.cs +++ b/src/Ocelot.Administration/OcelotBuilderExtensions.cs @@ -91,7 +91,10 @@ private static void AddIdentityServer(IIdentityServerConfiguration identityServe else { //todo - refactor so calls method? +#pragma warning disable SYSLIB0057 // Type or member is obsolete + // TODO: Refactor the code to phase out IdentityServer4 in favor of its successor or replace with ASP.NET Identity framework var cert = new X509Certificate2(identityServerConfiguration.CredentialsSigningCertificateLocation, identityServerConfiguration.CredentialsSigningCertificatePassword, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable); +#pragma warning restore SYSLIB0057 // Type or member is obsolete identityServerBuilder.AddSigningCredential(cert); } } From cab130eda7e069d8f67020bf7503f4afa0a506ce Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Wed, 4 Dec 2024 21:09:48 +0300 Subject: [PATCH 05/22] Fix IDE messages --- Ocelot.Release.sln | 4 +- .../OcelotBuilderExtensions.cs | 48 ++++++++----------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/Ocelot.Release.sln b/Ocelot.Release.sln index 7a0a5ac20..1b69b6edc 100644 --- a/Ocelot.Release.sln +++ b/Ocelot.Release.sln @@ -289,8 +289,8 @@ Global {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|Any CPU.Build.0 = Release|Any CPU {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|x64.ActiveCfg = Release|Any CPU {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|x64.Build.0 = Release|Any CPU - {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.ActiveCfg = Debug|x64 + {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.Build.0 = Debug|x64 {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|x64.ActiveCfg = Debug|x64 {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|x64.Build.0 = Debug|x64 {D991C694-01F0-4F04-8135-5C133DC8E029}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/src/Ocelot.Administration/OcelotBuilderExtensions.cs b/src/Ocelot.Administration/OcelotBuilderExtensions.cs index 197ccfe1e..cb95472bb 100644 --- a/src/Ocelot.Administration/OcelotBuilderExtensions.cs +++ b/src/Ocelot.Administration/OcelotBuilderExtensions.cs @@ -53,9 +53,9 @@ private static void AddIdentityServer(Action configOptions, IO .AddJwtBearer("Bearer", configOptions); } - private static void AddIdentityServer(IIdentityServerConfiguration identityServerConfiguration, IAdministrationPath adminPath, IOcelotBuilder builder, IConfiguration configuration) + private static void AddIdentityServer(IdentityServerConfiguration identityServerConfiguration, AdministrationPath adminPath, IOcelotBuilder builder, IConfiguration configuration) { - builder.Services.TryAddSingleton(identityServerConfiguration); + builder.Services.TryAddSingleton(identityServerConfiguration); var identityServerBuilder = builder.Services .AddIdentityServer(o => { @@ -91,47 +91,41 @@ private static void AddIdentityServer(IIdentityServerConfiguration identityServe else { //todo - refactor so calls method? +#pragma warning disable IDE0079 // Remove unnecessary suppression #pragma warning disable SYSLIB0057 // Type or member is obsolete // TODO: Refactor the code to phase out IdentityServer4 in favor of its successor or replace with ASP.NET Identity framework var cert = new X509Certificate2(identityServerConfiguration.CredentialsSigningCertificateLocation, identityServerConfiguration.CredentialsSigningCertificatePassword, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable); #pragma warning restore SYSLIB0057 // Type or member is obsolete +#pragma warning restore IDE0079 // Remove unnecessary suppression identityServerBuilder.AddSigningCredential(cert); } } - private static IEnumerable ApiScopes(IIdentityServerConfiguration identityServerConfiguration) - { - return identityServerConfiguration.AllowedScopes.Select(s => new ApiScope(s)); - } + private static IEnumerable ApiScopes(IdentityServerConfiguration configuration) + => configuration.AllowedScopes.Select(s => new ApiScope(s)); - private static List Resources(IIdentityServerConfiguration identityServerConfiguration) + private static List Resources(IdentityServerConfiguration configuration) => new() { - return new List + new(configuration.ApiName, configuration.ApiName) { - new(identityServerConfiguration.ApiName, identityServerConfiguration.ApiName) + ApiSecrets = new List { - ApiSecrets = new List + new() { - new() - { - Value = identityServerConfiguration.ApiSecret.Sha256(), - }, + Value = configuration.ApiSecret.Sha256(), }, }, - }; - } + }, + }; - private static List Client(IIdentityServerConfiguration identityServerConfiguration) + private static List Client(IdentityServerConfiguration configuration) => new() { - return new List + new() { - new() - { - ClientId = identityServerConfiguration.ApiName, - AllowedGrantTypes = GrantTypes.ClientCredentials, - ClientSecrets = new List {new(identityServerConfiguration.ApiSecret.Sha256())}, - AllowedScopes = identityServerConfiguration.AllowedScopes, - }, - }; - } + ClientId = configuration.ApiName, + AllowedGrantTypes = GrantTypes.ClientCredentials, + ClientSecrets = new List {new(configuration.ApiSecret.Sha256())}, + AllowedScopes = configuration.AllowedScopes, + }, + }; } From 2b8ed6bd53cafb4b88594ce28dc85644b85f283d Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Wed, 4 Dec 2024 22:01:24 +0300 Subject: [PATCH 06/22] Fix integration tests: The 'Should_be_able_to_use_token_from_ocelot_a_on_ocelot_b' test related to IdentityServer4 requires migration to .NET 9 or removing --- test/Ocelot.IntegrationTests/AdministrationTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Ocelot.IntegrationTests/AdministrationTests.cs b/test/Ocelot.IntegrationTests/AdministrationTests.cs index a0e89a212..e4558c26f 100644 --- a/test/Ocelot.IntegrationTests/AdministrationTests.cs +++ b/test/Ocelot.IntegrationTests/AdministrationTests.cs @@ -113,7 +113,11 @@ public async Task Should_return_OK_status_and_multiline_indented_json_response_w await ThenTheResultHaveMultiLineIndentedJson(); } +#if NET9_0 + [Fact(Skip = "Require migration to .NET 9 or removing")] +#else [Fact] +#endif public async Task Should_be_able_to_use_token_from_ocelot_a_on_ocelot_b() { var configuration = new FileConfiguration(); From fc7b90a56b819b34726f011a841c616458211e12 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Wed, 4 Dec 2024 22:13:09 +0300 Subject: [PATCH 07/22] Build using the Docker image version 9.24.0 (Linux OS, double SDKs) --- .circleci/config.yml | 4 ++-- build.cake | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f274ae6fc..8146f58ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,14 +4,14 @@ orbs: jobs: build: docker: - - image: ocelot2/circleci-build:latest + - image: ocelot2/circleci-build:9.24.0 resource_class: medium+ steps: - checkout - run: dotnet dev-certs https && dotnet tool restore && dotnet cake release: docker: - - image: ocelot2/circleci-build:latest + - image: ocelot2/circleci-build:9.24.0 resource_class: medium+ steps: - checkout diff --git a/build.cake b/build.cake index a38836e04..611b85875 100644 --- a/build.cake +++ b/build.cake @@ -14,8 +14,8 @@ using System.Linq; using System.Text.RegularExpressions; const string Release = "Release"; // task name, target, and Release config name -const string AllFrameworks = "net6.0;net7.0;net8.0"; -const string LatestFramework = "net8.0"; +const string AllFrameworks = "net8.0;net9.0"; +const string LatestFramework = "net9.0"; var compileConfig = Argument("configuration", Release); // compile @@ -96,7 +96,7 @@ Task("Compile") }; if (target != Release) { - settings.Framework = LatestFramework; // build using .NET 8 SDK only + settings.Framework = LatestFramework; // build using .NET 9 SDK only } string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework; Information($"Settings {nameof(DotNetBuildSettings.Framework)}: {frameworkInfo}"); @@ -467,7 +467,7 @@ Task("RunUnitTests") }; if (target != Release) { - settings.Framework = LatestFramework; // .NET 8 SDK only + settings.Framework = LatestFramework; // .NET 9 SDK only } string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework; Information($"Settings {nameof(DotNetTestSettings.Framework)}: {frameworkInfo}"); @@ -520,14 +520,13 @@ Task("RunAcceptanceTests") var settings = new DotNetTestSettings { Configuration = compileConfig, - // Framework = LatestFramework, // .NET 8 SDK only ArgumentCustomization = args => args .Append("--no-restore") .Append("--no-build") }; if (target != Release) { - settings.Framework = LatestFramework; // .NET 8 SDK only + settings.Framework = LatestFramework; // .NET 9 SDK only } string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework; Information($"Settings {nameof(DotNetTestSettings.Framework)}: {frameworkInfo}"); @@ -542,14 +541,13 @@ Task("RunIntegrationTests") var settings = new DotNetTestSettings { Configuration = compileConfig, - // Framework = LatestFramework, // .NET 8 SDK only ArgumentCustomization = args => args .Append("--no-restore") .Append("--no-build") }; if (target != Release) { - settings.Framework = LatestFramework; // .NET 8 SDK only + settings.Framework = LatestFramework; // .NET 9 SDK only } string frameworkInfo = string.IsNullOrEmpty(settings.Framework) ? AllFrameworks : settings.Framework; Information($"Settings {nameof(DotNetTestSettings.Framework)}: {frameworkInfo}"); From 823ef095f8d763c313dd1b7fc241e5e9ae2ff73a Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 01:12:20 +0300 Subject: [PATCH 08/22] Add `BddfyConfig` class to override the default BDDfy report behavior in `Steps` --- .../Properties/BddfyConfig.cs | 62 +++++++++++++++++++ test/Ocelot.AcceptanceTests/Steps.cs | 6 +- 2 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs diff --git a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs new file mode 100644 index 000000000..a95ad61c6 --- /dev/null +++ b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs @@ -0,0 +1,62 @@ +using System.Collections.Concurrent; +using TestStack.BDDfy.Configuration; + +namespace Ocelot.AcceptanceTests; + +public class BddfyConfig +{ + public BddfyConfig() + { + Configurator.BatchProcessors.HtmlReport.Disable(); + Configurator.BatchProcessors.Add(new BddfyTitleAndStatusReporter()); + + // Configurator.Processors.ConsoleReport.RunsOn(story => story.Result != Result.Passed); + Configurator.Processors.ConsoleReport.Disable(); + Configurator.Processors.Add(() => new BddfyTitleAndStatusProcessor()); + } +} + +public class BddfyTitleAndStatusProcessor : IProcessor +{ + private static ConcurrentDictionary cache = new(); + public ProcessType ProcessType => ProcessType.Report; + public void Process(Story story) + { + //Console.WriteLine($"{story.Result} Story: {story.Namespace} | Total Scenarios: {story.Scenarios.Count()}"); + foreach (var scenario in story.Scenarios) + { + if (cache.TryAdd(scenario.Id, scenario)) + { + Console.ForegroundColor = scenario.Result == Result.Passed ? ConsoleColor.Green : ConsoleColor.Red; + Console.Write(scenario.Result); + Console.ForegroundColor = ConsoleColor.Yellow; + Console.Write($" {scenario.Id}: "); + Console.ForegroundColor = ConsoleColor.Blue; + Console.Write(scenario.Title); + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine($", in {scenario.Duration.TotalSeconds} sec"); + Console.ResetColor(); + } + } + } +} + +public class BddfyTitleAndStatusReporter : IBatchProcessor +{ + public static void Process(Story story) + { + foreach (var scenario in story.Scenarios) + { + Result status = scenario.Result; + Console.WriteLine($"Scenario: {scenario.Title} - Status: {status}"); + } + } + + public void Process(IEnumerable stories) + { + foreach (var scenario in stories) + { + Process(scenario); + } + } +} diff --git a/test/Ocelot.AcceptanceTests/Steps.cs b/test/Ocelot.AcceptanceTests/Steps.cs index 9c27b9aea..808720a8d 100644 --- a/test/Ocelot.AcceptanceTests/Steps.cs +++ b/test/Ocelot.AcceptanceTests/Steps.cs @@ -34,7 +34,7 @@ namespace Ocelot.AcceptanceTests; -public class Steps : IDisposable +public class Steps : BddfyConfig, IDisposable { protected TestServer _ocelotServer; protected HttpClient _ocelotClient; @@ -53,13 +53,13 @@ public class Steps : IDisposable private IWebHost _ocelotHost; // TODO remove because of one reference private IOcelotConfigurationChangeTokenSource _changeToken; - public Steps() + public Steps() : base() { _random = new Random(); _testId = Guid.NewGuid(); _ocelotConfigFileName = $"{_testId:N}-{ConfigurationBuilderExtensions.PrimaryConfigFile}"; Files = new() { _ocelotConfigFileName }; - Folders = new(); + Folders = new(); } protected List Files { get; } From ee2142530c0729b8f43310d050582e095289c691 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 02:18:12 +0300 Subject: [PATCH 09/22] Disable BatchProcessors --- .../Properties/BddfyConfig.cs | 38 +++++++++++++------ .../ConsulServiceDiscoveryTests.cs | 2 +- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs index a95ad61c6..0509c0ade 100644 --- a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs +++ b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs @@ -7,16 +7,16 @@ public class BddfyConfig { public BddfyConfig() { - Configurator.BatchProcessors.HtmlReport.Disable(); - Configurator.BatchProcessors.Add(new BddfyTitleAndStatusReporter()); - // Configurator.Processors.ConsoleReport.RunsOn(story => story.Result != Result.Passed); Configurator.Processors.ConsoleReport.Disable(); - Configurator.Processors.Add(() => new BddfyTitleAndStatusProcessor()); + Configurator.Processors.Add(() => new BddfyProcessor()); + + //Configurator.BatchProcessors.Add(new BddfyBatchProcessingReporter()); + Configurator.BatchProcessors.HtmlReport.Disable(); } } -public class BddfyTitleAndStatusProcessor : IProcessor +public class BddfyProcessor : IProcessor { private static ConcurrentDictionary cache = new(); public ProcessType ProcessType => ProcessType.Report; @@ -41,22 +41,36 @@ public void Process(Story story) } } -public class BddfyTitleAndStatusReporter : IBatchProcessor +public class BddfyBatchProcessingReporter : IBatchProcessor { + private static int totalStories; + private static int totalScenarios; + private static Result final = Result.NotExecuted; + public static void Process(Story story) { + //foreach (var scenario in story.Scenarios) + //{ + // //Console.WriteLine($"Scenario: {scenario.Title} - Status: {scenario.Result}"); + // totalScenarios++; + //} foreach (var scenario in story.Scenarios) { - Result status = scenario.Result; - Console.WriteLine($"Scenario: {scenario.Title} - Status: {status}"); + //Console.WriteLine($"Scenario: {scenario.Title} - Status: {scenario.Result}"); + totalScenarios++; } + totalStories++; + final = (Result)Math.Max((int)story.Result, (int)final); } public void Process(IEnumerable stories) { - foreach (var scenario in stories) - { - Process(scenario); - } + var list = stories.ToList(); + list.ForEach(Process); + + Console.WriteLine("Warning: Per-scenario logging has been disabled!"); + Console.WriteLine($"The {nameof(BddfyBatchProcessingReporter)} has processed total {totalStories} stories with total {totalScenarios} scenarios."); + Console.WriteLine($"Final result: {final}"); + Console.WriteLine(); } } diff --git a/test/Ocelot.AcceptanceTests/ServiceDiscovery/ConsulServiceDiscoveryTests.cs b/test/Ocelot.AcceptanceTests/ServiceDiscovery/ConsulServiceDiscoveryTests.cs index 650f32602..0ff30725f 100644 --- a/test/Ocelot.AcceptanceTests/ServiceDiscovery/ConsulServiceDiscoveryTests.cs +++ b/test/Ocelot.AcceptanceTests/ServiceDiscovery/ConsulServiceDiscoveryTests.cs @@ -397,7 +397,7 @@ public void ShouldReturnDifferentServicesWhenThereAre2SequentialRequestsToDiffer [InlineData(true, nameof(LeastConnectionAnalyzer))] // extended scenario using analyzer [InlineData(false, nameof(RoundRobin))] [InlineData(true, nameof(RoundRobinAnalyzer))] - public void ShouldReturnDifferentServicesWhenSequentiallylyRequestingToDifferentServices(bool withAnalyzer, string loadBalancer) + public void ShouldReturnDifferentServicesWhenSequentiallyRequestingToDifferentServices(bool withAnalyzer, string loadBalancer) { var consulPort = PortFinder.GetRandomPort(); var ports = PortFinder.GetPorts(Bug2119ServiceNames.Length); From 1ee67b0f859df0e607309198f92204afe6254067 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 02:54:27 +0300 Subject: [PATCH 10/22] IDE0130: Namespace "Ocelot.AcceptanceTests" does not match folder structure, expected "Ocelot.AcceptanceTests.Properties" Where -> \test\Ocelot.AcceptanceTests\Properties\BddfyConfig.cs L4 --- test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs | 2 +- test/Ocelot.AcceptanceTests/Steps.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs index 0509c0ade..1ab3dfe43 100644 --- a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs +++ b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; using TestStack.BDDfy.Configuration; -namespace Ocelot.AcceptanceTests; +namespace Ocelot.AcceptanceTests.Properties; public class BddfyConfig { diff --git a/test/Ocelot.AcceptanceTests/Steps.cs b/test/Ocelot.AcceptanceTests/Steps.cs index 808720a8d..1de34abb3 100644 --- a/test/Ocelot.AcceptanceTests/Steps.cs +++ b/test/Ocelot.AcceptanceTests/Steps.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Ocelot.AcceptanceTests.Caching; +using Ocelot.AcceptanceTests.Properties; using Ocelot.Cache.CacheManager; using Ocelot.Configuration.ChangeTracking; using Ocelot.Configuration.Creator; From ea7c2ac86418353129b7e80386d434a0d8d2f434 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:08:15 +0300 Subject: [PATCH 11/22] Raynald is refactoring super star! Warning: Unexpected character sequence in array element value. Where: samples\Administration\Issue645.postman_collection.json L135+145 --- samples/Administration/Issue645.postman_collection.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/Administration/Issue645.postman_collection.json b/samples/Administration/Issue645.postman_collection.json index 6fedd16b9..170aa0f9f 100644 --- a/samples/Administration/Issue645.postman_collection.json +++ b/samples/Administration/Issue645.postman_collection.json @@ -132,7 +132,7 @@ "id": "0f60e7b3-e4f1-4458-bbc4-fc4809e86b2d", "type": "text/javascript", "exec": [ - string.Empty + "" ] } }, @@ -142,9 +142,9 @@ "id": "1279a2cf-b771-4a86-9dfa-302b240fac62", "type": "text/javascript", "exec": [ - string.Empty + "" ] } } ] -} \ No newline at end of file +} From 09ca2cffecdf87aa5c4836932c8d38b7b1d41669 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:13:47 +0300 Subject: [PATCH 12/22] CA1816: A method that is an implementation of Dispose does not call GC.SuppressFinalize; or a method that is not an implementation of Dispose calls GC.SuppressFinalize; or a method calls GC.SuppressFinalize and passes something other than this (Me in Visual Basic). Where: test\Ocelot.AcceptanceTests\HeaderTests.cs L460 --- test/Ocelot.AcceptanceTests/HeaderTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Ocelot.AcceptanceTests/HeaderTests.cs b/test/Ocelot.AcceptanceTests/HeaderTests.cs index da388c43f..772bcc12e 100644 --- a/test/Ocelot.AcceptanceTests/HeaderTests.cs +++ b/test/Ocelot.AcceptanceTests/HeaderTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.AcceptanceTests; -public class HeaderTests : IDisposable +public sealed class HeaderTests : IDisposable { private int _count; private readonly Steps _steps; @@ -459,7 +459,7 @@ private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath, int public void Dispose() { - _serviceHandler?.Dispose(); + _serviceHandler.Dispose(); _steps.Dispose(); } } From 23397c899f53a6fed47e9d0030969a66f762ed47 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:19:06 +0300 Subject: [PATCH 13/22] CA1859: Using concrete types avoids virtual or interface call overhead and enables inlining. Change type of variable 'client' from 'Ocelot.WebSockets.IClientWebSocket' to 'Ocelot.WebSockets.ClientWebSocketProxy' for improved performance Where: test\Ocelot.AcceptanceTests\WebSocketTests.cs L128+180 --- test/Ocelot.AcceptanceTests/WebSocketTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Ocelot.AcceptanceTests/WebSocketTests.cs b/test/Ocelot.AcceptanceTests/WebSocketTests.cs index 18881018d..5dc674496 100644 --- a/test/Ocelot.AcceptanceTests/WebSocketTests.cs +++ b/test/Ocelot.AcceptanceTests/WebSocketTests.cs @@ -125,7 +125,7 @@ private async Task WhenIStartTheClients() private async Task StartClient(string url) { - IClientWebSocket client = new ClientWebSocketProxy(); + var client = new ClientWebSocketProxy(); await client.ConnectAsync(new Uri(url), CancellationToken.None); @@ -177,7 +177,7 @@ private async Task StartSecondClient(string url) { await Task.Delay(500); - IClientWebSocket client = new ClientWebSocketProxy(); + var client = new ClientWebSocketProxy(); await client.ConnectAsync(new Uri(url), CancellationToken.None); From 3a2626e8a00f5c25a90412d10d2c197fdfbcf686 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:25:15 +0300 Subject: [PATCH 14/22] CA2211: Static fields that are neither constants nor read-only are not thread-safe. Access to such a field must be carefully controlled and requires advanced programming techniques to synchronize access to the class object. Where: src\Ocelot.Administration\IdentityServerMiddlewareConfigurationProvider.cs L10 --- .../IdentityServerMiddlewareConfigurationProvider.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Ocelot.Administration/IdentityServerMiddlewareConfigurationProvider.cs b/src/Ocelot.Administration/IdentityServerMiddlewareConfigurationProvider.cs index 694de5b08..98ab2b341 100644 --- a/src/Ocelot.Administration/IdentityServerMiddlewareConfigurationProvider.cs +++ b/src/Ocelot.Administration/IdentityServerMiddlewareConfigurationProvider.cs @@ -1,13 +1,14 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Ocelot.Configuration.Repository; -using Ocelot.Middleware; namespace Ocelot.Administration; public static class IdentityServerMiddlewareConfigurationProvider { - public static OcelotMiddlewareConfigurationDelegate Get = builder => + public static OcelotMiddlewareConfigurationDelegate Get { get; } = Getter; + + private static Task Getter(IApplicationBuilder builder) { var internalConfigRepo = builder.ApplicationServices.GetService(); @@ -37,5 +38,5 @@ public static class IdentityServerMiddlewareConfigurationProvider } return Task.CompletedTask; - }; + } } From a43de0948a5dbe9ecec631d6fa61e5110adf1c0c Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:28:17 +0300 Subject: [PATCH 15/22] IDE0044: Make field readonly Where: test\Ocelot.AcceptanceTests\Properties\BddfyConfig.cs L21 --- test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs index 1ab3dfe43..fd74d3d70 100644 --- a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs +++ b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs @@ -18,14 +18,14 @@ public BddfyConfig() public class BddfyProcessor : IProcessor { - private static ConcurrentDictionary cache = new(); + private static readonly ConcurrentDictionary Cache = new(); public ProcessType ProcessType => ProcessType.Report; public void Process(Story story) { //Console.WriteLine($"{story.Result} Story: {story.Namespace} | Total Scenarios: {story.Scenarios.Count()}"); foreach (var scenario in story.Scenarios) { - if (cache.TryAdd(scenario.Id, scenario)) + if (Cache.TryAdd(scenario.Id, scenario)) { Console.ForegroundColor = scenario.Result == Result.Passed ? ConsoleColor.Green : ConsoleColor.Red; Console.Write(scenario.Result); From ff84b4b16b4ca3fd6dd32a2deb1f7aa0f1c2b0e4 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:39:03 +0300 Subject: [PATCH 16/22] IDE0039 Use local function --- .../Configuration/FileConfigurationController.cs | 4 +--- test/Ocelot.AcceptanceTests/AggregateTests.cs | 10 +++++----- test/Ocelot.IntegrationTests/AdministrationTests.cs | 10 ++++------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Ocelot/Configuration/FileConfigurationController.cs b/src/Ocelot/Configuration/FileConfigurationController.cs index e33dda7c3..53d9b24a9 100644 --- a/src/Ocelot/Configuration/FileConfigurationController.cs +++ b/src/Ocelot/Configuration/FileConfigurationController.cs @@ -12,13 +12,11 @@ public class FileConfigurationController : Controller { private readonly IFileConfigurationRepository _repo; private readonly IFileConfigurationSetter _setter; - private readonly IServiceProvider _provider; - public FileConfigurationController(IFileConfigurationRepository repo, IFileConfigurationSetter setter, IServiceProvider provider) + public FileConfigurationController(IFileConfigurationRepository repo, IFileConfigurationSetter setter) { _repo = repo; _setter = setter; - _provider = provider; } [HttpGet] diff --git a/test/Ocelot.AcceptanceTests/AggregateTests.cs b/test/Ocelot.AcceptanceTests/AggregateTests.cs index eee1a1823..ece87d673 100644 --- a/test/Ocelot.AcceptanceTests/AggregateTests.cs +++ b/test/Ocelot.AcceptanceTests/AggregateTests.cs @@ -527,7 +527,7 @@ public void Should_return_response_200_with_user_forwarding() var route2 = GivenRoute(port2, "/tom", "Tom"); var configuration = GivenConfiguration(route1, route2); var identityServerUrl = $"{Uri.UriSchemeHttp}://localhost:{port3}"; - Action options = o => + void configureOptions(IdentityServerAuthenticationOptions o) { o.Authority = identityServerUrl; o.ApiName = "api"; @@ -535,20 +535,20 @@ public void Should_return_response_200_with_user_forwarding() o.SupportedTokens = SupportedTokens.Both; o.ApiSecret = "secret"; o.ForwardDefault = IdentityServerAuthenticationDefaults.AuthenticationScheme; - }; + } Action configureServices = s => { s.AddOcelot(); - s.AddMvcCore(options => + s.AddMvcCore(mvc => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .RequireClaim("scope", "api") .Build(); - options.Filters.Add(new AuthorizeFilter(policy)); + mvc.Filters.Add(new AuthorizeFilter(policy)); }); s.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme) - .AddIdentityServerAuthentication(options); + .AddIdentityServerAuthentication(configureOptions); }; var count = 0; var actualContexts = new HttpContext[2]; diff --git a/test/Ocelot.IntegrationTests/AdministrationTests.cs b/test/Ocelot.IntegrationTests/AdministrationTests.cs index e4558c26f..19cd9c822 100644 --- a/test/Ocelot.IntegrationTests/AdministrationTests.cs +++ b/test/Ocelot.IntegrationTests/AdministrationTests.cs @@ -95,14 +95,13 @@ public async Task Should_return_response_200_with_call_re_routes_controller_usin public async Task Should_return_OK_status_and_multiline_indented_json_response_with_json_options_for_custom_builder() { var configuration = new FileConfiguration(); - - Func customBuilder = (builder, assembly) => + static IMvcCoreBuilder customBuilder(IMvcCoreBuilder builder, Assembly assembly) { return builder.AddApplicationPart(assembly) .AddControllersAsServices() .AddAuthorization() .AddJsonOptions(options => { options.JsonSerializerOptions.WriteIndented = true; }); - }; + } await GivenThereIsAConfiguration(configuration); GivenOcelotUsingBuilderIsRunning(customBuilder); @@ -484,8 +483,7 @@ public async Task Should_return_response_200_with_call_re_routes_controller_when var port = PortFinder.GetRandomPort(); var identityServerRootUrl = $"http://localhost:{port}"; - - Action options = o => + void options(JwtBearerOptions o) { o.Authority = identityServerRootUrl; o.RequireHttpsMetadata = false; @@ -493,7 +491,7 @@ public async Task Should_return_response_200_with_call_re_routes_controller_when { ValidateAudience = false, }; - }; + } await GivenThereIsAConfiguration(configuration); await GivenThereIsAnIdentityServerOn(identityServerRootUrl, "api"); From 0113de147a0f890f516395f6c1fd119e746d85c3 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:42:21 +0300 Subject: [PATCH 17/22] IDE0059 Avoid unnecessary value assignments in your code, as these likely indicate redundant value computations. If the value computation is not redundant and you intend to retain the assignment, then change the assignment target to a local variable whose name starts with an underscore and is optionally followed by an integer, such as '_', '_1', '_2', etc. These are treated as special discard symbol names. --- src/Ocelot/Middleware/OcelotMiddlewareExtensions.cs | 4 ++-- test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Ocelot/Middleware/OcelotMiddlewareExtensions.cs b/src/Ocelot/Middleware/OcelotMiddlewareExtensions.cs index 549d15591..0ad302abd 100644 --- a/src/Ocelot/Middleware/OcelotMiddlewareExtensions.cs +++ b/src/Ocelot/Middleware/OcelotMiddlewareExtensions.cs @@ -31,7 +31,7 @@ public static async Task UseOcelot(this IApplicationBuilder public static async Task UseOcelot(this IApplicationBuilder builder, OcelotPipelineConfiguration pipelineConfiguration) { - var configuration = await CreateConfiguration(builder); + _ = await CreateConfiguration(builder); ConfigureDiagnosticListener(builder); @@ -156,7 +156,7 @@ private static void ThrowToStopOcelotStarting(Response config) private static void ConfigureDiagnosticListener(IApplicationBuilder builder) { - var env = builder.ApplicationServices.GetService(); + _ = builder.ApplicationServices.GetService(); var listener = builder.ApplicationServices.GetService(); var diagnosticListener = builder.ApplicationServices.GetService(); diagnosticListener.SubscribeWithAdapter(listener); diff --git a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs index fd74d3d70..f5694fda7 100644 --- a/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs +++ b/test/Ocelot.AcceptanceTests/Properties/BddfyConfig.cs @@ -54,11 +54,7 @@ public static void Process(Story story) // //Console.WriteLine($"Scenario: {scenario.Title} - Status: {scenario.Result}"); // totalScenarios++; //} - foreach (var scenario in story.Scenarios) - { - //Console.WriteLine($"Scenario: {scenario.Title} - Status: {scenario.Result}"); - totalScenarios++; - } + totalScenarios += story.Scenarios.Count(); totalStories++; final = (Result)Math.Max((int)story.Result, (int)final); } From f499d4f432d52e74aa38f0623d1f68b0841c0d85 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:46:34 +0300 Subject: [PATCH 18/22] IDE1006 Naming rule violation: These words must begin with upper case characters --- test/Ocelot.AcceptanceTests/HeaderTests.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/Ocelot.AcceptanceTests/HeaderTests.cs b/test/Ocelot.AcceptanceTests/HeaderTests.cs index 772bcc12e..9b382cce9 100644 --- a/test/Ocelot.AcceptanceTests/HeaderTests.cs +++ b/test/Ocelot.AcceptanceTests/HeaderTests.cs @@ -16,7 +16,7 @@ public HeaderTests() } [Fact] - public void should_transform_upstream_header() + public void Should_transform_upstream_header() { var port = PortFinder.GetRandomPort(); @@ -57,7 +57,7 @@ public void should_transform_upstream_header() } [Fact] - public void should_transform_downstream_header() + public void Should_transform_downstream_header() { var port = PortFinder.GetRandomPort(); @@ -97,7 +97,7 @@ public void should_transform_downstream_header() } [Fact] - public void should_fix_issue_190() + public void Should_fix_issue_190() { var port = PortFinder.GetRandomPort(); @@ -141,7 +141,7 @@ public void should_fix_issue_190() } [Fact] - public void should_fix_issue_205() + public void Should_fix_issue_205() { var port = PortFinder.GetRandomPort(); @@ -185,7 +185,7 @@ public void should_fix_issue_205() } [Fact] - public void should_fix_issue_417() + public void Should_fix_issue_417() { var port = PortFinder.GetRandomPort(); @@ -233,7 +233,7 @@ public void should_fix_issue_417() } [Fact] - public void request_should_reuse_cookies_with_cookie_container() + public void Request_should_reuse_cookies_with_cookie_container() { var port = PortFinder.GetRandomPort(); @@ -276,7 +276,7 @@ public void request_should_reuse_cookies_with_cookie_container() } [Fact] - public void request_should_have_own_cookies_no_cookie_container() + public void Request_should_have_own_cookies_no_cookie_container() { var port = PortFinder.GetRandomPort(); @@ -319,7 +319,7 @@ public void request_should_have_own_cookies_no_cookie_container() } [Fact] - public void issue_474_should_not_put_spaces_in_header() + public void Issue_474_should_not_put_spaces_in_header() { var port = PortFinder.GetRandomPort(); @@ -356,7 +356,7 @@ public void issue_474_should_not_put_spaces_in_header() } [Fact] - public void issue_474_should_put_spaces_in_header() + public void Issue_474_should_put_spaces_in_header() { var port = PortFinder.GetRandomPort(); From 9a10657d42a19cec818e04891ce127b83d1cc357 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:48:50 +0300 Subject: [PATCH 19/22] IDE0079 Remove unnecessary suppression --- test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs b/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs index cfea1e518..a921a06da 100644 --- a/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs +++ b/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs @@ -131,12 +131,14 @@ private void GivenOcelotIsRunningOnHttpSysWithCustomBodyMaxSize(long customBodyM _realServer = Host.CreateDefaultBuilder() .ConfigureWebHostDefaults(webBuilder => { +#pragma warning disable IDE0079 // Remove unnecessary suppression #pragma warning disable CA1416 // Validate platform compatibility webBuilder.UseHttpSys(options => { options.MaxRequestBodySize = customBodyMaxSize; }) #pragma warning restore CA1416 // Validate platform compatibility +#pragma warning restore IDE0079 // Remove unnecessary suppression .ConfigureAppConfiguration((hostingContext, config) => { config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath); From ddfcea32672c3d314394b7092cbdd5ef3c579e45 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 03:59:28 +0300 Subject: [PATCH 20/22] IDE0330 Use 'System.Threading.Lock' --- test/Ocelot.AcceptanceTests/StickySessionsTests.cs | 4 ++++ test/Ocelot.IntegrationTests/AdministrationTests.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/Ocelot.AcceptanceTests/StickySessionsTests.cs b/test/Ocelot.AcceptanceTests/StickySessionsTests.cs index 9127a02d3..b8f2337f1 100644 --- a/test/Ocelot.AcceptanceTests/StickySessionsTests.cs +++ b/test/Ocelot.AcceptanceTests/StickySessionsTests.cs @@ -8,7 +8,11 @@ namespace Ocelot.AcceptanceTests; public sealed class StickySessionsTests : Steps, IDisposable { private readonly int[] _counters; +#if NET9_0_OR_GREATER + private static readonly Lock SyncLock = new(); +#else private static readonly object SyncLock = new(); +#endif private readonly ServiceHandler[] _handlers; public StickySessionsTests() : base() diff --git a/test/Ocelot.IntegrationTests/AdministrationTests.cs b/test/Ocelot.IntegrationTests/AdministrationTests.cs index 19cd9c822..e3f92d5e3 100644 --- a/test/Ocelot.IntegrationTests/AdministrationTests.cs +++ b/test/Ocelot.IntegrationTests/AdministrationTests.cs @@ -112,7 +112,7 @@ static IMvcCoreBuilder customBuilder(IMvcCoreBuilder builder, Assembly assembly) await ThenTheResultHaveMultiLineIndentedJson(); } -#if NET9_0 +#if NET9_0_OR_GREATER [Fact(Skip = "Require migration to .NET 9 or removing")] #else [Fact] From f15ffc3b02cf253c91a10fcee5db09ac4817a8d3 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 04:01:50 +0300 Subject: [PATCH 21/22] IDE1006 Naming rule violation: These words must begin with upper case characters: Fix compilation error --- .../Controllers/FileConfigurationControllerTests.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs b/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs index 11f0cafe7..51abac911 100644 --- a/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs +++ b/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs @@ -15,18 +15,16 @@ public class FileConfigurationControllerTests : UnitTest private readonly Mock _setter; private IActionResult _result; private FileConfiguration _fileConfiguration; - private readonly Mock _provider; public FileConfigurationControllerTests() { - _provider = new Mock(); _repo = new Mock(); _setter = new Mock(); - _controller = new FileConfigurationController(_repo.Object, _setter.Object, _provider.Object); + _controller = new FileConfigurationController(_repo.Object, _setter.Object); } [Fact] - public void should_get_file_configuration() + public void Should_get_file_configuration() { var expected = new OkResponse(new FileConfiguration()); @@ -37,7 +35,7 @@ public void should_get_file_configuration() } [Fact] - public void should_return_error_when_cannot_get_config() + public void Should_return_error_when_cannot_get_config() { var expected = new ErrorResponse(It.IsAny()); @@ -49,7 +47,7 @@ public void should_return_error_when_cannot_get_config() } [Fact] - public void should_post_file_configuration() + public void Should_post_file_configuration() { var expected = new FileConfiguration(); @@ -61,7 +59,7 @@ public void should_post_file_configuration() } [Fact] - public void should_return_error_when_cannot_set_config() + public void Should_return_error_when_cannot_set_config() { var expected = new FileConfiguration(); From d6a22eccda0028ebb619f54fa57f4f41bdad0243 Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Thu, 5 Dec 2024 04:05:58 +0300 Subject: [PATCH 22/22] Ignore xUnit1004: Test methods should not be skipped --- test/Ocelot.IntegrationTests/AdministrationTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Ocelot.IntegrationTests/AdministrationTests.cs b/test/Ocelot.IntegrationTests/AdministrationTests.cs index e3f92d5e3..b0e23657e 100644 --- a/test/Ocelot.IntegrationTests/AdministrationTests.cs +++ b/test/Ocelot.IntegrationTests/AdministrationTests.cs @@ -113,7 +113,11 @@ static IMvcCoreBuilder customBuilder(IMvcCoreBuilder builder, Assembly assembly) } #if NET9_0_OR_GREATER +#pragma warning disable IDE0079 // Remove unnecessary suppression +#pragma warning disable xUnit1004 // Test methods should not be skipped [Fact(Skip = "Require migration to .NET 9 or removing")] +#pragma warning restore xUnit1004 // Test methods should not be skipped +#pragma warning restore IDE0079 // Remove unnecessary suppression #else [Fact] #endif