Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2219 Upgrade Docker, CircleCI and update to net8.0, net9.0 target frameworks #2230

Merged
merged 22 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9ee9b64
Update Docker
raman-m Dec 4, 2024
ca2e336
Upgrade all packages and Microsoft artifacts:
raman-m Dec 4, 2024
ddbdf48
Fix compilation errors
raman-m Dec 4, 2024
4e94648
Fix warnings except NU1902:
raman-m Dec 4, 2024
cab130e
Fix IDE messages
raman-m Dec 4, 2024
2b8ed6b
Fix integration tests:
raman-m Dec 4, 2024
fc7b90a
Build using the Docker image version 9.24.0 (Linux OS, double SDKs)
raman-m Dec 4, 2024
823ef09
Add `BddfyConfig` class to override the default BDDfy report behavior…
raman-m Dec 4, 2024
ee21425
Disable BatchProcessors
raman-m Dec 4, 2024
1ee67b0
IDE0130: Namespace "Ocelot.AcceptanceTests" does not match folder str…
raman-m Dec 4, 2024
ea7c2ac
Raynald is refactoring super star!
raman-m Dec 5, 2024
09ca2cf
CA1816: A method that is an implementation of Dispose does not call G…
raman-m Dec 5, 2024
23397c8
CA1859: Using concrete types avoids virtual or interface call overhea…
raman-m Dec 5, 2024
3a2626e
CA2211: Static fields that are neither constants nor read-only are no…
raman-m Dec 5, 2024
a43de09
IDE0044: Make field readonly
raman-m Dec 5, 2024
ff84b4b
IDE0039 Use local function
raman-m Dec 5, 2024
0113de1
IDE0059 Avoid unnecessary value assignments in your code, as these li…
raman-m Dec 5, 2024
f499d4f
IDE1006 Naming rule violation: These words must begin with upper case…
raman-m Dec 5, 2024
9a10657
IDE0079 Remove unnecessary suppression
raman-m Dec 5, 2024
ddfcea3
IDE0330 Use 'System.Threading.Lock'
raman-m Dec 5, 2024
f15ffc3
IDE1006 Naming rule violation: These words must begin with upper case…
raman-m Dec 5, 2024
d6a22ec
Ignore xUnit1004: Test methods should not be skipped
raman-m Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
119 changes: 117 additions & 2 deletions Ocelot.Release.sln

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}");
Expand Down Expand Up @@ -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}");
Expand Down Expand Up @@ -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}");
Expand All @@ -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}");
Expand Down
17 changes: 0 additions & 17 deletions docker/8.21.0/Dockerfile.build

This file was deleted.

21 changes: 0 additions & 21 deletions docker/8.21.0/Dockerfile.release

This file was deleted.

11 changes: 0 additions & 11 deletions docker/8.21.0/build.sh

This file was deleted.

19 changes: 6 additions & 13 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 24 additions & 0 deletions docker/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -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
27 changes: 22 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions docker/build-windows.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 9 additions & 8 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
25 changes: 25 additions & 0 deletions docker/outdated/Dockerfile.8.23.2.base
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions samples/Administration/Issue645.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"id": "0f60e7b3-e4f1-4458-bbc4-fc4809e86b2d",
"type": "text/javascript",
"exec": [
string.Empty
""
]
}
},
Expand All @@ -142,9 +142,9 @@
"id": "1279a2cf-b771-4a86-9dfa-302b240fac62",
"type": "text/javascript",
"exec": [
string.Empty
""
]
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<None Update="ocelot.json;appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Steeltoe.Discovery.Client" Version="1.1.0" />
<PackageReference Include="Steeltoe.Discovery.ClientCore" Version="3.2.8" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Web\Ocelot.Samples.Web.csproj" />
Expand Down
2 changes: 0 additions & 2 deletions samples/Eureka/DownstreamService/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,5 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseDeveloperExceptionPage();
}

app.UseDiscoveryClient();
}
}
8 changes: 3 additions & 5 deletions samples/GraphQL/Ocelot.Samples.GraphQL.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<None Update="ocelot.json;appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="GraphQL" Version="4.8.0" />
<PackageReference Include="GraphQL" Version="8.2.1" />
<PackageReference Include="GraphQL.NewtonsoftJson" Version="8.2.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
Expand Down
Loading